31 """!Log a message to produtil.log.jlogger and exit with status 0
32 @param msg the error message"""
37 """!Run the selected parts of the initialization."""
39 init_model=ENV[
'INIT_MODEL'].lower()
40 init_fhr=int(ENV.get(
'INIT_FHR',
'0'))
41 init_parts=ENV[
'INIT_PARTS'].lower()
42 if init_model!=
'gfs' and init_model!=
'gdas1':
43 fail(
'Aborting: init_model="%s" must be "gfs" or "gdas1"'%(init_model,))
44 if init_model==
'gdas1' and init_fhr<1:
45 fail(
'Aborting: when init_model=gdas1, init_fhr must be > 1 (init_fhr=%d)'%(init_fhr,))
46 if init_model==
'gfs': init_fhr=0
50 os.chdir(hwrf_expt.conf.getdir(
'WORKhwrf'))
52 init=hwrf_expt.gfs_init
53 elif not hwrf_expt.conf.getbool(
'config',
'run_gsi'):
54 jlogger.info(
'GSI is disabled. This job need not be run.')
58 logger=hwrf_expt.fgat_init.log()
59 logger.info(
'search for fgat hour %d'%(init_fhr,))
60 for fhr,init
in hwrf_expt.fgat_init.fhr_and_init():
61 if abs(fhr-init_fhr)<0.01:
62 logger.info(
'fhr %d is init_fhr %d'%(fhr,init_fhr))
66 logger.info(
'fhr %d is not init_fhr %d'%(fhr,init_fhr))
67 assert(init
is not None)
69 if init_parts ==
'parent':
70 init.run_through_anl()
71 elif init_parts ==
'3dvar':
72 init.run_through_anl()
73 init.run_init_after_anl()
74 elif init_parts ==
'bdy':
76 elif init_parts ==
'all':
77 init.run_through_anl()
78 init.run_init_after_anl()
81 fail(
'Aborting: invalid value of INIT_PARTS: "%s" (must be "parent," "3dvar" or "bdy")'%(init_parts,))
83 if __name__==
'__main__':
87 except Exception
as e:
88 jlogger.critical(
'HWRF init is aborting: '+str(e),exc_info=
True)
Contains setup(), which initializes the produtil package.
def init_module
Initializes the HWRF object structure.
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 fail(msg)
Log a message to produtil.log.jlogger and exit with status 0.
def main()
Run the selected parts of the initialization.