credit.datasets.mrms_download#

Standalone utility for downloading MRMS data from AWS S3 to local disk.

Downloaded files follow the same filename_time_format strftime convention used by MRMSDataset in local mode, so files are immediately usable without any renaming.

Usage:

python -m credit.datasets.mrms_download --config config/my_conf.yaml

Or programmatically:

from credit.datasets.mrms_download import download_mrms
download_mrms(config, output_format="netcdf")

Config section used (data.source.MRMS):

data:
  source:
    MRMS:
      mode: "local"             # output mode after download
      region: "CONUS"
      variables:
        prognostic:
          vars_2D:
            - "MultiSensor_QPE_01H_Pass2_00.00"
            - "MultiSensor_QPE_06H_Pass2_00.00"
          path: "/data/mrms_*.nc"          # determines base_path + format
          filename_time_format: "%Y%m%d-%H%M%S"
      extent: [-130, -60, 20, 55]          # optional

  start_datetime: "2024-06-01"
  end_datetime:   "2024-07-01"
  timestep:       "6h"
  forecast_len:   0

Output files are written to the directory of path, with names derived from the filename_time_format. For example, with filename_time_format: "%Y%m%d-%H%M%S" and path: "/data/mrms_*.nc" the file /data/mrms_20240601-060000.nc is created for the 06:00 UTC step.

Attributes#

Functions#

download_mrms(→ None)

Download MRMS data from AWS S3 to local disk.

Module Contents#

credit.datasets.mrms_download.logger#
credit.datasets.mrms_download._GRIB_TABLE_URL = 'https://raw.githubusercontent.com/NOAA-National-Severe-Storms-Laboratory/mrms-support/refs/heads...#
credit.datasets.mrms_download.download_mrms(config: dict, output_format: str = 'netcdf', grib_table_url: str = _GRIB_TABLE_URL) None#

Download MRMS data from AWS S3 to local disk.

Iterates over all timestamps defined by the top-level data config and writes one output file per timestamp. Files are named using filename_time_format so they are immediately loadable by MRMSDataset in mode: "local".

Parameters:
  • config – Top-level data config dict (same object passed to MRMSDataset).

  • output_format"netcdf" (default) or "zarr".

  • grib_table_url – URL to the MRMS GRIB2 parameter table CSV used for attaching variable metadata to output files.

Raises:
  • ValueError – If output_format is not "netcdf" or "zarr".

  • KeyError – If the config is missing required fields.

credit.datasets.mrms_download.parser#