Skip to content

Commit

Permalink
addtional error handling for marine observation bufr2ioda converters (N…
Browse files Browse the repository at this point in the history
  • Loading branch information
RussTreadon-NOAA committed Feb 29, 2024
1 parent 96301b0 commit e9eb319
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 16 deletions.
8 changes: 6 additions & 2 deletions ush/ioda/bufr2ioda/bufr2ioda_altkob_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def bufr_to_ioda(config, logger):
converter = 'BUFR to IODA Converter'
platform_description = 'Surface obs from ALTKOB: temperature and salinity'

bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d"
bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm00.bufr_d"
DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile)
if not os.path.isfile(DATA_PATH):
logger.info(f"DATA_PATH {DATA_PATH} does not exist")
Expand Down Expand Up @@ -102,7 +102,11 @@ def bufr_to_ioda(config, logger):

logger.debug(f"Executing QuerySet to get ResultSet ...")
with bufr.File(DATA_PATH) as f:
r = f.execute(q)
try:
r = f.execute(q)
except Exception as err:
logger.info(f'Return with {err}')
return

# MetaData
logger.debug(f" ... Executing QuerySet: get MetaData ...")
Expand Down
8 changes: 6 additions & 2 deletions ush/ioda/bufr2ioda/bufr2ioda_bathythermal_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def bufr_to_ioda(config, logger):
converter = 'BUFR to IODA Converter'
platform_description = 'Profiles from BATHYthermal: temperature'

bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d"
bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm00.bufr_d"
DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile)
if not os.path.isfile(DATA_PATH):
logger.info(f"DATA_PATH {DATA_PATH} does not exist")
Expand Down Expand Up @@ -102,7 +102,11 @@ def bufr_to_ioda(config, logger):

logger.debug(f"Executing QuerySet to get ResultSet ...")
with bufr.File(DATA_PATH) as f:
r = f.execute(q)
try:
r = f.execute(q)
except Exception as err:
logger.info(f'Return with {err}')
return

# MetaData
logger.debug(f" ... Executing QuerySet: get MetaData ...")
Expand Down
8 changes: 6 additions & 2 deletions ush/ioda/bufr2ioda/bufr2ioda_subpfl_argo_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def bufr_to_ioda(config, logger):
converter = 'BUFR to IODA Converter'
platform_description = 'ARGO profiles from subpfl: temperature and salinity'

bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d"
bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm00.bufr_d"
DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile)
if not os.path.isfile(DATA_PATH):
logger.info(f"DATA_PATH {DATA_PATH} does not exist")
Expand Down Expand Up @@ -103,7 +103,11 @@ def bufr_to_ioda(config, logger):
start_time = time.time()
logger.debug(f"Executing QuerySet to get ResultSet ...")
with bufr.File(DATA_PATH) as f:
r = f.execute(q)
try:
r = f.execute(q)
except Exception as err:
logger.info(f'Return with {err}')
return

# MetaData
logger.debug(f" ... Executing QuerySet: get MetaData ...")
Expand Down
8 changes: 6 additions & 2 deletions ush/ioda/bufr2ioda/bufr2ioda_subpfl_glider_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def bufr_to_ioda(config, logger):
converter = 'BUFR to IODA Converter'
platform_description = 'GLIDER profiles from subpfl: temperature and salinity'

bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d"
bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm00.bufr_d"
DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile)
if not os.path.isfile(DATA_PATH):
logger.info(f"DATA_PATH {DATA_PATH} does not exist")
Expand Down Expand Up @@ -103,7 +103,11 @@ def bufr_to_ioda(config, logger):
start_time = time.time()
logger.debug(f"Executing QuerySet to get ResultSet ...")
with bufr.File(DATA_PATH) as f:
r = f.execute(q)
try:
r = f.execute(q)
except Exception as err:
logger.info(f'Return with {err}')
return

# MetaData
logger.debug(f" ... Executing QuerySet: get MetaData ...")
Expand Down
11 changes: 9 additions & 2 deletions ush/ioda/bufr2ioda/bufr2ioda_tesac_mammals_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def bufr_to_ioda(config, logger):
converter = 'BUFR to IODA Converter'
platform_description = 'Profiles from TESAC: temperature and salinity'

bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d"
bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm00.bufr_d"
DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile)
if not os.path.isfile(DATA_PATH):
logger.info(f"DATA_PATH {DATA_PATH} does not exist")
Expand Down Expand Up @@ -103,7 +103,11 @@ def bufr_to_ioda(config, logger):
start_time = time.time()
logger.debug(f"Executing QuerySet to get ResultSet ...")
with bufr.File(DATA_PATH) as f:
r = f.execute(q)
try:
r = f.execute(q)
except Exception as err:
logger.info(f'Return with {err}')
return

# MetaData
logger.debug(f" ... Executing QuerySet: get MetaData ...")
Expand Down Expand Up @@ -143,6 +147,9 @@ def bufr_to_ioda(config, logger):

alpha_mask = [item.isalpha() for item in stationID]
indices_true = [index for index, value in enumerate(alpha_mask) if value]
if len(indices_true) is 0:
logger.info(f"No marine mammals in {DATA_PATH}")
return

# Apply index
stationID = stationID[indices_true]
Expand Down
8 changes: 6 additions & 2 deletions ush/ioda/bufr2ioda/bufr2ioda_tesac_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def bufr_to_ioda(config, logger):
converter = 'BUFR to IODA Converter'
platform_description = 'Profiles from TESAC: temperature and salinity'

bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d"
bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm00.bufr_d"
DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile)
if not os.path.isfile(DATA_PATH):
logger.info(f"DATA_PATH {DATA_PATH} does not exist")
Expand Down Expand Up @@ -103,7 +103,11 @@ def bufr_to_ioda(config, logger):
start_time = time.time()
logger.debug(f"Executing QuerySet to get ResultSet ...")
with bufr.File(DATA_PATH) as f:
r = f.execute(q)
try:
r = f.execute(q)
except Exception as err:
logger.info(f'Return with {err}')
return

# MetaData
logger.debug(f" ... Executing QuerySet: get MetaData ...")
Expand Down
8 changes: 6 additions & 2 deletions ush/ioda/bufr2ioda/bufr2ioda_trackob_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def bufr_to_ioda(config, logger):
converter = 'BUFR to IODA Converter'
platform_description = 'Surface obs from TRACKOB: temperature and salinity'

bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d"
bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm00.bufr_d"
DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile)
if not os.path.isfile(DATA_PATH):
logger.info(f"DATA_PATH {DATA_PATH} does not exist")
Expand Down Expand Up @@ -103,7 +103,11 @@ def bufr_to_ioda(config, logger):
start_time = time.time()
logger.debug(f"Executing QuerySet to get ResultSet ...")
with bufr.File(DATA_PATH) as f:
r = f.execute(q)
try:
r = f.execute(q)
except Exception as err:
logger.info(f'Return with {err}')
return

# MetaData
logger.debug(f" ... Executing QuerySet: get MetaData ...")
Expand Down
8 changes: 6 additions & 2 deletions ush/ioda/bufr2ioda/bufr2ioda_xbtctd_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def bufr_to_ioda(config, logger):
converter = 'BUFR to IODA Converter'
platform_description = 'Profiles from XBT/CTD: temperature and salinity'

bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d"
bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm00.bufr_d"
DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile)
if not os.path.isfile(DATA_PATH):
logger.info(f"DATA_PATH {DATA_PATH} does not exist")
Expand Down Expand Up @@ -103,7 +103,11 @@ def bufr_to_ioda(config, logger):
start_time = time.time()
logger.debug(f"Executing QuerySet to get ResultSet ...")
with bufr.File(DATA_PATH) as f:
r = f.execute(q)
try:
r = f.execute(q)
except Exception as err:
logger.info(f'Return with {err}')
return

# MetaData
logger.debug(f" ... Executing QuerySet: get MetaData ...")
Expand Down

0 comments on commit e9eb319

Please sign in to comment.