Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

How to postprocess a wrfoutput file

Hello,
I am looking into extracting a slice (in GRIB format) from a wrfout* file (among other postprocessing tasks but this is the most important). In the past, UPP could be used for this task but it seems that UPP support for WRF was phased out 2+ years ago. I'm looking for some recommendation on which tool would be the most appropriate taking into account that my WRF version is 4.4.2. Can this be accomplished with WRF-python? I definitely do not want to use NCL.
Thanks,
Arturo
 
Arturo,
Unfortunately I don't have the utility to extract data form wrfout, then write it to grib format.
I would suggest that you try UPP. Even if UPP no longer officially supports WRF, I suppose it still works to process wrfout files.
Sorry for not being able to help more on this issue.
 
Hi Ming,
According to the (Github) documentation, UPP removed WRF (and GRIB1) in October of 2020. That was my problem earlier today as I was able to install the app but simply wasn't able to specify that the file to be read must be of the 'wrfout' type.
 
Arturo,
I am sorry to know that UPP no longer works to process wrfout files. In this case you will have to find other options.
 
Hello Arturo,
I am using UPP v3.2 every days and it is working fine with WRF 4.3, and with even more recent versions of WRF. Yes it is outdated, but still working.
I think that nobody will support the troubleshooting but it is really working quite well.
 
Hello Arturo,
I am using UPP v3.2 every days and it is working fine with WRF 4.3, and with even more recent versions of WRF. Yes it is outdated, but still working.
I think that nobody will support the troubleshooting but it is really working quite well.
Hi Alain,
I'm not sure if there's any other website holding copies of the source code but GitHub has versions 9 and forward (with the exception of release/public_v1, which seems to have version 1.1.0).
 
UPP can be installed if you use a past version of UPP and NCEPLibs. It's tricky but can be done.

There are other options like

Wrf-python
NCAR Command Language (NCL)
Hi Will. I don't think that WRF-python can extract GRIB slices. The alternative is to build my own python code, which might (or might not) recycle some of the components or classes from WRF-python.Thanks.
 
I have the last UPP version that worked for WRF installed as part of the install codes for WRF on my GitHub. I had to do some modifications to the installation to get it to work on Ubuntu 20 and above.

I'll see if I can separate it out and put it into a separate script in the UPP sub forum to help @afernandezody
Hello Will,
I was following your script and noticed that one of your builds uses HWRF_v4.0a_UPP. I tried and the compilation proceeded (6 executables & 13 libraries built). Furthermore, running the app loads the wroutput file and starts processing it. However, it breaks down because it cannot find the file 'hires_micro_lookup.dat' that comes in other UPP distributions but not in this one. Have you ever noticed this problem while running UPP?
Thanks.
Arturo
 
good evening @afernandezody

The HWRF upp is very specific to HWRF as it requires different libraries if I remember correctly. I would look at the ones compiled in one of the WRF scripts.

I haven't used UPP in a very long time but I haven't changed the code since it last worked for me.
I have been dealing with family issues so I haven't had the time to build a seperate install script for UPP and all the other old post processors.
 
good evening @afernandezody

The HWRF upp is very specific to HWRF as it requires different libraries if I remember correctly. I would look at the ones compiled in one of the WRF scripts.

I haven't used UPP in a very long time but I haven't changed the code since it last worked for me.
I have been dealing with family issues so I haven't had the time to build a seperate install script for UPP and all the other old post processors.
Hi @Whatheway,
Sorry to hear about your family issues. I've tried to compile UPP about a dozen times but the problem is that the NCEPLIBS library (libg2_d.a) doesn't pick up several JasPer components (e.g. jas_stream_memopen or jas_stream_close), and when I try to run UPP, it crashes with an illegal instruction error. Furthermore, the data that I need to process is from a NMM simulation and it doesn't seem that UPPv4 admits this option, although UPPv3.2 does. Trying HWRF was a long shot. The missing files seem to be data files, not libraries; I contacted the developer but not sure if they will get back to me as the project has been inactive for a while. Thanks.
 
Hello,
It seems that I was finally able to compile UPP. However, running run_unipost keeps generating the error mv: cannot stat 'WRFPRS00.tm00': No such file or directory. It seems that this means that unipost didn't run correctly but the log file doesn't provide any particular error message.
Thanks,
Arturo
 
Last edited:
This may or may not help.

