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.8.tar.gz (2.2 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.8-cp313-cp313-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.13Windows x86-64

rustwx-0.5.8-cp313-cp313-manylinux_2_39_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

rustwx-0.5.8-cp313-cp313-macosx_11_0_arm64.whl (6.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustwx-0.5.8-cp312-cp312-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.12Windows x86-64

rustwx-0.5.8-cp312-cp312-manylinux_2_39_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

rustwx-0.5.8-cp312-cp312-macosx_11_0_arm64.whl (6.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustwx-0.5.8-cp311-cp311-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.11Windows x86-64

rustwx-0.5.8-cp311-cp311-manylinux_2_39_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

rustwx-0.5.8-cp311-cp311-macosx_11_0_arm64.whl (6.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rustwx-0.5.8-cp310-cp310-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.10Windows x86-64

rustwx-0.5.8-cp310-cp310-manylinux_2_39_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

rustwx-0.5.8-cp310-cp310-macosx_11_0_arm64.whl (6.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: rustwx-0.5.8.tar.gz
  • Upload date:
  • Size: 2.2 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.8.tar.gz
Algorithm Hash digest
SHA256 793049c67068c21bfc0c18f1cdb7d9dced8bfddd7b067ff73d24d6a1a526569b
MD5 e6a23832430ef99ad5f654499de6a2f1
BLAKE2b-256 2b794e2aa4a5119ebe5598a3c1232623b66d5b0afef75f2f29c65c3346a700e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8.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.8-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rustwx-0.5.8-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 6.7 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.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e93e0f2d1eaf55808a3f44da6c4c09e68d2fe7602c3531854a9cddfb0a265b50
MD5 a2931e5d4227408f15b9c8c727bf63a8
BLAKE2b-256 99ff6d6477ff3cd76b4245bf5a1c14be6b21c3d3a7027047eccb5cbdb9f1d0bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.8-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 bf72c577d4c1701c7b5f9bda6285edee3d62f762b93b822456e99327d759c57e
MD5 2243a1c2235c586995b041d62fd68e0f
BLAKE2b-256 8285e137755db4055f2846f199699dfc199ee447ba5dcd089a815fbb2afe7f59

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd5882defcf0d00e42612ce74dba5940f8f8ebfebe09db159ea28033cf5e5607
MD5 f2c76cfcf294c5ff8b5cef7c2f74dd46
BLAKE2b-256 f2cbec84ae85e2b7b77038d00e1613421d6d541428825ff51f95d03121acbc11

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rustwx-0.5.8-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 6.7 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.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7a09aa63fe05b12a39dd98f3e5955c6785d9b0023ab5629323ea0605a5f5a426
MD5 cc6bffbb84ffd6a1121667fec46d393d
BLAKE2b-256 e154d215c74ae620fd1138c547f396b80dd70398bba2a9fd3d11bc4ed5e6431d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.8-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2ef1d5847404ff6e03534021655f5ce1d56d8234cdebc4b3a365273bf49bbad6
MD5 72be9595cda7235d27890682c72ffb93
BLAKE2b-256 170f6f863d3c6ea2376556c33b58be91912f1445c51177e6f5be7319e9bc0d3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 10a620860fd28f699aef95db2103757dba74e4265a1d69e77be4103c32daa561
MD5 fa59dcde928c3da1d2e9c023f3474f54
BLAKE2b-256 5a0e4c3af7ffa2a62308fe18207dcd54148f30d16a55aa2e6cb27e1fb9106e46

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rustwx-0.5.8-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 6.7 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.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8641008bbf002109fc9769dbc3669e916be6ff31ba6105246245bd0daab50cac
MD5 e19141148ff6ccbc07a48f290cbdfef9
BLAKE2b-256 78d7c8966014722723fafd89797281fd3eed1d0aeb42ebec931614f3b20f5a94

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.8-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 73c3d1f0467002acfd7182c523d0dae71f75889e36ca914421bc00b845b682b0
MD5 2b68ac461bd21517a0cd8986d49e21f4
BLAKE2b-256 ad5eda570139f22ed59d2940994789416986d96c50ca71619c507e15b220095c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82163f3159b72c20b62eec382004b2403c6b11918e2ff3d78c6ccb62b20960d7
MD5 b0e5c3cbb58e4cc70ea2f2e6f5da8c02
BLAKE2b-256 f7f42a50ff14f116dce243a550cd87d207549112c762a80a8d9939575e85909a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rustwx-0.5.8-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 6.7 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.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 550f4f10be72d0028c3b50f922927e82c13ad6dadd79314238250057719a2e12
MD5 f15bfa2fd13681d1ae7dbade5048a09e
BLAKE2b-256 b906eeeb4dc6155e302c5ccbc51874aaf529b5e53eb92bb20ba8b3deb86275d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.8-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 b0f87c93caf01d65e93243dfdfda49cfcdca28b6848cd5d0507fe9e3be2ad2fe
MD5 937af4655f77d94b720002a140974d2e
BLAKE2b-256 f6fd0466f473e99d110bc4d8064f640675aa5119f4c5cb6c67eef0321d07cb65

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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.8-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustwx-0.5.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3ab09d470a8b8c7f8fd21a6e409d7d8916963b44adfc7ea9ae4263f51c5d911
MD5 863af3e6eea8940b4c2f55e3e0a8b1ca
BLAKE2b-256 e7e68e6272171a16ca017e853fc8da632e30e04776502677138e6147580ac1e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustwx-0.5.8-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