Skip to content

pre_proc: real-data and static-field preparation pipelines for init_atmosphere#13

Open
daniloceano wants to merge 8 commits into
developfrom
preproc/static-data-download
Open

pre_proc: real-data and static-field preparation pipelines for init_atmosphere#13
daniloceano wants to merge 8 commits into
developfrom
preproc/static-data-download

Conversation

@daniloceano

Copy link
Copy Markdown

Summary

Adds the MPAS init_atmosphere pre-processing utilities under usp-utils/pre_proc/, covering the two data-preparation stages required for a real-data run.

None of this exists on develop today — this PR is purely additive.

What this adds

real_data/ — real-data initialization inputs

Includes utilities for preparing real-data initialization inputs:

Downloaders

  • download_era5.py
  • download_gfs.py
  • download_oisst.py

Intermediate-file generators

WPS intermediate format generators:

  • era5_to_intermediate.py
  • gfs_to_intermediate.py
  • gfs_sst_to_intermediate.py
  • oisst_to_intermediate.py
  • oisst_clim_to_intermediate.py

End-to-end wrappers

  • prepare_era5.sh
  • prepare_gfs.sh
  • prepare_oisst.sh

Documentation and recipes

  • README.md

  • Per-scenario recipes under recipes/, covering:

    • Operational vs. hindcast workflows
    • Global vs. regional configurations

static_fields/ — static-field generation

Adds support for static-field generation with config_init_case = 7.

download_static_data.sh

Fetches the required mesh and MPAS-curated geography bundle, then:

  • Performs SHA256 integrity checks
  • Extracts the data into WPS_GEOG/

STATIC_FIELDS_GUIDE.md

Provides a full walkthrough covering:

  • Mesh and geography data download
  • Partitioning
  • namelist and streams setup
  • Noah-MP notes
  • UGWP notes

daniloceano and others added 5 commits June 11, 2026 21:49
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- setup_environment.sh: stop inferring env existence from 'conda activate's exit
  code (which gives a misleading "Couldn't find the environment" when the env
  exists but a transient activate returns non-zero). Now: ensure the 'conda'
  shell function is loaded (source conda.sh if only the binary is on PATH),
  check the env in 'conda env list', then activate. Clearer not-found message.
- install_conda_environment.sh: add '#!/usr/bin/env bash' shebang. It uses
  bash-only features (BASH_SOURCE, '[ == ]'); running it with sh/dash failed
  with "Bad substitution" / "unexpected operator" and left SCRIPT_DIR empty.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the pre-processing utilities for MPAS init_atmosphere under usp-utils/pre_proc/.

real_data/ — download + intermediate-file generation for real-data init:
- download_{era5,gfs,oisst}.py and {era5,gfs,gfs_sst,oisst,oisst_clim}_to_intermediate.py
- prepare_{era5,gfs,oisst}.sh end-to-end wrappers
- README plus per-scenario recipes (operational/hindcast x global/regional)

static_fields/ — static-field generation (init_atmosphere config_init_case = 7):
- download_static_data.sh (mesh + MPAS geog bundle, integrity-checked)
- STATIC_FIELDS_GUIDE.md walkthrough

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@daniloceano daniloceano requested a review from favba June 20, 2026 17:39
daniloceano and others added 3 commits June 21, 2026 15:14
… downscaling docs

Name and docs:
- era5_to_intermediate.py defaults --prefix to 'ERA5' (was 'GFS'); the ERA5
  intermediate is now ERA5:YYYY-MM-DD_HH, set config_met_prefix='ERA5'. GFS keeps
  'GFS:'. prepare_era5.sh and the docs follow suit; GFS-source mentions unchanged.

Regional downscaling docs:
- hindcast_regional.md: explain --area as a download box (not the simulated
  region, which is the mesh) sized to mesh + margin; add a window-based recipe
  (START/END) covering a single month, a year, or multiple years, with the
  6-hourly LBC loop + closing boundary and daily OISST SST.
- README.md: clarify the --area bullet and link the recipe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
era5_to_intermediate.py silently emitted only 12 of 14 fields because two
single-level lookups did not match the CDS GRIB:
- mean sea level pressure (msl) is at typeOfLevel 'surface' here, not 'meanSea';
- sea-ice cover has GRIB shortName 'ci', which cfgrib loads as variable 'siconc',
  so the 'siconc'-keyed lookup found nothing.

Make the lookups robust: _open_var accepts shortName aliases and returns the
single filtered variable regardless of how cfgrib names it; sea ice tries
'ci'/'siconc'; msl tries 'surface' then 'meanSea'. The converter now writes all
14 fields (adds PMSL and SEAICE). README field-mapping notes the ci/siconc alias.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
prepare_era5_series.sh builds the ERA5 (ERA5:) intermediate series over a date
window — the LBC series of a month / year / multiple years — by wrapping
prepare_era5.sh in a window loop built for unattended runs:

- Resumable: skips every time whose ERA5:<date>_<hh> intermediate already exists,
  so re-running only fetches the gaps.
- Fault-tolerant: a failed CDS request logs FAIL and the series continues.
- nohup-friendly: timestamped log lines; redirect and detach.
- Optional parallelism (--jobs N via xargs -P), with the CDS throttle documented
  (keep N small).
- Timestamps are parsed as UTC and iterated by epoch seconds, so the dates do not
  shift with the server's local timezone.

hindcast_regional.md now recommends it (nohup example) for windows longer than a
few days, keeping the equivalent manual loop for reference; README lists it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant