Skip to main content

Rust-first weather model metadata and projected map rendering bindings

Project description

rustwx Python bindings

rustwx is the optional Python binding package for the Rust-first rustwx weather workspace.

Design goal

Keep Python convenient, keep the hot path in Rust, and expose generic render/model metadata surfaces that are usable outside WRF-specific callers.

What is implemented

With the python feature enabled, the module exposes:

  • agent-facing discovery and map rendering via agent_capabilities_json, list_domains_json, render_maps_json, render_glm_lightning_json, and sample_point_timeseries_json
  • model listing and source/model helpers
  • projected-grid rendering via render_projected_map and render_projected_map_json
  • compatibility aliases render_wrf_map and render_wrf_map_json
  • standalone projected projection metadata via describe_projected_projection
  • standalone projected grid/layout metadata via describe_projected_geometry
  • standalone projected CONUS basemap overlay extraction via build_projected_basemap_overlays
  • future-facing cross-section request validation/normalization via normalize_cross_section_request
  • native sounding-column rendering via render_sounding_column and render_sounding_column_json

The wheel also installs a stable rustwx console command for agent and MCP adapters:

rustwx capabilities
rustwx list-domains --kind country --limit 5
rustwx render-maps --date 20260424 --model hrrr --domain california --product 2m_temperature_10m_winds --out-dir out
rustwx render-lightning --domain california --data-dir C:\Users\drew\lightning-test\data\glm --out-dir out
rustwx sample-point-timeseries --date 20260427 --cycle 0 --lat 40.802 --lon -124.164 --forecast-hour-end 6

render-maps accepts mixed product slugs and routes them to the appropriate direct, light derived, heavy ECAPE-derived, or HRRR windowed product path. Heavy ECAPE slugs such as sbecape, mlecape, muecape, ECAPE/CAPE ratios, NCAPE, ECIN, and ECAPE EHI/SCP/STP use the canonical derived_batch ECAPE path; they do not require callers to discover or run separate binaries.

When cache_dir / --cache-dir is omitted, the agent API uses a shared rustwx_outputs/cache fetch/decode cache, or RUSTWX_CACHE_DIR when that environment variable is set. The cache is intentionally independent of out_dir and map bounds, so city or bbox sweeps can reuse the same upstream GRIB fetches while writing PNGs into different output folders.

MCP servers should call these stable Python/CLI entry points instead of invoking internal proof binaries.

render_glm_lightning_json / rustwx render-lightning reads GOES GLM OR_GLM-L2-LCFA_*.nc files, renders native Rust projected flash maps, and writes a JSON flash artifact with lat/lon, time, energy, and area fields for agent consumption.

sample_point_timeseries_json samples native model fields at a lat/lon over a forecast-hour range for meteograms and point-and-click agent tools. The default variable set is HRRR-meteogram ready: 2 m T/Td/Tw/RH, 10 m wind/gust, hourly and accumulated QPF, low/mid/high clouds, MSLP, VPD, HDW, and the fire-weather composite. It uses rustwx's GRIB/idx fetch path and shared cache rather than cfgrib/xarray.

Every new projected helper has both a Python-object entry point and a _json variant:

  • Python-object entry points accept either a JSON string or a JSON-serializable Python dict
  • _json entry points keep returning pretty JSON strings for low-friction interop

Projected map API

The projected map surface is generic and public-facing. The caller supplies:

  • lat, lon, field as numpy.ndarray 2-D arrays
  • a render spec with product metadata, color scale, layout, and projection metadata
  • optional contour, overlay, and wind layers

render_projected_map(...) writes the PNG and returns a Python dict with:

  • typed projection, extents, layout, and layers sections
  • legacy pixel_bounds, data_extent, valid_data_extent, and projection_info keys for compatibility

Minimal example

import rustwx

print(rustwx.list_models_json())

Point time-series example

import json
import rustwx

report = rustwx.sample_point_timeseries_json(json.dumps({
    "model": "hrrr",
    "date_yyyymmdd": "20260427",
    "cycle_utc": 0,
    "source": "nomads",
    "lat": 40.802,
    "lon": -124.164,
    "forecast_hour_start": 0,
    "forecast_hour_end": 6,
    "variables": ["temperature_2m_c", "relative_humidity_2m_pct", "wind_speed_10m_ms", "hdw"],
}))
print(report)

