From 068bb3a5463da37adf0df0105a535589f198e299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 26 May 2020 11:39:05 +0300 Subject: [PATCH] add sine wave generator --- II/Referatas/sinewave.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 II/Referatas/sinewave.py diff --git a/II/Referatas/sinewave.py b/II/Referatas/sinewave.py new file mode 100755 index 0000000..74f1ca5 --- /dev/null +++ b/II/Referatas/sinewave.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +from pyproj import CRS +import numpy as np +import geopandas as gpd +from shapely.geometry import LineString + +INTERVAL = 0.5 +TAIL_LEN = 4 +SINE_LEN = 7 + + +def main(): + tails = np.zeros(int(TAIL_LEN / INTERVAL)) + amplitude = np.sin(np.arange(0, SINE_LEN, INTERVAL)) + y = np.concatenate([tails, amplitude, tails]) + x = np.arange(-TAIL_LEN, SINE_LEN+TAIL_LEN, INTERVAL) + geom = LineString(zip(x, y)) + df = gpd.GeoDataFrame(crs=CRS(3346)) + df['geometry'] = None + df.loc[0, 'geometry'] = geom + df.to_file("sinewave.json", driver='GeoJSON') + + +if __name__ == '__main__': + main()