HWRF  trunk@4391
exhwrf_gsi_post.py
1 #! /usr/bin/env python
2 
3 ##@namespace scripts.exhwrf_gsi_post
4 #Runs the HWRF post-processing on the inputs and outputs to the
5 #GSI. This includes:
6 # 1. ORG --- the original parent model data, interpolated to the HWRF grid,
7 # 2. GES --- the first guess: the input to GSI
8 # 3. ANL --- the final output of the data assimilation
9 #
10 #Intermediate output files are post-processed and interpolated to
11 #latitude-longitude grids. The implementation of this is in the
12 #hwrf.gsipost and hwrf.hwrfsystem modules.
13 
14 import os, sys
16 import hwrf_expt
17 from produtil.log import jlogger
18 
19 def main():
20  """!Runs the HWRF post-processing described in the exhwrf_gsi_post
21  module description."""
23  logger=hwrf_expt.conf.log('exhwrf_gsi_post')
24 
25  if not hwrf_expt.conf.getbool('config','run_gsi'):
26  jlogger.info('GSI is disabled. This job need not be run.')
27  sys.exit(0)
28 
29  produtil.fileop.chdir(hwrf_expt.conf.getdir('WORKhwrf'),logger=logger)
30 
31  logger.info('Unrun GSI post and gribber')
32  hwrf_expt.gsipost.unrun()
33  hwrf_expt.gsigribber.unrun()
34 
35  logger.info('Run GSI post')
36  hwrf_expt.gsipost.run()
37 
38  logger.info('Run GSI gribber, and deliver to com.')
39  hwrf_expt.gsigribber.run(now=True)
40 
41 if __name__=='__main__':
42  try:
44  jlogger.info("HWRF GSI post job starting")
45  main()
46  jlogger.info("HWRF GSI post job completed")
47  except Exception as e:
48  jlogger.critical('HWRF GSI post is aborting: '+str(e),
49  exc_info=True)
50  sys.exit(2)
Change directory, handle temporary directories.
Definition: cd.py:1
Contains setup(), which initializes the produtil package.
Definition: setup.py:1
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
Configures logging.
Definition: log.py:1
def main()
Runs the HWRF post-processing described in the exhwrf_gsi_post module description.
def chdir
Changes to the specified directory.
Definition: fileop.py:145