diff --git a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem2_config.yml b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem2_config.yml index 4410bd60..0465be73 100644 --- a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem2_config.yml +++ b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem2_config.yml @@ -18,7 +18,7 @@ LookBack : -9999 RefcstBDateProc: "202412020000" ForecastFrequency: 60 ForecastShift: 0 -ForecastInputHorizons: [12246] +ForecastInputHorizons: [12600] ForecastInputOffsets: [0] Geopackage: "{root_dir}/gpkg/conus/{gage}.gpkg" GeogridIn: "{root_dir}/esmf_mesh/{gage}_ESMF_Mesh.nc" diff --git a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem3_config.yml b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem3_config.yml index d93e2982..d62983b2 100644 --- a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem3_config.yml +++ b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem3_config.yml @@ -18,7 +18,7 @@ LookBack : -9999 RefcstBDateProc: "202412020000" ForecastFrequency: 60 ForecastShift: 0 -ForecastInputHorizons: [12252] +ForecastInputHorizons: [12960] ForecastInputOffsets: [0] Geopackage: "{root_dir}/gpkg/conus/{gage}.gpkg" GeogridIn: "{root_dir}/esmf_mesh/{gage}_ESMF_Mesh.nc" diff --git a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem4_config.yml b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem4_config.yml index 733a5a93..a3681e6b 100644 --- a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem4_config.yml +++ b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem4_config.yml @@ -18,7 +18,7 @@ LookBack : -9999 RefcstBDateProc: "202412020000" ForecastFrequency: 60 ForecastShift: 0 -ForecastInputHorizons: [12258] +ForecastInputHorizons: [13320] ForecastInputOffsets: [0] Geopackage: "{root_dir}/gpkg/conus/{gage}.gpkg" GeogridIn: "{root_dir}/esmf_mesh/{gage}_ESMF_Mesh.nc" diff --git a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem5_config.yml b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem5_config.yml index 1e79c788..2d590ee3 100644 --- a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem5_config.yml +++ b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem5_config.yml @@ -18,7 +18,7 @@ LookBack : -9999 RefcstBDateProc: "202412020000" ForecastFrequency: 60 ForecastShift: 0 -ForecastInputHorizons: [12264] +ForecastInputHorizons: [13680] ForecastInputOffsets: [0] Geopackage: "{root_dir}/gpkg/conus/{gage}.gpkg" GeogridIn: "{root_dir}/esmf_mesh/{gage}_ESMF_Mesh.nc" diff --git a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem6_config.yml b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem6_config.yml index 0a63c730..bbaa72ed 100644 --- a/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem6_config.yml +++ b/NextGen_Forcings_Engine_BMI/BMI_NextGen_Configs/config_templates/medium_range_mem6_config.yml @@ -18,7 +18,7 @@ LookBack : -9999 RefcstBDateProc: "202412020000" ForecastFrequency: 60 ForecastShift: 0 -ForecastInputHorizons: [12270] +ForecastInputHorizons: [14040] ForecastInputOffsets: [0] Geopackage: "{root_dir}/gpkg/conus/{gage}.gpkg" GeogridIn: "{root_dir}/esmf_mesh/{gage}_ESMF_Mesh.nc" diff --git a/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/err_handler.py b/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/err_handler.py index fcbfc9db..d2af210c 100755 --- a/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/err_handler.py +++ b/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/err_handler.py @@ -1,3 +1,4 @@ +import inspect import logging import os import sys @@ -12,6 +13,12 @@ LOG = ewts.get_logger(ewts.FORCING_ID) +def in_exception_context() -> bool: + if sys.exc_info()[0] is not None: + return True + return False + + def err_out_screen(err_msg: str, exc: BaseException | None = None): """Print an error message to the screen and exit the program gracefully. @@ -27,8 +34,20 @@ def err_out_screen(err_msg: str, exc: BaseException | None = None): if exc is not None: err_msg += f" - {exc}" err_msg_out = "ERROR: " + err_msg + print(err_msg_out, flush=True) - traceback.print_exc() # Only prints if an exception is currently being handled + LOG.critical(err_msg_out) + + if in_exception_context(): + tb = traceback.format_exc() + tb_msg = f"TRACEBACK: {tb}" + print(tb_msg, flush=True, file=sys.stderr) + LOG.critical(tb_msg) + + final_msg = f"Calling sys.exit(1) from object {repr(inspect.currentframe().f_code.co_name)}" + print(final_msg, flush=True, file=sys.stderr) + LOG.critical(final_msg) + sys.exit(1)