U Š÷Îgå ã@sLdZddlZddlZddlZddlmZddgZdd„Z dd„Z d d„Z dS) zî!Functions called automatically before a cycle is launched. This module contains utility functions for the hafs.launcher.launch() prelaunch argument. These functions edit the configuration of an individual cycle before the cycle starts.éN)ÚjloggerÚprelaunch_rsmcÚprelaunch_basincCsp| ddd¡}|jj}||krlt d||f¡| d||f¡| ddd¡| ddd¡| dd d¡d S) zA!Disables vortexinit and GSI if the wind is below some threshold.ÚconfigZmin_wind_for_initrz-Wind %d < %d so disabling GSI and relocation.zNWind %d<%d - run_gsi, run_vortexinit and run_ens_vortexinit overridden to "no"Úrun_gsiÚnoZrun_vortexinitZrun_ens_vortexinitN)ÚgetintÚsyndatÚwmaxrÚinfoÚset)ÚconfÚloggerÚ thresholdZwind©rú;/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/hafs/prelaunch.pyÚprelaunch_windsÿÿrcCsl| dd¡}|s| d¡dS|j}t|jƒ ¡}|jdd|d}tj  |¡s^|  d|f¡|  |¡dS)a«!Modifies the configuration for the RSMC (JTWC, NHC, etc.) Modifies the configuration to work differently for JTWC and NHC storms. Searches for the rsmc_conf option in the [prelaunch] section for the name of a configuration file to read, and reads it if it exists. @param conf the hafs.config.ProdConfig to modify @param logger the logging.Logger for log messages @param cycle the cycle being run.Ú prelaunchÚrsmc_overrideszRSMC overrides are disabled.Nz {rsmc_conf})ZRSMCz/%s: RSMC override file is empty or non-existent) Úgetboolr r ÚstrÚcenterÚupperÚ strinterpÚprodutilÚfileopÚ isnonemptyÚwarningÚread)r rÚcyclerÚvitZrsmcZrfilerrrrs   ÿcCsÂ| dd¡}|s| d¡dS|j}|dkr:| d¡dS|jdd|d}|jdd|d}tj |¡r‚| d |f¡| |¡ns