Skip to main content

Easy lat/lon/altitude queries against NOAA HRRR/GFS weather data for rocketry.

Project description

SDAtmospheric

This package allows for arbitrary data decoding for variables related to high powered rocketry by querying HRRR and GFS data above the continental united states

Install

cfgrib needs the eccodes C library. Easiest on conda-forge:

conda install -c conda-forge eccodes cfgrib herbie-data
pip install -e .

Pip-only (Linux/macOS or recent Windows with eccodes wheels):

pip install eccodes
pip install -e .

Basic usage

The SDAtmospheric API is built around the Atmosphere class, which represents a snapshot of the atmospheric model above the continental US at any given time. The Atmosphere class provides only two methods:

from sdatmospheric import Atmosphere
atmos = Atmosphere()

atmos.q(LATITUDE, LONGITUDE)        # Returns a `State` function closure (described below)
atmost.preload(LATITUDE, LONGITUDE) # Preloads a certain GRIB grid square around a given point

In reality, the Atmosphere class is lazy, and only loads wind data for the times and the regions directly queried by the host application. Because GRIB downloads and decoding is an involved process, we implement the use of 2 caching levels:

  • Hot Caching, where the data for a given location is stored within program memory, so queries within a region that is hot cached requires only a program memory lookup (~50ms)
  • Warm Caching, which will store GRIB regions on disk and allow for a relatively quick disk lookup rather than a redownload from the NOAA servers (~3s)

Full cache misses will trigger a download from the NOAA servers, which (depending on server traffic) can take a few minutes.

State Return

The return type of Atmosphere.q is a State-returning function closure. This means that Atmosphere.q returns a function f that, given an altitude, returns a State object.

class State(NamedTuple):
    u: float        # east wind, m/s
    v: float        # north wind, m/s
    T: float        # K
    rho: float      # kg/m^3
    P: float        # Pa
    mach_v: float   # m/s, speed of sound

Models

Atmosphere(model="hrrr") # 3km spatial resolution, 1h temporal up to 48h, 20km ceiling
Atmosphere(model="gfs") # 0.25 degree spatial resolution, 6h temporal up to 384h, 50km ceiling 
Atmosphere(model="blend") # Blends between the hrrr and gfs models
Atmosphere(model="blend", blend_range=(15_000, 19_000)) # Adjusable blending range (default 17km)

Forecasting

The analysis time defaults to the latest available analysis for the given model. This can be overridden to provide future (and past) analyses of weather data at a location.

Atmosphere(time="2025-08-03T12:00Z") # Specific time
Atmosphere(forecast_hours=3) # Forecast 3h in the future

Conventions

  • Altitude: MSL by default. alt_ref="agl" subtracts surface elevation at the query point.
  • Longitude: accept within CONUS
  • Ceiling: altitudes above the top pressure level emit a UserWarning and extrapolate based on a linear fit
  • Cache: herbie stores subset GRIBs under ~/data/ by default, and can be overridden with cache_dir=....

Project details


Download files

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

Source Distribution

sdatmospheric-0.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

sdatmospheric-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file sdatmospheric-0.1.0.tar.gz.

File metadata

  • Download URL: sdatmospheric-0.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for sdatmospheric-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e06a65f66fc9100496752d20e92e7af1bb91851737f6959706461af5b56deda
MD5 184e331210272b8b28ab182324c4f0f7
BLAKE2b-256 c8f975d8ba995a4a124e89f0e427f6c09bf604f32f5bc0676d24537f9699ca25

See more details on using hashes here.

File details

Details for the file sdatmospheric-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sdatmospheric-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for sdatmospheric-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a47654f4b8fcc0c109879cd3ab1bce4f6d1f86c5fdf93b36596d49aa210c2e4
MD5 e4df3a088af127a0c0f4fc651726f199
BLAKE2b-256 71ba28a33939e1cc9c33724381b3c5c5f6a80ef4da8914f86176ea7739ce4396

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