Skip to content

Commit

Permalink
Save commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CoryMartin-NOAA committed Nov 15, 2023
1 parent d368a2a commit 898fb55
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
observations:
- obs space:
name: bufr
obsdatain: "$(BUFR_in)"
obsdatain: "{{ DMPDIR }}/{{ RUN }}.{{ PDY }}/{{ cyc }}/atmos/{{ RUN }}.t{{ cyc }}z.atms.tm00.bufr_d"

exports:
variables:
Expand Down Expand Up @@ -83,7 +83,7 @@ observations:

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

dimensions:
- name: Channel
Expand Down
28 changes: 26 additions & 2 deletions ush/ioda/bufr2ioda/run_bufr2ioda.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def bufr2ioda(current_cycle, RUN, DMPDIR, config_template_dir, COM_OBS):
# Get gdasapp root directory
DIR_ROOT = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../.."))
USH_IODA = os.path.join(DIR_ROOT, "ush", "ioda", "bufr2ioda")
BIN_GDAS = os.path.join(DIR_ROOT, "build", "bin")

# Create output directory if it doesn't exist
os.makedirs(COM_OBS, exist_ok=True)
Expand Down Expand Up @@ -51,8 +52,31 @@ def bufr2ioda(current_cycle, RUN, DMPDIR, config_template_dir, COM_OBS):
cmd()

# Check if the converter was successful
if os.path.exists(json_output_file):
rm_p(json_output_file)
#if os.path.exists(json_output_file):
# rm_p(json_output_file)

# 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 = [f.replace('bufr2ioda_', '').replace('.yaml', '') for f in BUFR_yaml_files]

for obtype in BUFR_yaml:
logger.info(f"Convert {obtype}...")
yaml_output_file = os.path.join(COM_OBS, f"{obtype}_{datetime_to_YMDH(current_cycle)}.yaml")
filename = 'bufr2ioda_' + obtype + '.yaml'
template = os.path.join(config_template_dir, filename)
gen_bufr_yaml(config, template, yaml_output_file)

# use the bufr2ioda executable for the ob type
bufr2iodaexe = BIN_GDAS + '/bufr2ioda.x'
cmd = Executable(bufr2iodaexe)
cmd.add_default_arg(yaml_output_file)
logger.info(f"Executing {cmd}")
cmd()

# Check if the converter was successful
#if os.path.exists(yaml_output_file):
# rm_p(yaml_output_file)


if __name__ == "__main__":
Expand Down

0 comments on commit 898fb55

Please sign in to comment.