Using cdo to subset WRF output

cdo is a great way to manipulate NetCDF and GRIB data:

WRF by default writes a lot of variables into the wrfout output files, but we may only want to plot a subset of these, for a particular range of times. We can use cdo to create a NetCDF file with only the data we want, making it easier to copy the file between machines for further analysis.

I have WRF set to write a new output file every hour, so the first thing to do is to combine the files I want to analyse into one file. Here, I am simply combining the wrfout files for forecast hour 02 and 03 into a new file called

cdo mergetime wrfout_d01_2023-02-14_02\:00\:00 wrfout_d01_2023-02-14_03\:00\:00

Next, I only select the variables which I want to analyse from and write them to a file called

cdo selname,LANDMASK,HGT,T2,PSFC