Code:
  ###############################NCEPlibs#####################################
  #The libraries are built and installed with
  # ./make_ncep_libs.sh -s MACHINE -c COMPILER -d NCEPLIBS_DIR -o OPENMP [-m mpi] [-a APPLICATION]
  #It is recommended to install the NCEPlibs into their own directory, which must be created before running the installer. Further information on the command line arguments can be obtained with
  # ./make_ncep_libs.sh -h

  #If iand error occurs go to https://github.com/NCAR/NCEPlibs/pull/16/files make adjustment and re-run ./make_ncep_libs.sh
  ############################################################################


  cd $WRFCHEM_FOLDER/Downloads
  git clone https://github.com/NCAR/NCEPlibs.git
  cd NCEPlibs
  mkdir $DIR/nceplibs

  export JASPER_INC=$DIR/grib2/include
  export PNG_INC=$DIR/grib2/include
  export NETCDF=$DIR/NETCDF

  #for loop to edit linux.gnu for nceplibs to install
  #make if statement for gcc-9 or older
  export GCC_VERSION=$(gcc -dumpfullversion | awk '{print$1}')
  export GFORTRAN_VERSION=$(gfortran -dumpfullversion | awk '{print$1}')
  export GPLUSPLUS_VERSION=$(g++ -dumpfullversion | awk '{print$1}')

  export GCC_VERSION_MAJOR_VERSION=$(echo $GCC_VERSION | awk -F. '{print $1}')
  export GFORTRAN_VERSION_MAJOR_VERSION=$(echo $GFORTRAN_VERSION | awk -F. '{print $1}')
  export GPLUSPLUS_VERSION_MAJOR_VERSION=$(echo $GPLUSPLUS_VERSION | awk -F. '{print $1}')

  export version_10="10"

  if [ $GCC_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GFORTRAN_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GPLUSPLUS_VERSION_MAJOR_VERSION -ge $version_10 ]
  then
    y="24 28 32 36 40 45 49 53 56 60 64 68 69 73 74 79"
    for X in $y; do
      sed -i "${X}s/= /= $fallow_argument $boz_argument /g" $WRFCHEM_FOLDER/Downloads/NCEPlibs/macros.make.linux.gnu
    done
  else
    echo ""
    echo "Loop not needed"
  fi

  if [ ${auto_config} -eq 1 ]
    then
      echo yes | ./make_ncep_libs.sh -s linux -c gnu -d $DIR/nceplibs -o 0 -m 1 -a upp
    else
      ./make_ncep_libs.sh -s linux -c gnu -d $DIR/nceplibs -o 0 -m 1 -a upp
  fi

  export PATH=$DIR/nceplibs:$PATH

  echo " "
  ################################UPPv4.1######################################
  #Previous verison of UPP
  #WRF Support page recommends UPPV4.1 due to too many changes to WRF and UPP code
  #since the WRF was written
  #Option 8 gfortran compiler with distributed memory
  #############################################################################
  cd $WRFCHEM_FOLDER/
  git clone -b dtc_post_v4.1.0 --recurse-submodules https://github.com/NOAA-EMC/EMC_post UPPV4.1
  cd UPPV4.1
  mkdir postprd
  export NCEPLIBS_DIR=$DIR/nceplibs
  export NETCDF=$DIR/NETCDF

  if [ ${auto_config} -eq 1 ]
    then
      echo 8 | ./configure  #Option 8 gfortran compiler with distributed memory
    else
      ./configure  #Option 8 gfortran compiler with distributed memory
  fi


  echo " "
  #make if statement for gcc-9 or older
  export GCC_VERSION=$(gcc -dumpfullversion | awk '{print$1}')
  export GFORTRAN_VERSION=$(gfortran -dumpfullversion | awk '{print$1}')
  export GPLUSPLUS_VERSION=$(g++ -dumpfullversion | awk '{print$1}')

  export GCC_VERSION_MAJOR_VERSION=$(echo $GCC_VERSION | awk -F. '{print $1}')
  export GFORTRAN_VERSION_MAJOR_VERSION=$(echo $GFORTRAN_VERSION | awk -F. '{print $1}')
  export GPLUSPLUS_VERSION_MAJOR_VERSION=$(echo $GPLUSPLUS_VERSION | awk -F. '{print $1}')

  export version_10="10"

  if [ $GCC_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GFORTRAN_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GPLUSPLUS_VERSION_MAJOR_VERSION -ge $version_10 ]
  then
    z="58 63"
    for X in $z; do
      sed -i "${X}s/(FOPT)/(FOPT) $fallow_argument $boz_argument  /g" $WRFCHEM_FOLDER/UPPV4.1/configure.upp
    done
  else
    echo ""
    echo "Loop not needed"
  fi


  ./compile
  cd $WRFCHEM_FOLDER/UPPV4.1/scripts
  chmod +x run_unipost



  echo " "
 
Top