sine wave with shapes
This commit is contained in:
parent
17d047bc49
commit
6d9897652f
@ -1,19 +1,22 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
from math import pi
|
||||||
from pyproj import CRS
|
from pyproj import CRS
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import geopandas as gpd
|
import geopandas as gpd
|
||||||
from shapely.geometry import LineString
|
from shapely.geometry import LineString
|
||||||
|
|
||||||
INTERVAL = 0.5
|
INTERVAL = 0.1
|
||||||
TAIL_LEN = 4
|
TAIL_LEN = 4
|
||||||
SINE_LEN = 7
|
SINE_LEN = 7
|
||||||
|
|
||||||
|
TAILS = np.zeros(int(TAIL_LEN / INTERVAL))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
tails = np.zeros(int(TAIL_LEN / INTERVAL))
|
sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL)
|
||||||
amplitude = np.sin(np.arange(0, SINE_LEN, INTERVAL))
|
amplitude = np.sin(sin_range * pi / 2) + 1
|
||||||
y = np.concatenate([tails, amplitude, tails])
|
y = np.concatenate([TAILS, amplitude, TAILS])
|
||||||
x = np.arange(-TAIL_LEN, SINE_LEN+TAIL_LEN, INTERVAL)
|
x = np.arange(-TAIL_LEN - pi/4, SINE_LEN + TAIL_LEN, INTERVAL)
|
||||||
geom = LineString(zip(x, y))
|
geom = LineString(zip(x, y))
|
||||||
df = gpd.GeoDataFrame(crs=CRS(3346))
|
df = gpd.GeoDataFrame(crs=CRS(3346))
|
||||||
df['geometry'] = None
|
df['geometry'] = None
|
||||||
|
Loading…
Reference in New Issue
Block a user