Projected render example

import rustwx

spec = {
    "output_path": "example.png",
    "product_key": "Example",
    "field_units": "dBZ",
    "scale": {
        "kind": "palette",
        "palette": "reflectivity",
        "levels": [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70],
        "extend": "Both",
    },
    "projection": {
        "map_proj": 1,
        "truelat1": 30.0,
        "truelat2": 60.0,
        "stand_lon": -97.0,
        "cen_lat": 38.0,
        "cen_lon": -97.0,
    },
    "width": 1100,
    "height": 850,
    "basemap_style": "none",
}

metadata = rustwx.render_projected_map(spec, lat, lon, field)
print(metadata["projection"]["kind"])
print(metadata["pixel_bounds"])

Geometry and overlay metadata example

surface = {
    "projection": spec["projection"],
    "width": 1100,
    "height": 850,
    "visual_mode": "filled_meteorology",
    "basemap_style": "filled",
}

geometry = rustwx.describe_projected_geometry(
    surface,
    lat,
    lon,
    include_projected_domain=False,
)
overlays = rustwx.build_projected_basemap_overlays(
    surface,
    lat,
    lon,
    include_geometry=False,
)

print(geometry["extents"]["padded"])
print(overlays["counts"])

Cross-section request normalization example

normalize_cross_section_request(...) does not render a cross-section yet. It validates and fills defaults for a future shared cross-section API surface.

xsect = rustwx.normalize_cross_section_request(
    {
        "path": {
            "start": {"lat": 39.74, "lon": -104.99, "label": "Denver"},
            "end": {"lat": 41.88, "lon": -87.63, "label": "Chicago"},
        },
        "field": {"product_key": "temperature", "field_units": "degC"},
    }
)

print(xsect["path_metrics"])
print(xsect["request"]["axis"])

Current limits

  • projected rendering still expects caller-owned arrays
  • cross-section support is validation/normalization only in this crate
  • render_maps_json covers model fetch/download/render orchestration for direct, derived, heavy ECAPE-derived, and HRRR windowed map products
  • sample_point_timeseries_json is a point data primitive; consumer-specific meteogram styling stays outside the Python wheel
  • sounding rendering expects a caller-supplied validated column; model fetch and lat/lon extraction live in the Rust CLI for now

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

rustwx-0.5.5.tar.gz (2.0 MB view details)

Uploaded Source

Built Distributions

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

rustwx-0.5.5-cp313-cp313-win_amd64.whl (6.1 MB view details)

Uploaded CPython 3.13Windows x86-64

rustwx-0.5.5-cp313-cp313-manylinux_2_39_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

rustwx-0.5.5-cp313-cp313-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustwx-0.5.5-cp312-cp312-win_amd64.whl (6.1 MB view details)

Uploaded CPython 3.12Windows x86-64

rustwx-0.5.5-cp312-cp312-manylinux_2_39_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

rustwx-0.5.5-cp312-cp312-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustwx-0.5.5-cp311-cp311-win_amd64.whl (6.1 MB view details)

Uploaded CPython 3.11Windows x86-64

rustwx-0.5.5-cp311-cp311-manylinux_2_39_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

rustwx-0.5.5-cp311-cp311-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rustwx-0.5.5-cp310-cp310-win_amd64.whl (6.1 MB view details)

Uploaded CPython 3.10Windows x86-64

rustwx-0.5.5-cp310-cp310-manylinux_2_39_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

rustwx-0.5.5-cp310-cp310-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file rustwx-0.5.5.tar.gz.

File metadata

  • Download URL: rustwx-0.5.5.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rustwx-0.5.5.tar.gz
