HWRF  trunk@4391
exhwrf_bufrprep.py
1 #! /usr/bin/env python
2 
3 ##@namespace scripts.exhwrf_bufrprep
4 # Runs the hwrf.bufrprep.Bufrprep task to convert data tanks to bufr
5 # files for input to the hwrf.gsi tasks.
6 
8 from produtil.log import jlogger
9 import hwrf_wcoss,hwrf.gsi
10 from hwrf.gsi import unset_gsistatus, set_gsistatus
11 
12 def fail(msg):
13  """!Logs an error message to the produtil.log.jlogger and exits with status 2.
14  @param msg the string error message to log."""
15  jlogger.error(msg)
16  sys.exit(2)
17 
18 def main():
19  """!Runs the bufrprep task in hwrf_expt, a hwrf.bufrprep.Bufrprep.
20  Creates the GSI status file, setting run_gsi_d0* variables to YES
21  if the GSI is enabled for each domain."""
22  import hwrf_expt
24  conf=hwrf_expt.conf
25  logger=conf.log('exhwrf_bufrprep')
26  unset_gsistatus(conf,logger)
27 
28  if hwrf_expt.conf.getbool('config','run_gsi'):
29  hwrf_expt.bufrprep.run()
30  else:
31  jlogger.info('GSI is disabled. This job need not be run.')
32 
33  set_gsistatus(conf,logger)
34 
35 if __name__=='__main__':
36  try:
38  main()
39  except Exception as e:
40  jlogger.critical('HWRF bufrprep is aborting: '+str(e),exc_info=True)
41  sys.exit(2)
def fail(msg)
Logs an error message to the produtil.log.jlogger and exits with status 2.
Contains setup(), which initializes the produtil package.
Definition: setup.py:1
def main()
Runs the bufrprep task in hwrf_expt, a hwrf.bufrprep.Bufrprep.
def init_module
Initializes the HWRF object structure.
Definition: hwrf_expt.py:384
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.
Definition: setup.py:15
Runs the GSI data assimilation on the HWRF system.
Definition: gsi.py:1
Provides information about the cluster on which this job is running.
Definition: cluster.py:1
Configures logging.
Definition: log.py:1