o ng͔@s4ddlZddlZddlZddlmZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ ddZddZddZddZddZdCdd ZdCd!d"ZdCd#d$ZdCd%d&ZdCd'd(ZdCd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Z d;d<Z!d=d>Z"d?d@Z#dAdBZ$dS)DN)PathcCJt|tstd|dddtd|s#tddtd|S)Nz'FATAL ERROR: The provided VERIF_CASE ('') is not a string.z1 VERIF_CASE must be a string. Check the plotting configuration file.zCFATAL ERROR: The provided VERIF_CASE is empty. VERIF_CASE cannot be. empty. Check the plotting configuration file. isinstancestrprintsysexit) VERIF_CASEr@/lfs/h1/ops/prod/packages/evs.v1.0.19/ush/cam/check_variables.pycheck_VERIF_CASE    rcCr)Nz'FATAL ERROR: The provided VERIF_TYPE ('rz1 VERIF_TYPE must be a string. Check the plottingrrzCFATAL ERROR: The provided VERIF_TYPE is empty. VERIF_TYPE cannot berr) VERIF_TYPErrrcheck_VERIF_TYPE$rrcCsrt|tstd|dddtdtd|r/td|dd d d td|s7td d |S)Nz'FATAL ERROR: The provided IMG_HEADER ('rz1 IMG_HEADER must be a string. Check the plottingrrz[^A-Za-z0-9_\-\\.]z.FATAL ERROR: The provided IMG_HEADER string (' ') containsz/ invalid characters. IMG_HEADER must be made of4 alphanumeric characters, hyphen, and/or underscore.' Check the plotting configuration file.z6The provided IMG_HEADER is empty. Plot file names willz not include a header.r r r r r research) IMG_HEADERrrrcheck_IMG_HEADER4s*      rcC|t|tstd|dddtdt|s&td|ddt|s4td|d |std |d d d d dtd|S)Nz%FATAL ERROR: The provided var_name ('rz. var_name must be a string. Check the plottingrrz?FATAL ERROR: The provided var_name is empty. var_name cannot ber[^ A-Za-z0-9,_\-]z,FATAL ERROR: The 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_namerrrcheck_var_name0       rvcCrq)Nz)FATAL ERROR: The provided VX_MASK_LIST ('rz2 VX_MASK_LIST must be a string. Check the plottingrrzGFATAL ERROR: The provided VX_MASK_LIST is empty. VX_MASK_LIST cannot berrrz0FATAL ERROR: The provided VX_MASK_LIST string ('rz1 invalid characters. VX_MASK_LIST must be made ofrsrtr>r) VX_MASK_LISTrrrcheck_VX_MASK_LISTrwrycC|t|tstd|dddtd|s#tddtdtd|r=.,! /-]z/FATAL ERROR: 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>)r r r r r r:rr) FCST_THRESHrrrrcheck_FCST_THRESHusf              rcCsdt|tstd|dddtdt|dvr|s3tdd|d d d tdtd |rNtd |dddddtdtd|ritd |ddddd tdtd|rtd |dddddtd|dd|ddkst t d|t t d|krtd|dd d!|d"|S)#Nz'FATAL ERROR: The provided OBS_THRESH ('r=z/ string. OBS_THRESH must be a string. Check ther}rrz8FATAL ERROR: The provided OBS_THRESH is empty. Since therz ', OBS_THRESHrrrz.FATAL ERROR: 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').) r r r r r r:rrreplacerXsplit) OBS_THRESHrrrrrcheck_OBS_THRESHsz                rcCrq)Nz"FATAL ERROR: The provided STATS ('rz+ STATS must be a string. Check the plottingrrz9FATAL ERROR: The provided STATS is empty. STATS cannot berrrz)FATAL ERROR: The provided STATS string ('rz* invalid characters. STATS must be made ofrsrtr>r)STATSrrr check_STATSrwrcCsDt|tstd|dddtd|s tddd|S) Nz1FATAL ERROR: The provided CONFIDENCE_INTERVALS ('rz: CONFIDENCE_INTERVALS must be a string. Check the plottingrrz4WARNING: The provided CONFIDENCE_INTERVALS is empty.z1 Confidence intervals will not be plotted. Set toz2 'True' if confidence intervals should be plotted.r)CONFIDENCE_INTERVALSrrrcheck_CONFIDENCE_INTERVALSs   rcCsbt|tstd|dddtdtd|r/td|dd d d td|S) Nz'FATAL ERROR: The provided INTERP_PTS ('rz0 INTERP_PTS must be a string. Check the plottingrrr{z.FATAL ERROR: The provided INTERP_PTS string ('rz/ invalid characters. INTERP_PTS must be made ofr|r}r)Z INTERP_PTSrrrcheck_INTERP_PTSrDr)N)%r loggingrpathlibrrrrr&r)r+r-r/r1r<r@rCrHrKr[r^r`rbrirlrnrprvryrrrrrrrrrrrrsH    $ # # " (.