U g @s$ddlZddlZddZddZdS)NcCstj|_|jj}|jj}|jj}|jdkr4d}ntt|jj|j|j}tj||||d|_ |j tj |j dd|_ |j |_ dS)z Generic function to initialize the datetime variables within the status object. This information will be utilized (and updated) throughout the workflow as files are generated/completed, etc. ryearmonthdayhour @secondsN)datetimeutcnowdRealrrr accDurationintrdEnd timedelta numHoursBackdInitdCurr) statusMetaZyrRealZ monthRealZdayRealZ hourClosestr?/lfs/h1/ops/prod/packages/nwm.v3.0.13/ush/mpe_refine/dateMod.py initDatesMpe s  rcCs|dk r0||_zt|WntYnX|dk rnt|ddkrnt|d|jdkrnd|_t|dk rt|d}t|d}t|d}t|d}tj||||d|_ |j tj |jd d |_ |j |_ dS) af Function to reset the dates in the information calculated from the mpe.config default settings for datetime variables. This is for when the user passes an optional number of hours to look back, or date to begin the look back that is different from the default. This is mostly for when the user wants to process old/retrospective data. Nz%HrzeERROR: Specified optional hour is not equal divisor of accumulation duration specified in mpe.configz%Yz%mz%drrr ) rioModcheckStaticMeta ExceptionrstrftimererrMsgr rrrr)r optDateEndoptNumHoursBackZyrEndZmonthEndZdayEndZhrEndrrrinitOptDatesMpe(s& r )r rrr rrrr s