#! /bin/ksh ################################################################################ #### UNIX Script Documentation Block # . . # Script name: hiresw_prdgen_oldgrid.sh_eastwest # Script description: Runs prdgen for the legacy (old) grid distributed to AWIPS # # # Author: Matthew Pyle Org: NP22 Date: 2014-02-11 # # Abstract: Runs prdgen for a specific forecast hour for the CONUS domain # to horizontally interpolate the native grid GRIB output onto # the EAST or WEST 5 km grid for distribution. # # Script history log: # 2013-11-01 Matthew Pyle - Original script for parallel # 2014-09-18 Matthew Pyle - Combined East and West legacy grid ush scripts # into single script # 2019-11-06 Matthew Pyle - FV3 version of legacy grid generation set -x fhr=$1 DOMIN_SMALL=$2 CYC=${3} model=$4 subpiece=$5 region=$6 reflag=1 mkdir -p ${DATA}/prdgen_5kmsbn_${region}_${subpiece}/${fhr}/ cd ${DATA}/prdgen_5kmsbn_${region}_${subpiece}/${fhr} DOMIN=${DOMIN_SMALL}${model} modelout=$model if [ $model = "arw" ] then modelout="arw" reflag=0 fi if [ $DOMIN_SMALL = "conus" ] then filenamthree="fv3.CONUS05" else echo "Improperly used for " $DOMIN " domain" err_exit "hiresw_prdgen_oldgrid.sh_5km only for CONUS DOMAIN" fi echo HERE region $region if [ $region = "west" ] then wgrib2def="lambert:252:40.5:40.5 230.800:884:5000 24.500:614:5000" elif [ $region = "east" ] then wgrib2def="lambert:271:38.0:38.0 250.200:884:5000 22.100:614:5000" elif [ $region = "conus" ] then # wgrib2def="lambert:262.5:38.5:38.5 237.280:1799:3000 21.138:1059:3000" wgrib2def="lambert:262.5:38.5:38.5 237.280:1079:5000 21.138:635:5000" else err_exit "No proper definition for variable region provided to regional_prdgen_oldgrid.sh_5km" fi echo wgrib2def $wgrib2def filedir=$DATA export fhr export tmmark=tm00 ############################################################### ############################################################### ############################################################### # # make GRIB file with pressure data every 25 mb for EMC's FVS # verification cp $PARMfv3/hiresw_conus_awpregeastwest.txt_${subpiece} regional_grid_extract.txt # if [ $DOMIN_SMALL = "conus" ] # then # if [ $fhr -eq 00 ] # then # INPUT_DATA=$INPUT_DATA_EVEN # elif [ $fhr%2 -eq 0 ] # then # INPUT_DATA=$INPUT_DATA_EVEN # else # INPUT_DATA=$INPUT_DATA_ODD # fi # INPUT_DATA_FORE=${INPUT_DATA} # $DATA should be post working directory # INPUT_DATA=${DATA} # fi looplim=90 loop=1 while [ $loop -le $looplim ] do echo in while if [ -s $INPUT_DATA/postdone${fhr} ] then break else loop=$((loop+1)) sleep 20 fi if [ $loop -ge $looplim ] then msg="FATAL ERROR: ABORTING after 30 minutes of waiting for $INPUT_DATA/postdone${fhr}" err_exit $msg fi done ### extract just needed items compress="c3 -set_bitmap 1" echo want to process from $INPUT_DATA the file BGDAWP${fhr}.tm00 $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 | grep -F -f regional_grid_extract.txt | $WGRIB2 -i -grib inputs.grb $INPUT_DATA/BGDAWP${fhr}.tm00 export err=$?; err_chk $WGRIB2 inputs.grb -set_grib_type ${compress} -new_grid_winds grid -new_grid_vectors default -new_grid ${wgrib2def} ${filenamthree}${fhr}.tm00_bilin export err=$?; err_chk if [ $subpiece = "1" ] then $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match ":(APCP|WEASD):" -grib inputs_budget.grb export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match ":(CSNOW|CICEP|CFRZR|CRAIN|RETOP):" -grib nn.grb export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match ":TSOIL:0-0.1 m below ground:" -grib nn.grb_2 export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match ":SOILW:0-0.1 m below ground:" -grib nn.grb_3 export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match ":TCDC:entire" -grib nn.grb_4 export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match "HGT:cloud ceiling:" -grib ceiling.grb export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match "REFD:1000 m above ground:" -grib 1000refd.grb export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match "REFD:4000 m above ground:" -grib 4000refd.grb export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match "REFD:263 K level:" -grib 263krefd.grb export err=$?; err_chk $WGRIB2 $INPUT_DATA/BGDAWP${fhr}.tm00 -match ":MDIV:30-0 mb above ground:" -grib mconv.grb export err=$?; err_chk cat nn.grb nn.grb_2 nn.grb_3 nn.grb_4 ceiling.grb 1000refd.grb 4000refd.grb 263krefd.grb mconv.grb > inputs_nn.grb rm nn.grb nn.grb_2 nn.grb_3 nn.grb_4 ceiling.grb 1000refd.grb 4000refd.grb 263krefd.grb mconv.grb $WGRIB2 inputs_nn.grb -set_grib_type ${compress} -new_grid_winds grid -new_grid_interpolation neighbor -new_grid ${wgrib2def} ${filenamthree}${fhr}.tm00_nn export err=$?; err_chk $WGRIB2 inputs_budget.grb -set_grib_type ${compress} -new_grid_winds grid -new_grid_interpolation budget -new_grid ${wgrib2def} ${filenamthree}${fhr}.tm00_budget export err=$?; err_chk fi if [ $subpiece = "1" ] then cat ${filenamthree}${fhr}.tm00_bilin ${filenamthree}${fhr}.tm00_nn ${filenamthree}${fhr}.tm00_budget > ${filenamthree}${fhr}.tm00 else mv ${filenamthree}${fhr}.tm00_bilin ${filenamthree}${fhr}.tm00 fi ############################################################### ############################################################### ############################################################### cp ${filenamthree}${fhr}.tm00 $DATA/${RUN}.t${CYC}z.${MODEL}_5km.f${fhr}.conus.grib2_${region}_${subpiece} # fi