16 """!Checks to see if the ocean initialization succeeded for the chosen ocean model.
17 @param logger a logging.Logger for log messages
18 @returns True if the ocean init ran, False otherwise"""
20 run_ocean=conf.getbool(
'config',
'run_ocean',
True)
21 ocean_model=conf.getstr(
'config',
'ocean_model',
'')
24 logger.info(
'Ocean is disabled via run_ocean option. Skipping ocean checks.')
27 if not hwrf_expt.ocstatus.get(logger):
28 logger.warning(
'The ocean status file says ocean is disabled.')
31 if ocean_model==
'HYCOM':
32 if not hwrf_expt.hycominit.is_completed():
33 logger.warning(
'The hycominit completion flag is off. '
36 elif ocean_model==
'POM':
37 if not hwrf_expt.pominit.is_completed():
38 logger.warning(
'The pominit completion flag is off. '
42 logger.error(
'Invalid value %s for ocean_model.'%(repr(ocean_model),))
47 def check_wave_init(logger):
49 run_wave=conf.getbool(
'config',
'run_wave',
True)
50 wave_model=conf.getstr(
'config',
'wave_model',
'')
53 logger.info(
'Wave is disabled via run_wave option. Skipping wave checks.')
56 if not hwrf_expt.wvstatus.get(logger):
57 logger.warning(
'The wave status file says wave is disabled.')
61 if not hwrf_expt.ww3init.is_completed():
62 logger.warning(
'The ww3init completion flag is off. '
66 logger.error(
'Invalid value %s for wave_model.'%(repr(wave_model),))
72 """!Checks to see if the GSI data assimilation system ran
73 correctly for all domains for which it should have run.
74 @param logger a logging.Logger for log messages
75 @returns True if the GSI ran for all expected domains, False otherwise"""
80 'GSI gsi_d02 Task state is not COMPLETED. Domain 2 GSI failed.')
85 'GSI gsi_d03 Task state is not COMPLETED. Domain 3 GSI failed.')
90 """!Checks to see if the vortex relocation system ran correctly.
91 @param conf an hwrf.config.HWRFConfig for configuration info
92 @param who a string name for this relocation job, for messages
93 @param init an hwrf.init.HWRFInit or subclass, the grids
94 input to the relocation
95 @param relocate an hwrf.relocate.RelocationTask to check
96 @param logger a logging.Logger for messages
97 @param when the expected forecast time of this relocation"
98 @returns True if the relocation job succeeded, or False otherwise"""
103 logger.warning(
'%s: FAIL: relocation job state is not COMPLETE (state %s)'
106 for domain
in i.wrfghost:
109 p=r.wrfinput_at_time(when,domain)
111 p=r.get_ghost(domain)
115 logger.warning(
'%s: FAIL: relocation output product %s '
116 'not available'%(who,p.did))
118 if p.location
is None or p.location==
'':
119 logger.warning(
'%s: FAIL: relocation output product %s has '
120 'no location'%(who,p.did))
124 '%s: FAIL: relocation output %s is empty or does not exist at '
125 '%s'%(who,p.did,p.location))
131 logger.info(
'%s: relocation info: %s'%(who,rinfo))
132 logger.info(
'%s: from file: %s'%(who,rinfo.from_file))
133 if rinfo.warm_cold_flag
is None:
135 '%s: FAIL: warm/cold state is unknown (None).'%(who,))
137 elif rinfo.warm_cold_flag
is not hwrf.relocate.WARM:
139 logger.info(
'%s: cold start, but cold_ok=True'%(who,))
140 elif conf.getbool(
'config',
'expect_cold_start',
False):
141 logger.warning(
'%s: cold start: no prior cycle found'%(who,))
143 logger.error(
'%s: FAIL: unexpected cold start'%(who,))
146 logger.info(
'%s: warm start'%(who,))
147 except Exception
as e:
148 logger.error(
'%s: error determining cold vs. warm start: %s'
149 %(who,str(e)),exc_info=
True)
154 """!Checks all steps of the FGAT relocation.
155 @param conf the hwrf.config.HWRFConfig for configuration info
156 @param logger a logging.Logger for log messages
157 @returns True if the relocation jobs ALL succeeded, or False otherwise"""
159 reloc=hwrf_expt.fgat_init.get_relocates()
160 for t,r
in reloc.iteritems():
161 i=hwrf_expt.fgat_init.init_at_time(t)
162 who=
"FGAT time "+t.strftime(
'%Y%m%d%H')
165 logger.error(who+
': failed.')
169 """!Calls check_relocate() to check the GFS relocation
170 @param conf an hwrf.config.HWRFConfig for configuration info
171 @param logger a logging.Logger for log messages
172 @returns True if the GFS relocation ran correctly and False otherwise"""
174 hwrf_expt.gfs_init.rstage3,logger,
175 hwrf_expt.conf.cycle):
176 logger.error(
'GFS relocate failed.')
181 """!Checks the entire HWRF initialization to see if all needed
182 inputs to the forecast are present and all init tasks ran
187 logger=conf.log(
"check_init")
189 ocean_flag=conf.getbool(
'config',
'run_ocean')
190 wave_flag=conf.getbool(
'config',
'run_wave')
191 gsi_flag=conf.getbool(
'config',
'run_gsi')
192 reloc_flag=conf.getbool(
'config',
'run_relocation')
198 logger.info(
'Ocean init succeeded.')
199 elif conf.syndat.basin1
in hwrf_expt.non_ocean_basins:
200 logger.info(
'Ocean init aborted, but basin is not supported.')
201 hwrf_expt.runwrf.remove_ocean()
203 logger.error(
'Ocean init failed.')
205 hwrf_expt.runwrf.remove_ocean()
207 logger.info(
'Ocean is disabled. Skipping ocean checks.')
210 if check_wave_init(logger):
211 logger.info(
'Wave init succeeded.')
212 elif conf.syndat.basin1
in hwrf_expt.non_wave_basins:
213 logger.info(
'Wave init aborted, but basin is not supported.')
214 hwrf_expt.runwrf.remove_wave()
216 logger.error(
'Wave init failed.')
218 hwrf_expt.runwrf.remove_wave()
220 logger.info(
'Wave is disabled. Skipping wave checks.')
224 logger.error(
'GSI failed.')
227 logger.error(
'FGAT relocate failed.')
230 logger.info(
'GSI is disabled. Skipping GSI and FGAT '
231 'relocation checks.')
233 logger.error(
'GFS relocate failed.')
235 logger.info(
'Relocation and GSI are disabled. '
236 'Skipping relocation checks.')
238 logger.info(
'Asking the forecast object to check if all input files '
240 print type(hwrf_expt.runwrf).__name__
241 have_input=hwrf_expt.runwrf.check_all_inputs()
244 logger.error(
'FAILURE: WRF or POM inputs are missing')
246 logger.critical(
'FORECAST INPUTS ARE MISSING!!')
249 logger.critical(
'INIT JOBS DID NOT SUCCEED!!')
252 if __name__==
'__main__':
255 except Exception
as e:
256 jlogger.critical(
'HWRF check init is aborting: '+str(e),exc_info=
True)
Runs the POM initialization and POM-WRF coupled forecast.
Contains setup(), which initializes the produtil package.
def check_gsi(logger)
Checks to see if the GSI data assimilation system ran correctly for all domains for which it should h...
def init_module
Initializes the HWRF object structure.
def check_fgat_relocate(conf, logger)
Checks all steps of the FGAT relocation.
def get_gsistatus
Checks the gsi status for a specific domain.
def setup(ignore_hup=False, dbnalert_logger=None, jobname=None, cluster=None, send_dbn=None, thread_logger=False, thread_stack=2 **24, kwargs)
Initializes the produtil package.
def isnonempty(filename)
Returns True if the filename refers to an existent file that is non-empty, and False otherwise...
def check_gfs_relocate(conf, logger)
Calls check_relocate() to check the GFS relocation.
def check_relocate(conf, who, init, relocate, logger, when)
Checks to see if the vortex relocation system ran correctly.
def check_ocean_init(logger)
Checks to see if the ocean initialization succeeded for the chosen ocean model.
def main()
Checks the entire HWRF initialization to see if all needed inputs to the forecast are present and all...