Skip to content

Add ZERO_OBS option mainly in GSI related code - #465

Open
metdyn wants to merge 1 commit into
developfrom
feature/ygyu/zero_obs
Open

metdyn wants to merge 1 commit into
developfrom
feature/ygyu/zero_obs

Conversation

@metdyn

@metdyn metdyn commented Dec 2, 2026

Copy link
Copy Markdown

This solves issue

This is a AI-assisted PR that gives zero-diff for develop branch if you run ADAS the same way as before.
I provide the idea and AI did the implementation and revised my PR messages. It was one small step along the way.
I turned this on during the early debug stage, mainly to understand the structure of ADAS.

Add ZERO_OBS: cycle GEOS ADAS without assimilating observations

Note

This PR was prepared with AI assistance.

Important

Zero-diff to develop by default. ZERO_OBS is off (unset or 0) unless you turn it on.
If you run ADAS the same way as before, nothing changes.

Summary

This PR adds an opt-in switch, ZERO_OBS, for ADAS in GSI mode. When it is on, the full
cycle (central GSI analysis and EnKF ensemble) runs with no observations. The scripts, jobs
and file flow are the same as a normal cycle, but no observation data is read or assimilated.

How to use

Set the variable before running fvsetup:

setenv ZERO_OBS 1        # csh / tcsh
# export ZERO_OBS=1      # bash
fvsetup

fvsetup prints a note and writes the switch to $FVHOME/run/FVDAS_Run_Config, so every job
of the experiment
sees it:

# Zero-observation DA: GSI with empty obs table; ensemble observer/EnKF skipped
if ( !($?ZERO_OBS) ) setenv ZERO_OBS 1

What ZERO_OBS=1 does

Stage Behavior with ZERO_OBS=1
Observation acquisition BUFR/obs files are not fetched
Pre-analysis QC / QC Skipped
GSI analysis Runs with an empty observation table, so it finds zero obs to assimilate
Diag → ODS conversion Skipped
Ensemble observers Skipped; member backgrounds are linked into the work directory
EnKF update Bypassed; each member analysis is a copy of its background (ana = bkg)

Zero-diff to develop

Every new line is one of four kinds, and none of them changes behavior when the switch is off:

  1. a comment or revision-history line;
  2. a default, if ( !($?ZERO_OBS) ) setenv ZERO_OBS 0, set before first use, so csh never sees an undefined variable;
  3. a new block guarded by if ( $ZERO_OBS ), which is skipped;
  4. a change to an existing condition (&& ! $ZERO_OBS or || $ZERO_OBS), which reduces to the original develop condition when the flag is 0.

To check this, the changed lines were run through csh / perl with ZERO_OBS unset and ZERO_OBS=0,
plus a ZERO_OBS=1 control:

Script / case ZERO_OBS Result Same as develop?
GEOSdas.csm unset / 0 None of the 4 early exits runs; obs table not commented out ✅ Yes
GEOSdas.csm (control) 1 All 4 early exits run; obs table commented out ➖ control works
atm_ens.j, JEDI_CAN_RUN_NOW=0 unset / 0 Aircraft check runs; obsvr_ensemble.csh runs; ATMENS_ENSQRF unchanged ✅ Yes
atm_ens.j, JEDI_CAN_RUN_NOW=1 unset / 0 Aircraft check skipped; member backgrounds only linked; ATMENS_ENSQRF unchanged ✅ Yes
atmos_enkf.csh unset / 0 Skips the ZERO_OBS block and continues to the normal EnKF code ✅ Yes
fvsetup, write_FVDAS_Run_Config.pl unset / 0 No note printed; nothing written to FVDAS_Run_Config ✅ Yes

Tip

The only visible difference with the switch off: ZERO_OBS=0 now exists in the job environment,
so it can show up in env printouts in the logs. Nothing else reads it.

Implementation details

Central analysis — GEOSdas.csm

  • SetupObserver_, UpdateGsiGridCompResource_: comment out the entries of the
    observation_files:: table in GSI_GridComp.rc (the closing :: is kept), so GSI runs with an
    empty observation list.
  • AcquireObservations_, PreAnalysisQC_, QualityControlRun_, Diag2ODSRun_: exit early
    (nothing to fetch, QC, or convert to ODS).

