Explore powerful integrations with GribStream through this Python client library, offering access to key weather datasets like NBM, GFS, and RAP. Ideal for developers needing data for SkewT LogP charts and more.
The Python Client for GribStream is a robust library designed to interface seamlessly with GribStream, enabling efficient access to diverse meteorological datasets. This client facilitates leveraging datasets such as The National Blend of Models (NBM), The Global Forecast System (GFS), and The Rapid Refresh (RAP). GFS and RAP datasets are particularly well-suited for generating SkewT LogP charts.
Below is an example showcasing how to utilize the GribStreamClient to query forecasts and historical data:
from client import GribStreamClient
import datetime
with GribStreamClient(apikey=None) as client: # Using DEMO API token
# Query NBM weather forecasts
print("Query all NBM weather forecasts for three parameters, over a three hour range, ten hours out, for three coordinates")
start = datetime.datetime.now(datetime.UTC)
df = client.forecasts(
dataset='nbm',
forecasted_from=datetime.datetime(year=2024, month=8, day=10, hour=0),
forecasted_until=datetime.datetime(year=2024, month=8, day=10, hour=3),
coordinates=[
{"lat": 40.75, "lon": -73.98},
{"lat": 29.75, "lon": -95.36},
{"lat": 47.60, "lon": -122.33},
],
variables=[
{"name": "TMP", "level": "2 m above ground", "info": ""},
{"name": "WIND", "level": "10 m above ground", "info": ""},
{"name": "DPT", "level": "2 m above ground", "info": ""},
],
min_horizon=1,
max_horizon=10,
)
print(df.sort_values(['forecasted_time', 'lat', 'lon']).head(20).to_string(index=False))
print('response in:', datetime.datetime.now(datetime.UTC) - start)
# Query GFS historical data
print("Query the best GFS historical data for two parameters, for a three day range, for three coordinates, as of the end of the second day")
start = datetime.datetime.now(datetime.UTC)
df = client.history(
dataset='gfs',
from_time=datetime.datetime(year=2022, month=8, day=10, hour=0),
until_time=datetime.datetime(year=2022, month=8, day=13, hour=0),
coordinates=[
{"lat": 40.75, "lon": -73.98},
{"lat": 29.75, "lon": -95.36},
{"lat": 47.60, "lon": -122.33},
],
variables=[
{"name": "TMP", "level": "2 m above ground", "info": ""},
{"name": "TMP", "level": "surface", "info": ""},
],
as_of=datetime.datetime(year=2024, month=8, day=12, hour=0),
min_horizon=0,
max_horizon=264,
)
print(df.sort_values(['forecasted_time', 'lat', 'lon']).head(20).to_string(index=False))
print('response in:', datetime.datetime.now(datetime.UTC) - start)
print("done")
This client is ideal for meteorologists, data scientists, and developers looking to integrate weather data into their applications effortlessly. For additional features and updates, visit GribStream’s ProductHunt page.
No comments yet.
Sign in to be the first to comment.