9 | | Similar to preprocessor, WRF4G postprocessor is an executable script that can be written in any programming language, provided it does accept one argument. |
| 9 | Similar to preprocessor, WRF4G postprocessor is an executable script that can be written in any programming language, provided it does accept one argument, which is one WRF raw file. We usually use a modified version of p_interp to interpolate to filter out unnecessary variables and interpolate to pressure levels. Note that users with large storage resources may not be interested in using a postprocessor. |
| 10 | |
| 11 | Sample postprocesor: |
| 12 | |
| 13 | {{{ |
| 14 | #! /bin/bash |
| 15 | # |
| 16 | # Sample postprocessor |
| 17 | # |
| 18 | # This can be any kind of executable accepting one argument: |
| 19 | # |
| 20 | wrfnc_file=$1 # The WRF file to postprocess |
| 21 | # |
| 22 | # and creating a postprocessed file with the same name to be uploaded by register_file |
| 23 | # |
| 24 | |
| 25 | function pintnml(){ |
| 26 | idir=$1 |
| 27 | ifile=$2 |
| 28 | cat << EOF > namelist.pinterp |
| 29 | &io |
| 30 | path_to_input = '${idir}/', |
| 31 | input_name = '${ifile}', |
| 32 | path_to_output = '${idir}/', |
| 33 | fields = 'RAINTOT,T2,Q2,PSFC,U10,V10,CLT,SFCEVP,QFX,GLW,SWDOWN,RAINC,HGT,SMOIS,PH,PHB,GHT,T,TT,PRES,MSLP,PLEV,ALBEDO,SST,ACSNOW,GRDFLX,CLDFRA,SMSTOT,LH,ACLHF,HFX,ACHFX,SNOWH,ACSNOM,PBLH,Times', |
| 34 | process = 'list', |
| 35 | debug = .FALSE., |
| 36 | grid_filt = 3, |
| 37 | ntimes_filt = 10, |
| 38 | / |
| 39 | |
| 40 | &interp_in |
| 41 | interp_levels = 1000.0, 925., 850.0, 700., 500.0, 300, |
| 42 | extrapolate = 1, |
| 43 | interp_method = 1, |
| 44 | unstagger_grid = .TRUE., |
| 45 | / |
| 46 | EOF |
| 47 | } |
| 48 | |
| 49 | pintnml . ${wrfnc_file} |
| 50 | p_interp |
| 51 | rm namelist.pinterp |
| 52 | |
| 53 | xptdsize=$( echo "print int($(stat -c %s ${wrfnc_file})*0.025)" | python ) |
| 54 | if test "$(stat -c %s ${wrfnc_file}_PLEV)" -ge ${xptdsize}; then |
| 55 | mv "${wrfnc_file}_PLEV" "${wrfnc_file}" |
| 56 | fi |
| 57 | |
| 58 | }}} |