Ensemble analysis — NCEP_enkf/scripts/gmao

  • atm_ens.j: skip the ensemble observers; link each member background into the work
    directory instead; set ATMENS_ENSQRF=0.
  • atm_ens.j: skip the variational aircraft bias check (with ACFTBIAS=2 and no PREPQC, it
    requires ncep_acftpfl_bufr in OBSCLASS), since no observations are used:
    if ( ! $JEDI_CAN_RUN_NOW && ! $ZERO_OBS ) then
  • atmos_enkf.csh: bypass the EnKF update; each member analysis is a copy of its background,
    filed with update_ens.csh.

Setup

  • write_FVDAS_Run_Config.pl: write ZERO_OBS to FVDAS_Run_Config when set.
  • fvsetup: print a note when ZERO_OBS is found in the environment.

Files changed

File Lines
src/Applications/GEOSdas_App/GEOSdas.csm +16
src/Applications/GEOSdas_App/fvsetup +4
src/Applications/GEOSdas_App/write_FVDAS_Run_Config.pl +7 / −1
src/Applications/NCEP_Etc/NCEP_enkf/scripts/gmao/atm_ens.j +10 / −2
src/Applications/NCEP_Etc/NCEP_enkf/scripts/gmao/atmos_enkf.csh +31
Total: 5 files +68 / −3

Testing

  • Changed csh lines tested with ZERO_OBS unset, 0, and 1 (control)
  • perl logic in fvsetup / write_FVDAS_Run_Config.pl tested; no warnings under -w
  • Short cycle with develop vs. this branch (ZERO_OBS unset), outputs compared with cmp / nccmp

  cycle the GSI without assimilating observations

Export ZERO_OBS=1 before running fvsetup; it is written to FVDAS_Run_Config
so every job of the experiment sees it. Default is 0 (no change in behavior).

Central analysis (GEOSdas.csm):
- SetupObserver_, UpdateGsiGridCompResource_: comment out the entries of the
  observation_files table in GSI_GridComp.rc (closing "::" kept), so GSI
  runs with an empty observation list
- AcquireObservations_, PreAnalysisQC_, QualityControlRun_, Diag2ODSRun_:
  exit early (nothing to fetch, QC, or convert to ODS)

Ensemble analysis (NCEP_enkf/scripts/gmao):
- atm_ens.j: skip the ensemble observers; link each member background into
  the work directory instead; ATMENS_ENSQRF=0
- atm_ens.j: skip the variational aircraft bias check (ACFTBIAS=2 without
  PREPQC needs ncep_acftpfl_bufr in OBSCLASS); no obs are used
- atmos_enkf.csh: bypass the EnKF update; each member analysis is a copy of
  its background, filed with update_ens.csh

Setup:
- write_FVDAS_Run_Config.pl: write ZERO_OBS to FVDAS_Run_Config when set
- fvsetup: print a note when ZERO_OBS is found in the environment

File changed:
- src/Applications/GEOSdas_App/GEOSdas.csm (+16)
- src/Applications/GEOSdas_App/fvsetup (+4)
- src/Applications/GEOSdas_App/write_FVDAS_Run_Config.pl (+7/−1)
- src/Applications/NCEP_Etc/NCEP_enkf/scripts/gmao/atm_ens.j (+10/−2):
  this now includes skipping the aircraft bias check, if ( ! $JEDI_CAN_RUN_NOW && ! $ZERO_OBS ) then
- src/Applications/NCEP_Etc/NCEP_enkf/scripts/gmao/atmos_enkf.csh (+31)
@metdyn
metdyn requested review from mathomp4 and rtodling December 2, 2026 23:03
@metdyn
metdyn requested a review from a team as a code owner December 2, 2026 23:03
@metdyn metdyn added the 0 diff The changes in this pull request have verified to be zero-diff with the target branch. label Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 diff The changes in this pull request have verified to be zero-diff with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant