Skip to content

Add NetCDF4 ObsFcstAna postprocessing support - #185

Draft
amfox37 wants to merge 3 commits into
developfrom
feature/amfox/obsfcstana-nc4-postproc
Draft

Add NetCDF4 ObsFcstAna postprocessing support#185
amfox37 wants to merge 3 commits into
developfrom
feature/amfox/obsfcstana-nc4-postproc

Conversation

@amfox37

@amfox37 amfox37 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This PR adds support for reading NetCDF4 ObsFcstAna diagnostics in the monthly postprocessing pipeline.

Summary:

  • Adds read_ObsFcstAna_nc4() to read NetCDF4 ObsFcstAna files into the same structure used by the legacy binary reader.
  • Updates postproc_ObsFcstAna.py to prefer .nc4 ObsFcstAna files and fall back to .bin files.
  • Skips months cleanly when no ObsFcstAna inputs are found.
  • Updates read_obs_param() parsing for the current obsparam format by reading forecast variable names and units.
  • Updates CHANGELOG.md.

Testing:

  • Ran python3 -m py_compile on postproc_ObsFcstAna.py and read_GEOSldas.py.
  • Successfully ran the ObsFcstAna monthly postprocessing workflow on Discover using real model output.

amfox37 and others added 2 commits July 20, 2026 18:17
Current experiments write ObsFcstAna as .nc4 (schema ObsFcstAna_nc4_v1)
instead of the legacy .bin format. postproc_ObsFcstAna.py previously only
looked for .bin and silently skipped missing timesteps, so nc4-only
experiments produced empty stats with no warning.

- Add read_ObsFcstAna_nc4() to read_GEOSldas.py, matching the .bin reader's
  output contract (validated against 56 matched .bin/.nc4 timestamp pairs).
- compute_monthly_sums() now tries .nc4 first, falls back to .bin.
- Warn and skip (rather than silently produce empty stats) when a month
  has zero matched files, without aborting the rest of the batch run.
obsparam text files now include fcstvarname/fcstunits fields after
varname/units, which read_obs_param() didn't account for. This shifted
every subsequent field (path, name, errstd, etc.) by two lines, causing
ValueError when parsing production experiments' obsparam.txt.

Confirmed against DAv7_M36_ASCAT_type_13_H121 (Apr 2015): with this fix,
Get_ObsFcstAna_sums.py runs end-to-end via the new nc4 reader and
produces sane, non-empty monthly O-F sums for all 10 species.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@amfox37 amfox37 added enhancement New feature or request 0-diff trivial very, very obvious 0-diff change post-processing labels Jul 21, 2026
@gmao-rreichle

Copy link
Copy Markdown
Collaborator

Thanks, Andy, for creating the PR. It looks good to me. @gmao-qliu: when you get a chance, please also review and let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-diff trivial very, very obvious 0-diff change enhancement New feature or request post-processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants