dartobsgen.ObsSeqSource#

class dartobsgen.ObsSeqSource(obs_seq_dir)[source]#

Bases: DataSource

Stub: future data source backed by a bank of existing obs_seq files.

Implement write_obs_seq to serve observations from pre-existing DART obs_seq files instead of a live database. The interface is identical to any other DataSource, so callers require no changes.

Parameters:

obs_seq_dir (str) – Directory containing the existing obs_seq files to draw from.

__init__(obs_seq_dir)[source]#
Parameters:

obs_seq_dir (str)

Methods

__init__(obs_seq_dir)

check_coverage(windows)

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

write_obs_seq(output_file, analysis_time, ...)

Write observations for one assimilation window to 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]#

Write observations for one assimilation window to a DART obs_seq file.

Parameters:
  • output_file (str) – Full path for the output obs_seq file.

  • analysis_time (datetime) – The assimilation time T that this window is centered on — the model’s stopping time, and the time the output file is named for. Sources that place observations themselves (rather than reading timestamps from a database) should use this as the reference time.

  • date0 (datetime) – Lower bound of the window (T - freq/2), exclusive.

  • date1 (datetime) – Upper bound of the window (T + freq/2), inclusive. The window is (date0, date1], per DART’s convention.

  • lat_min (float) – Latitude bounds (degrees).

  • lat_max (float) – Latitude bounds (degrees).

  • lon_min (float) – Longitude bounds (degrees, -180 to 180).

  • lon_max (float) – Longitude bounds (degrees, -180 to 180).

  • obs_types (list[str]) – Requested observation types.

  • obs_type_map (dict or None) – Custom obs type mapping (merged with source defaults); None means use source defaults only.

Returns:

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

Return type:

bool