Skip to content

Commit

Permalink
some tweaking
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewEichmann-NOAA committed Oct 17, 2024
1 parent 546e4e6 commit bf9bcf3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions parm/ioda/bufr2ioda/bufr2ioda_insitu_profile_argo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dump_directory: '{{ DMPDIR }}'
ioda_directory: '{{ COM_OBS }}'
source: NCEP data tank
subsets: SUBPFL
ocean_basin: '{{ OCEAN_BASIN_FILE }}'
13 changes: 6 additions & 7 deletions ush/soca/prep_ocean_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,22 @@ def initialize(self):
# set up the config file for conversion to IODA for bufr and
# netcdf files respectively
if obsprep_space['type'] == 'bufr':
gen_bufr_yaml_config = {'RUN': RUN,
bufrconv_config = {'RUN': RUN,
'current_cycle': cdate,
'DMPDIR': COMIN_OBS,
'COM_OBS': COMIN_OBS,
'OCEAN_BASIN_FILE': OCEAN_BASIN_FILE}
yaml_config_file = os.path.join(COMIN_OBS,
bufrconv_yaml_file = os.path.join(COMIN_OBS,
f"{obtype}_{cdatestr}.yaml")
obsprep_space['conversion config file'] = yaml_config_file
obsprep_space['conversion config file'] = bufrconv_yaml_file
bufr2iodapy = BUFR2IODA_PY_DIR + '/bufr2ioda_' + obtype + '.py'
obsprep_space['bufr2ioda converter'] = bufr2iodapy
tmpl_filename = 'bufr2ioda_' + obtype + '.yaml'
template = os.path.join(JSON_TMPL_DIR, tmpl_filename)
bufrconv_template = os.path.join(JSON_TMPL_DIR, tmpl_filename)

try:
# gen_bufr_json(gen_bufr_json_config, template, yaml_config_file)
myyaml = parse_j2yaml(template, gen_bufr_yaml_config, yaml_config_file)
myyaml.save(yaml_config_file)
bufrconv = parse_j2yaml(bufrconv_template, bufrconv_config)
bufrconv.save(bufrconv_yaml_file)
except Exception as e:
logger.warning(f"An exeception {e} occured while trying to run gen_bufr_json")
logger.warning(f"obtype {obtype} will be skipped")
Expand Down
5 changes: 2 additions & 3 deletions ush/soca/prep_ocean_obs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ def run_netcdf_to_ioda(obsspace_to_convert, OCNOBS2IODAEXEC):

def run_bufr_to_ioda(obsspace_to_convert):
logger.info(f"running run_bufr_to_ioda on {obsspace_to_convert['name']}")
json_output_file = obsspace_to_convert['conversion config file']
bufrconv_yaml = obsspace_to_convert['conversion config file']
bufr2iodapy = obsspace_to_convert['bufr2ioda converter']
try:
# subprocess.run(['python', bufr2iodapy, '-c', json_output_file, '-v'], check=True)
subprocess.run(['python', bufr2iodapy, '-c', json_output_file], check=True)
subprocess.run(['python', bufr2iodapy, '-c', bufrconv_yaml], check=True)
logger.info(f"ran ioda converter on obs space {obsspace_to_convert['name']} successfully")
return 0
except subprocess.CalledProcessError as e:
Expand Down

0 comments on commit bf9bcf3

Please sign in to comment.