#!/bin/bash set -xa export PS4='$SECONDS + ' date # # #### 02/24/2010 ########################################################## # Statistically adjust STAGE IV precipitation analysis (6-hourly) # to generate Climatologically Calibrated Precipitation Analysis (CCPA) # #### 04/18/2011 ########################################################## # Extend CCPA to include 3-hourly analysis. CCPA 3-hourly analysis is # generated by splitting 6-hourly analysis based on a proportion calculated # from the 3-hourly accumulation of the hourly Stage II (over NWRFC) and # Stage IV (all other CONUS RFCs) # #### 12/10/2012 ########################################################## # Slightly modified the script for WCOSS execution, and subversion control # #### 09/10/2015 ########################################################## # Update the regression coefficients with extended historical training data # sets from 2002 to 2015; use Stage II hourly in both NWRFC and CNRFC instead # of NWRFC only, while using Stage IV hourly in remaining areas as weights to # produce 3-hourly CCPA; extend CCPA look-back period by making additional # runs at 1/3/5/7 days past the valid date; include 2.5 km NDGD grid analysis. # #### 01/16/2018 ########################################################## # Update the regression coefficients with extended historical training data # sets from 2002 to 2017; introduce hourly CCPA (new); improve 3-hourly CCPA # by using Stage IV hourly data in the NWRFC and CNRFC areas # ########################################################################## #################################### # make temp directory #################################### export pid=$$ export DATA=${DATA:-${DATAROOT:?}/${jobid:?}} mkdir -p $DATA cd $DATA ############################################## # NET, ENVIR and RUN: used to define the output directory ############################################## export NET=${NET:-ccpa} export RUN=${RUN:-ccpa} export cycle=${cycle:-t${cyc}z} #################################### # Determine Job Output Name on System #################################### export pgmout="OUTPUT.${pid}" ######################################################################### # Define input, output directories for monitoring purpose ######################################################################### export DATAOUT=${DATAOUT:-$DATA/CCPA_out} #directory used to store output files at #the same grid as STAGE IV #One subdirectory for each date ############################################## # Define input constants and COM directories ############################################## # interp ----- -i parameter for copygb (method of interpolation) # grid ---- grid definition of input data, defined in ../ush/copygb_pcp.sh # COMINpcpanl ---- (Partial) name of directory of INPUT, source of STAGE IV raw data # COMOUT ---- (Partial) name of directory of OUTPUT files #################################### export interp=3 export grid=hrap export COMINpcpanl=${COMINpcpanl:-$(compath.py pcpanl/${pcpanl_ver})/pcpanl} export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${ccpa_ver})/${RUN}} export GESOUT=${GESOUT:-$(compath.py -o ${NET}/${ccpa_ver})/nwges/ccpa} #################################### # Specify Execution Areas # Switch home_dir to /nwprod for operation #################################### export HOMEccpa=${HOMEccpa:-$PACKAGEROOT/ccpa.${ccpa_ver}} export EXECccpa=${EXECccpa:-$HOMEccpa/exec} export USHccpa=${USHccpa:-$HOMEccpa/ush} export FIXccpa=${FIXccpa:-$HOMEccpa/fix} export coeff_dir=$FIXccpa/CCPA_CONUS_reg_coef_8thd export mask_fil=$FIXccpa/CCPA_CONUS_cpc_mask_8thd.bin ############################## # Run setpdy and initialize PDY variables ############################## setpdy.sh . ./PDY ############################## # Print current environment ############################## env ############################################################# # Execute the script # Run Today's job and Re-Run 1/3/5/7-day jobs ( processing 24h # precip ending at 12Z) # If the source data files are not updated, the script will stop. # This will be the case for most days. # We also need PDYm8 for CCPA 7-day look-back. The excutable script 'PDY' # only sets up Dm7-Dp7. export PDYm8=`finddate.sh $PDY d-8` for day in 0 1 3 5 7 do case $day in 0) day1=$PDYm1;day2=$PDY;; 1) day1=$PDYm2;day2=$PDYm1;; 3) day1=$PDYm4;day2=$PDYm3;; 5) day1=$PDYm6;day2=$PDYm5;; 7) day1=$PDYm8;day2=$PDYm7 esac ############################## # Specify work directory ############################## export work_dir=$DATA/$day2 if [ $day == 0 ]; then export work_dir=$DATA/TODAY fi if [ $day == 1 ]; then export work_dir=$DATA/YESTERDAY fi mkdir -p $work_dir cd $work_dir flagNum="day${day}" echo Re-Run $day2 job ----- processing 24h precip ending at 12Z $day2 # JY echo "$HOMEccpa/scripts/exccpa_conus.sh.ecf $day1 $day2 $work_dir" >>$DATA/poescript echo "$HOMEccpa/scripts/exccpa_conus.sh $day1 $day2 $work_dir $flagNum" >>$DATA/poescript # JY ecflow_client --event release_gempak cd $DATA echo ************************************************************* echo ************************************************************* echo ************************************************************* done chmod 775 $DATA/poescript export MP_CMDFILE=$DATA/poescript #################### # Execute the script #################### mpiexec -np 5 cfp ${MP_CMDFILE} export err=$?; err_chk echo `hostname` cat $pgmout.* msg="JOB COMPLETED NORMALLY" ############################## # Remove the Temporary working directory ############################## cd ${DATAROOT} if [ $KEEPDATA != 'YES' ]; then rm -rf $DATA fi date