U $ùÎgr£ã@sNgZddlZddlZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl Z ddl Z ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddl Z ddl!Z ddl"Z ddl#Z ddl$Z ddl%Z ddlm&Z&m'Z'ddl(m)Z)ddl m*Z*m+Z+m,Z,ddl m-Z-ddlm.Z.m/Z/m0Z0m1Z1m2Z2dd„Z3d d „Z4d d „Z5da6da7da8da9da:da;dada?da@daAdaBdaCdaDdaEdaFdaGdaHdaIdaJdaKdaLdaMdaNdaOdaPdaQdaRdaSdaTdaUdaVdaWdaXdaYdaZda[da\da]da^da_da`d d„Zaddd„ZbdS)éN)ÚexeÚalias)Ú isnonempty)Ú WRFDomainÚ WRFSimulationÚExternalWRFTask)Ú PostManyWRF)Ú RegribManyÚigrb1ÚclatlonÚGRIB2ÚSATGRIB2cCsNtj ||¡tj |||¡|dkr*dStj |||¡tj |||¡dS)aI!This function makes per-cycle modifications to the configuration file storm1.conf. This is called in scripts.exhwrf_launch and run_hwrf.py by hwrf.launcher.launch() on the configuration object (hwrf.launcher.HWRFLauncher, a subclass of hwrf.config.HWRFConfig), before the per-cycle storm1.conf configuration file is written. Any changes made to the conf object will be stored in storm1.conf file and used in later jobs. This allows modifications to the configuration on a per-cycle basis. Note that cycle=None and conf.cycle is unavailable when run_hwrf.py calls prelaunch. @param conf the hwrf.launcher.HWRFLauncher to modify @param logger a logging.Logger for log messages @param cycle the cycle to run, or None if this is being run from run_hwrf.py or the ush.psychoanalystN)ÚhwrfÚ prelaunchZprelaunch_ensidZprelaunch_basinZprelaunch_ungribZprelaunch_rsmc)ÚconfÚloggerÚcycle©rú7/lfs/h1/ops/prod/packages/hwrf.v13.2.9/ush/hwrf_expt.pyr7s rcCsî| dttƒf¡| dttƒf¡| dttƒf¡| dttƒf¡t dd¡}t dd¡}t dd¡}t dd ¡}t dd ¡}t dd ¡}t  dd d ¡}t  ddd ¡}t dd¡} t ddd¡} t  ddd¡} |d krú|d krúd} d} d}nØ|dkr|d krd} d} d}n¶|dkr>|d kr>d} d} d}n”|dkr`|dkr`d} d} d}nr|dkr‚|dkr‚d} d} d}nP|dkr¤|d kr¤d} d} d}n.|dkrÆ|d krÆd} d} d}n t j   d¡‚|r<|dkr | dtt ƒf¡| dttƒf¡n0|dkr,| dttƒf¡nt j   d |¡‚| d krTt j  d!¡‚n*| dkr~d"| d#kr~t j  d$| f¡‚|rÈ|d%kr¸| d&ttƒf¡| d'ttƒf¡nt j   d(|¡‚|rê|sê| d)¡t j   d)¡‚d*S)+aµ!Runs a sanity check on this module's contents. This should be called after init_module. This sanity check routine is called automatically by hwrf.launcher.HWRFLauncher.sanity_check_expt() as part of the standard sanity checks in the scripts.exhwrf_launch job. It checks to see if all expected module-scope variables are present and initialized correctly. @param logger a logging.Logger for log messageszThe runwrf object = %szThe gribber object = %szThe datastore (ds) object = %szThe wrf object = %sÚconfigÚrun_gsiÚ run_oceanÚ ocean_modelÚrun_waveÚ wave_modelÚrun_relocationÚ gfsinit_typeéÚ gfsbdy_typeÚallow_fallbacksÚextra_trackersFÚforecast_productsÚwrf_output_stepé0*éTéééú+The specifed configuration is not supportedÚHYCOMzThe hycominit object = %szThe hycompost object = %sÚPOMzThe pominit object = %sz2[config] ocean_model=%s but should be POM or HYCOMz-The wrf_output_step must be at least 1 secondrézXOne hour (3600 seconds) must be divisable by the WRF output timestep. You specified %d.ÚWW3zThe ww3init object = %szThe ww3post object = %sz([config] wave_model=%s but should be WW3z"Cannot use GSI without relocation.N)ÚinfoÚreprÚrunwrfÚgribberÚdsÚwrfrÚgetboolÚgetstrÚgetintrÚ exceptionsÚHWRFConfigUnsupportedÚ hycominitÚ hycompostÚpominitÚPrecisionTooHighÚTimestepModularityErrorÚww3initÚww3postÚerror)rÚgsi_flagÚ ocean_flagÚoceanÚ wave_flagÚwaveÚ reloc_flagrrÚfallbacks_flagr r"Ú spectral_flagÚ spectral_bdyÚ highres_gribrrrÚ sanity_checkSs¢        ÿ  ÿÿ ÿÿÿ ÿÿ  ÿrJccsèt dd¡}t ddd¡}t ddd¡}t ddd¡}t dd¡}t dd d ¡}t dd ¡}t dd d ¡}t ddd¡}t dd¡} t dd¡} |dkr®|dkr®d} d} d} nÐ|dkrÌ|dkrÌd} d} d} n²|dkrê|dkrêd} d} d} n”|dkr |dkr d} d} d} nr|dkr.|dkr.d} d} d} nP|dkrP|dkrPd} d} d} n.|dkrr|dkrrd} d} d} n tj d¡‚|r”|ršt| ƒršd}nd}|ræ|dkrÆt   ¡D] }|Vq¶n |d kræt   ¡D] }|VqØ|r |d kr t   ¡D] }|Vqþt   ¡D] }|Vq|rät  ¡D] }|Vq0|rZt  ¡D] }|VqLt  ¡D] }|Vqb|rät  ¡D]:}|ddkr°|d|dtj d¡kr°n|Vq~| rÎtj d¡sät  ¡D] }|VqÖdS) a6!Iterates over all inputs required by this configuration. Calls the inputiter() function on all tasks in the module scope that are expected to have input data. The result can be passed into the "data" argument of hwrf.input.InputSource.get. Iterates over dicts that contain the following: * dataset --- string name of the dataset (gfs, gdas1, gefs, enkf, etc.) * item --- string name of the object (ie.: gfs_sf, gfs_sfcanl, bufr) * atime --- self.conf.cycle * ftime --- only present when relevant: the forecast time, in a format accepted by to_datetime_rel * enkfmem --- only present when relevant: the ENKF member ID * obstype --- only present when relevant: the bufr data type. * optional --- True if the absence of this data is not considered a failure.rrÚrun_ensemble_daFrrrrrr*rrr,Úconditional_gsid03Údirú{com}/{stormlabel}.tdrÚrealtimer$Tr%r&r'r(r)ÚitemZenkf_sfgÚftimeÚatimer#z /dcom/prodN)rr3r5r4Ú strinterprr6r7rr8Ú inputiterr:r=Úgfs_initÚgsi_d02Úgsi_d03Ú fgat_initÚensdaÚnumericsÚ to_timedeltaÚosÚpathÚisdirÚ ensda_pre)r@rKrrrArBrCrDrLÚ tdrflagfilerOrGrHrIÚ gsid03_flagÚdrrrrT´s”     ÿ           ,  rTc CsŽtjdd…D]z}| |¡t d|¡}|s>| d|f¡q| d| d¡| d¡t| d¡ƒf¡| | d¡| d¡| d¡¡q|S) a×!Utility function to pass to init_module to override a few configuration options from the sys.argv This function should be passed into init_module's preload argument. It will scan sys.argv for arguments 1 onward, parsing them as configuration options (ie.: config.run_ocean=yes). Those options will be overridden in the conf object returned. @param conf the input and return HWRFConfig object @param logger a logging.Logger for logging rNzk(?x) (?P
[a-zA-Z][a-zA-Z0-9_]*) \.(?P