dartobsgen.NNJASource#

class dartobsgen.NNJASource(catalog_mirror='gcp_nodd', obs_type_map=None)[source]#

Bases: DataSource

Data source backed by the NNJA-AI (NOAA/NASA Joint Archive) cloud catalog.

Uses the nnja-ai SDK to load ADPSFC (surface) and ADPUPA (upper-air) observations from GCS, then writes DART obs_seq files via pydartdiags.ObsSequence.

Parameters:
  • catalog_mirror (str) – NNJA catalog GCS mirror. "gcp_nodd" (default) uses the NOAA Open Data Dissemination mirror; "gcp_brightband" uses the Brightband mirror.

  • obs_type_map (dict or None) – Additional obs-type entries merged on top of DEFAULT_OBS_TYPE_MAP. Use this to override error variances, swap dataset IDs, or add custom obs types. Pass None to use defaults only.

Notes

The catalog is opened lazily on first call to write_obs_seq() so that NNJASource instances can be safely pickled for ProcessPoolExecutor workers.

Wind components are derived from NNJA speed + direction columns:

U = −speed × sin(direction_rad)
V = −speed × cos(direction_rad)

Radiosonde pressure levels: ADPUPA flat columns are named {var}_PRLC{n} where pressure_Pa = int(n) × 10 (e.g. TMDB_PRLC5000 → 500 hPa = 50 000 Pa).

__init__(catalog_mirror='gcp_nodd', obs_type_map=None)[source]#
Parameters:
  • catalog_mirror (str)

  • obs_type_map (dict | None)

Methods

__init__([catalog_mirror, obs_type_map])

check_coverage(windows)

Pre-flight check of windows against the data this source can serve.

write_obs_seq(output_file, analysis_time, ...)

Load NNJA obs for the given window, write a DART obs_seq file.

write_obs_seq(output_file, analysis_time, date0, date1, lat_min, lat_max, lon_min, lon_max, obs_types, obs_type_map)[source]#

Load NNJA obs for the given window, write a DART obs_seq file.

Parameters:
  • output_file (str) – Path to write the DART obs_seq file.

  • analysis_time (datetime) – Cycle time this window is centered on. Unused — observation times come from the archive’s OBS_TIMESTAMP.

  • date0 (datetime) – Time window (date0, date1] — open below, closed above.

  • date1 (datetime) – Time window (date0, date1] — open below, closed above.

  • lat_min (float) – Bounding box for spatial subsetting (degrees).

  • lat_max (float) – Bounding box for spatial subsetting (degrees).

  • lon_min (float) – Bounding box for spatial subsetting (degrees).

  • lon_max (float) – Bounding box for spatial subsetting (degrees).

  • obs_types (list[str]) – DART obs type names to generate (e.g. ["METAR_TEMPERATURE_2_METER"]).

  • obs_type_map (dict or None) – Per-call overrides merged on top of the source-level map.

Returns:

True if the file was written, False if no observations were found for this window.

Return type:

bool