Algorithm Hash digest
SHA256 84615340a3864dd6235b5a28d82d3006e14ce06f071b30bda6047ae3db9c7fdf
MD5 b50ee051311f9d202af8970aac9a18c1
BLAKE2b-256 d2364e9314ffd0e2defcdf541f996be6acce8b1ec1e5fa6b9b4f184d435f6a71

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5.tar.gz:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rustwx-0.5.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rustwx-0.5.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 638f7bf4f97bbc57246445edf3dc43fa29855da495f2e359e336fd60ab6cbba2
MD5 0486166e14b09332a7664fa6c3776da5
BLAKE2b-256 1f36cc4bbe8c34a7f9eaf71adc36c6d6e4e1c89809f030560f6b81a7f7e6f1d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp313-cp313-win_amd64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.5-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 0ef7b3ff4acf207d09863bcd0254a057c53b5341aac539f479eb89b2efa72190
MD5 84f84ea825bb7cf3a10404f1a070fcd9
BLAKE2b-256 bda8d5ba25d0150f23a1dbaed8f06c2971cfce2237bf761978c3064ea6477bc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp313-cp313-manylinux_2_39_x86_64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6cbad078d99c9e31c7a3cb0a079609f1e9680097173421d9433db55aaa94650
MD5 9af0a652ea3cb74e0ef3166ee9fbdeba
BLAKE2b-256 16e35922242f7a946dc992cb0d259ce451f99895fa2b65ff621aa7d15442a10d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rustwx-0.5.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rustwx-0.5.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 48e1e7a357ee466e95d407c866842666ae64e662139d590d1982e8f53d561da5
MD5 e63b2c04582a09860a31769fec135b3e
BLAKE2b-256 59b2317dc8f4d98cd568bfee9758cb57aecd68b9cb8b45563631829524b7d66b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp312-cp312-win_amd64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.5-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 1c6753f2e367fc2e9b1f246b6e755c23f724aa0659e26ba96ae95b26fd6b1cbc
MD5 115996ab3fd09ccaf60b10983323aec2
BLAKE2b-256 268f8a69bbabfd909bac4a6aeab870eb97acd994997b3b838e6829f23b69f28c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 de07d2a8eaf8ac078860173b0cee58d5f2aa12796f674f24099da2680c01732f
MD5 c038425cc898fb3ce2a8419fae05141a
BLAKE2b-256 b086831213f39acf60d187d597a7cb134cc8dfd46b0f8116e9d05fe1b8d40320

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rustwx-0.5.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rustwx-0.5.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e029dc4514a758aea607f87617fc12a4be0291993027c449dc37fe769afd12de
MD5 cda3caa50b46086f1ad241392a14c9f1
BLAKE2b-256 f8c85b3f803f547b3a219dd0702848cc4fecf39544aa721c637b56981620f1ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp311-cp311-win_amd64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.5-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 bbe2429b822571c2a6dcd508f2183047726443b3b197b5cd6a95c9fc7c0cb183
MD5 b221b4647bfc9236d2087b26c6ac613b
BLAKE2b-256 c7ea5ab0ea59afcf27fde463444c28690d1f59cc5c51eb33dc449b9fc3750276

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp311-cp311-manylinux_2_39_x86_64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3056b270ff9a3022768a2cde0175ba352a052c4cd5eabff563e2438647ee9f2b
MD5 3dcca9c2399d68873ad3df1f7fa2631a
BLAKE2b-256 7b54f3ba32c31b1b4b19b7b5cefffea3a79a6d1fc0013ce2150e29bef4e6863e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rustwx-0.5.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rustwx-0.5.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 47a0794e7eca4136dd2446de70618eaaa9fd883ad2b5032dd39d988e1d98ce69
MD5 a6b753d56fcf6693e96234f94993d38b
BLAKE2b-256 d9ecfb63287af1acd0678f265f8741d18beb5f50320758c158046a86d4f5638b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp310-cp310-win_amd64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.5-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 79615a949bf37fa1433827297dca2e2230772f25107bb227d34a023f43d988c8
MD5 1e0d08ce0af3a68240e7b4878d74c848
BLAKE2b-256 9756b852d5f88c1fb8c79763e7bc5d06ad1e65ca3623d14f34e2bf8eb815e279

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp310-cp310-manylinux_2_39_x86_64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustwx-0.5.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8227827fb33a6f5651dcc031930cbe60f15b08d0ed3fa6d559c8c22ee95d35c5
MD5 3b19c2f9382f65893ab36d67321c00d8
BLAKE2b-256 9425a91788acc85b435d1df4f9217c025b8823215ca512d734ff79c73bd935fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.5-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: workflow.yml on FahrenheitResearch/rustwx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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