Skip to main content

Convert U/V raster to streamlines (geojson)

Project description

windsaloft

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

streamlines

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=(',', ':'))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

windsaloft-0.0.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file windsaloft-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: windsaloft-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for windsaloft-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51169f2e13af4acceb93ecb8aead5664623ddb80313ac54854f76d772c1853c5
MD5 9a3d90ec33c9ac84cc409d1235f2c6af
BLAKE2b-256 893889c000d3b1b41d3aea4497c96484675fe4c669ec04d83c447b5c6a022039

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page