Skip to content

Commit

Permalink
Fix the empty aerosol DA aerostat tar file issue (NOAA-EMC#3332)
Browse files Browse the repository at this point in the history
Somewhere along the way, an inconsistency between the aerosol DA
diagnostic file output name suffixes and the workflow crept in, where
the files were generated, but not found via glob and put in a tarball
because of `.nc` vs `.nc4`. This PR resolves this issue plus also
renames the file to be more descriptive, e.g.:
`gdas.t00z.aerostat.tgz`
to clarify it is a tar ball with gzip. The PR also makes it a tarball
with gzip instead of an uncompressed tar.

  Resolves NOAA-EMC#3327
  • Loading branch information
CoryMartin-NOAA authored Feb 14, 2025
1 parent 192aa68 commit 0da3832
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion parm/archive/gdas.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ gdas:
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}radstat"
{% endif %}
{% if DO_AERO_ANL %}
- "{{ COMIN_CHEM_ANALYSIS | relpath(ROTDIR) }}/{{ head }}aerostat"
- "{{ COMIN_CHEM_ANALYSIS | relpath(ROTDIR) }}/{{ head }}aerostat.tgz"
{% endif %}
{% if DO_PREP_OBS_AERO %}
- "{{ COMIN_OBS | relpath(ROTDIR) }}/{{ head }}aeroobs"
Expand Down
4 changes: 2 additions & 2 deletions parm/archive/gfs_arcdir.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
{% endif %}

{% if DO_AERO_ANL %}
{% do det_anl_files.append([COMIN_CHEM_ANALYSIS ~ "/" ~ head ~ "aerostat",
ARCDIR ~ "/aerostat." ~ RUN ~ "." ~ cycle_YMDH ]) %}
{% do det_anl_files.append([COMIN_CHEM_ANALYSIS ~ "/" ~ head ~ "aerostat.tgz",
ARCDIR ~ "/aerostat." ~ RUN ~ "." ~ cycle_YMDH ~ ".tgz"]) %}
{% endif %}

{% if DO_PREP_OBS_AERO == True %}
Expand Down
2 changes: 1 addition & 1 deletion parm/archive/gfsa.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ gfsa:
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}gsistat"
{% endif %}
{% if DO_AERO_ANL %}
- "{{ COMIN_CHEM_ANALYSIS | relpath(ROTDIR) }}/{{ head }}aerostat"
- "{{ COMIN_CHEM_ANALYSIS | relpath(ROTDIR) }}/{{ head }}aerostat.tgz"
{% endif %}
{% if DO_PREP_OBS_AERO %}
- "{{ COMIN_OBS | relpath(ROTDIR) }}/{{ head }}aeroobs"
Expand Down
6 changes: 3 additions & 3 deletions ush/python/pygfs/task/aero_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ def finalize(self) -> None:
# ---- tar up diags
# path of output tar statfile
logger.info('Preparing observation space diagnostics for archiving')
aerostat = os.path.join(self.task_config.COMOUT_CHEM_ANALYSIS, f"{self.task_config['APREFIX']}aerostat")
aerostat = os.path.join(self.task_config.COMOUT_CHEM_ANALYSIS, f"{self.task_config['APREFIX']}aerostat.tgz")

# get list of diag files to put in tarball
diags = glob.glob(os.path.join(self.task_config['DATA'], 'diags', 'diag*nc4'))
diags = glob.glob(os.path.join(self.task_config['DATA'], 'diags', 'diag*nc'))

# gzip the files first
for diagfile in diags:
Expand All @@ -191,7 +191,7 @@ def finalize(self) -> None:
FileHandler(aero_var_final_list).sync()

# open tar file for writing
with tarfile.open(aerostat, "w") as archive:
with tarfile.open(aerostat, "w|gz") as archive:
for diagfile in diags:
diaggzip = f"{diagfile}.gz"
archive.add(diaggzip, arcname=os.path.basename(diaggzip))
Expand Down

0 comments on commit 0da3832

Please sign in to comment.