Metadata-Version: 2.1
Name: windsaloft
Version: 0.0.2
Summary: Convert U/V raster to streamlines (geojson)
Home-page: https://github.com/olehz/windsaloft
Author: Oleh Zamkovyi
Author-email: oleh.zam@gmail.com
License: MIT
Keywords: map weather geojson gis gfs streamline
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
Requires-Dist: geojson
Provides-Extra: test
Requires-Dist: numpy ; extra == 'test'
Requires-Dist: pytest ; extra == 'test'

# windsaloft

Convert a vectorial raster field into streamlines. The output is in a convenient GeoJSON format.

![streamlines](https://user-images.githubusercontent.com/157599/117187271-6e52c900-ade4-11eb-8f1c-aae793afae5d.png)

Installation
-----

Install the latest version from the Python Package Index:

	$ pip install windsaloft


Usage
-----

To create the streamlines, a vectorial field is needed:


	import numpy as np
	import geojson
	import pygrib
	import windsaloft

	grib = pygrib.open('data.grib2')

U/V Components

	u = grib.select(shortName='u')[0].values
	v = grib.select(shortName='v')[0].values

Convert GRIBs data to "standard" -180 to 180 extent global grids

	u = np.roll(u, u.shape[1] // 2, axis=1)
	v = np.roll(v, v.shape[1] // 2, axis=1)

Calculate streams

	feature_collection = windsaloft.jet_streams(u, v, pixel_dist=5, min_value=10, smooth=2, zigzag_degrees=45)

Write output to a file

	with open('streams.geojson', 'w') as fileout:
	    geojson.dump(feature_collection, fileout, sort_keys=True, separators=(',', ':'))


