o qgq@s<ddlZddlZddlZddlmZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ ddZddZddZddZddZdd Zd!d"ZdEd#d$ZdEd%d&ZdEd'd(ZdEd)d*ZdEd+d,ZdEd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Z d;d<Z!d=d>Z"d?d@Z#dAdBZ$dCdDZ%dS)FN)PathcC:t|tstd|ddd|stdd|S)NzThe provided VERIF_CASE ('') is not a string.z1 VERIF_CASE must be a string. Check the plotting configuration file.z6The provided VERIF_CASE is empty. VERIF_CASE cannot be. empty. Check the plotting configuration file. isinstancestrsysexit) VERIF_CASEr C/lfs/h1/ops/prod/packages/evs.v1.0.19/ush/nfcens/check_variables.pycheck_VERIF_CASE  rcCr)NzThe provided VERIF_TYPE ('rz1 VERIF_TYPE must be a string. Check the plottingrz6The provided VERIF_TYPE is empty. VERIF_TYPE cannot berr) VERIF_TYPEr r rcheck_VERIF_TYPErrcCsbt|tstd|dddtd|r'td|ddd d |s/td d |S) NzThe provided URL_HEADER ('rz1 URL_HEADER must be a string. Check the plottingr[^A-Za-z0-9_\-\\]z!The provided URL_HEADER string (' ') containsz/ invalid characters. URL_HEADER must be made of4 alphanumeric characters, hyphen, and/or underscore.' Check the plotting configuration file.z6The provided URL_HEADER is empty. Plot file names willz not include a header.rr r r researchprint) URL_HEADERr r rcheck_URL_HEADER,s&  rcCtt|tstd|dddt|s"td|ddt|s0td|d|s8td d |S) NzThe provided USH_DIR ('rz. USH_DIR must be a string. Check the plottingrz WARNING: The provided USH_DIR ('') does not exist on the current system.') is not a directory.z6The provided USH_DIR is empty. Will look for USH files" in the current working directory.rr r r rexistsris_dir)USH_DIRr r r check_USH_DIRA"    r&cCr) NzThe provided PRUNE_DIR ('rz0 PRUNE_DIR must be a string. Check the plottingrz"WARNING: The provided PRUNE_DIR ('rrr z=The provided PRUNE_DIR is empty. Will store pruned stat filesr!r") PRUNE_DIRr r rcheck_PRUNE_DIRUr'r)cCr) NzThe provided SAVE_DIR ('rz/ SAVE_DIR must be a string. Check the plottingrz!WARNING: The provided SAVE_DIR ('rrr z0The provided SAVE_DIR is empty. Will store plotsr!r")SAVE_DIRr r rcheck_SAVE_DIRir'r+cCspt|tstd|dddt|s"td|ddt|s0td|d|s6td |S) NzThe provided FIX_DIR ('rz. FIX_DIR must be a string. Check the plottingrz WARNING: The provided FIX_DIR ('rrr zThe provided FIX_DIR is empty.r")FIX_DIRr r r check_FIX_DIR}s    r-cCr) NzThe provided OUTPUT_BASE_DIR ('rz6 OUTPUT_BASE_DIR must be a string. Check the plottingrz(WARNING: The provided OUTPUT_BASE_DIR ('rrr z?The provided OUTPUT_BASE_DIR is empty. Will look for stat filesr!r")OUTPUT_BASE_DIRr r rcheck_OUTPUT_BASE_DIRr'r/cCs8t|tstd|ddd|stdd|S)NzThe provided LOG_METPLUS ('rz2 LOG_METPLUS must be a string. Check the plottingrz>WARNING: The provided LOG_METPLUS is empty. The logger will bez" the root logger of the hierarchy.rr r r r) LOG_METPLUSr r rcheck_LOG_METPLUSs r2cCst|tstd|dddt|dvr(td|ddd d t|d vrL  rbcCrS)NzThe provided VALID_END ('rz/ VALID_END must be a string. Check the plottingrrMrTrPz3The provided VALID_END is empty. Since DATE_TYPE isrUrVrWz', VALID_END cannot berrz+ non-numeric characters. VALID_END may onlyrXrYrZz' or too long. VALID_END must be a dater[r\) VALID_ENDrNrQrar r rcheck_VALID_ENDbrcrecCrS)NzThe provided INIT_BEG ('rz. INIT_BEG must be a string. Check the plottingrrLrTrPz2The provided INIT_BEG is empty. Since DATE_TYPE isrUrVrWz', INIT_BEG cannot berrz* non-numeric characters. INIT_BEG may onlyrXrYrZz& or too long. INIT_BEG must be a dater[r\)INIT_BEGrNrQrar r rcheck_INIT_BEGrcrgcCrS)NzThe provided INIT_END ('rz. INIT_END must be a string. Check the plottingrrLrTrPz2The provided INIT_END is empty. Since DATE_TYPE isrUrVrWz', INIT_END cannot berrz* non-numeric characters. INIT_END may onlyrXrYrZz& or too long. INIT_END must be a dater[r\)INIT_ENDrNrQrar r rcheck_INIT_ENDrcricCt|tstd|dddt|dks"t|dkrT|s?tddt|d dt|d d td |sTtd|d ddd|S)NzThe provided FCST_INIT_HOUR ('rz4 FCST_INIT_HOUR must be a string. Check the plottingrrLrTz8The provided FCST_INIT_HOUR is empty. Since DATE_TYPE isrU' and plot type isz', FCST_INIT_HOUR cannot ber (^[ 0-9,]+)$') isz/ not valid. FCST_INIT_HOUR may contain numbers,rErr r r r:r]rr)FCST_INIT_HOURrNrar r rcheck_FCST_INIT_HOUR4  rpcCrj)NzThe provided FCST_VALID_HOUR ('rz5 FCST_VALID_HOUR must be a string. Check the plottingrrMrTz9The provided FCST_VALID_HOUR is empty. Since DATE_TYPE isrUrkz', FCST_VALID_HOUR cannot berrlrmz0 not valid. FCST_VALID_HOUR may contain numbers,rErn)FCST_VALID_HOURrNrar r rcheck_FCST_VALID_HOURrqrscCr)NzThe provided FCST_LEVEL ('rz0 FCST_LEVEL must be a string. Check the plottingrz6The provided FCST_LEVEL is empty. FCST_LEVEL cannot berr) FCST_LEVELr r rcheck_FCST_LEVELrrucCr)NzThe provided OBS_LEVEL ('rz/ OBS_LEVEL must be a string. Check the plottingrz4The provided OBS_LEVEL is empty. OBS_LEVEL cannot berr) OBS_LEVELr r rcheck_OBS_LEVELrrwcCht|tstd|ddd|stddtd|r2td|d d d d d |S)NzThe provided var_name ('rz. var_name must be a string. Check the plottingrz2The provided var_name is empty. var_name cannot ber[^ A-Za-z0-9,_\-]zThe provided var_name string ('rz- invalid characters. var_name must be made of4 alphanumeric characters, hyphen, underscore, commas5 and/or spaces only. Check the plotting configurationr>r?)var_namer r rcheck_var_name*  r}cCrx)NzThe provided VX_MASK_LIST ('rz2 VX_MASK_LIST must be a string. Check the plottingrz:The provided VX_MASK_LIST is empty. VX_MASK_LIST cannot berryz#The provided VX_MASK_LIST string ('rz1 invalid characters. VX_MASK_LIST must be made ofrzr{r>r?) VX_MASK_LISTr r rcheck_VX_MASK_LIST5r~rcCdt|tstd|ddd|stddtd|r0td|d d d d |S) NzThe provided FCST_LEAD ('rz/ FCST_LEAD must be a string. Check the plottingrz4The provided FCST_LEAD is empty. FCST_LEAD cannot berz[^ 0-9,]z The provided FCST_LEAD string ('rz. invalid characters. FCST_LEAD must be made ofz/ numerics, commas and/or spaces only. Check the plotting configuration file.r?) FCST_LEADr r rcheck_FCST_LEADL&  rcCsdt|tstd|ddd|stddtd|r0td|d d d d|S) NzThe provided LINE_TYPE ('rz/ LINE_TYPE must be a string. Check the plottingrz4The provided LINE_TYPE is empty. LINE_TYPE cannot berz [^ A-Za-z0-9]z The provided LINE_TYPE string ('rz. invalid characters. LINE_TYPE must be made ofz1 alphanumeric characters only. Check the plottingr?) LINE_TYPEr r rcheck_LINE_TYPEbrrcCr) NzThe provided INTERP ('rz, INTERP must be a string. Check the plottingrz.The provided INTERP is empty. INTERP cannot berz[^A-Za-z0-9_\-]zThe provided INTERP string ('rz+ invalid characters. INTERP must be made ofz5 alphanumeric characters, hyphens, and/or underscoresz- only. Check the plotting configuration file.r?)INTERPr r r check_INTERPxrrcCst|tstd|dddt|dvrp|s+tdd|dd d td |rBtd |d ddddtd|rYtd |ddddd td|rptd |ddddd|S)NzThe provided FCST_THRESH ('r=z0 string. FCST_THRESH must be a string. Check therCTCMCTCPCTNBRCTCz,The provided FCST_THRESH is empty. Since the provided line type is 'z', FCST_THRESH$ cannot be empty. Check the plottingr[^A-Za-z0-9<>=.,! /-]z"The provided FCST_THRESH string ('rz0 invalid characters. FCST_THRESH must be made of/ alphanumeric characters, comparison operators,7 periods, hyphens, commas and/or spaces only. Check the^((?![<=!>]).)*$')- does not contain a valid comparison operatorz. (<,>,<=,>=,!=,==). FCST_THRESH must contain a/ valid comparison operator. Check the plotting^((?![0-9]).)*$z/ contains no numerics (digits 0-9). FCST_THRESH/ must contain an integer or decimal in order to, be valid. Check the plotting configurationr>)rr r r r:rr) FCST_THRESHrr r rcheck_FCST_THRESHs\     rcCs<t|tstd|dddt|dvr|s+tdd|dd d td |rBtd |d ddddtd|rYtd |ddddd td|rptd |ddddd|dd|ddkstt d|tt d|krt d|ddd |d!|S)"NzThe provided OBS_THRESH ('r=z/ string. OBS_THRESH must be a string. Check therrz+The provided OBS_THRESH is empty. Since therz ', OBS_THRESHrrrz!The provided OBS_THRESH string ('rz/ invalid characters. OBS_THRESH must be made ofrrrrrz- (<,>,<=,>=,!=,==). OBS_THRESH must contain arrz. contains no numerics (digits 0-9). OBS_THRESHrrr> z[\s,]+z*WARNING: The provided OBS_THRESH string ('z. is not equivalent to the provided FCST_THRESHz string ('z').) rr r r r:rrreplacer_splitr) OBS_THRESHrrr r rcheck_OBS_THRESHsp       rcCrx)NzThe provided STATS ('rz+ STATS must be a string. Check the plottingrz,The provided STATS is empty. STATS cannot berryzThe provided STATS string ('rz* invalid characters. STATS must be made ofrzr{r>r?)STATSr r r check_STATSr~rcCs<t|tstd|ddd|stddd|S)Nz$The provided CONFIDENCE_INTERVALS ('rz: CONFIDENCE_INTERVALS must be a string. Check the plottingrz4WARNING: The provided CONFIDENCE_INTERVALS is empty.z1 Confidence intervals will not be plotted. Set toz2 'True' if confidence intervals should be plotted.r0)CONFIDENCE_INTERVALSr r rcheck_CONFIDENCE_INTERVALSs r)N)&r loggingrpathlibrrrrr&r)r+r-r/r2r<rArGrJrKrOrRrbrergrirprsrurwr}rrrrrrrrr r r rsJ   $ # # " (.