Skip to content

Commit

Permalink
working version I think
Browse files Browse the repository at this point in the history
  • Loading branch information
CoryMartin-NOAA committed Nov 15, 2023
1 parent d7e9ec8 commit 3b171d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parm/ioda/bufr2ioda/bufr2ioda_atms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ observations:

ioda:
backend: netcdf
obsdataout: "{{ COM_OBS }}/{{ RUN }}.t{{ cyc }}z.atms.{{splits/satId}}.tm00.nc"
obsdataout: "{{ COM_OBS }}/{{ RUN }}.t{{ cyc }}z.atms.$(splitvar).tm00.nc"

dimensions:
- name: Channel
Expand Down
7 changes: 7 additions & 0 deletions ush/ioda/bufr2ioda/gen_bufr2ioda_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@
import argparse
import os
from wxflow import Logger, parse_j2yaml, cast_strdict_as_dtypedict, save_as_yaml
from wxflow import Template, TemplateConstants

# initialize root logger
logger = Logger('gen_bufr2ioda_yaml.py', level='INFO', colored_log=True)


def gen_bufr_yaml(config, template, output):
# read in templated YAML and do substitution
logger.info(f"Using {template} as input")
bufr_config = parse_j2yaml(template, config)
# need to do some special manipulation for the splits
substitutions = {'splitvar': '{{splits/satId}}'}
bufr_config = Template.substitute_structure(bufr_config, TemplateConstants.DOLLAR_PARENTHESES, substitutions.get)
save_as_yaml(bufr_config, output)
logger.info(f"Wrote to {output}")

Expand Down
6 changes: 4 additions & 2 deletions ush/ioda/bufr2ioda/run_bufr2ioda.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def bufr2ioda(current_cycle, RUN, DMPDIR, config_template_dir, COM_OBS):
'RUN': RUN,
'current_cycle': current_cycle,
'DMPDIR': DMPDIR,
'COM_OBS': COM_OBS
'COM_OBS': COM_OBS,
'PDY': current_cycle.strftime('%Y%m%d'),
'cyc': current_cycle.strftime('%H'),
}

# Specify observation types to be processed by a script
Expand Down Expand Up @@ -59,7 +61,7 @@ def bufr2ioda(current_cycle, RUN, DMPDIR, config_template_dir, COM_OBS):

# Specify observation types to be processed by the bufr2ioda executable
BUFR_yaml_files = glob.glob(os.path.join(config_template_dir, '*.yaml'))
BUFR_py_files = [os.path.basename(f) for f in BUFR_yaml_files]
BUFR_yaml_files = [os.path.basename(f) for f in BUFR_yaml_files]
BUFR_yaml = [f.replace('bufr2ioda_', '').replace('.yaml', '') for f in BUFR_yaml_files]

for obtype in BUFR_yaml:
Expand Down

0 comments on commit 3b171d7

Please sign in to comment.