Project

General

Profile

extract region WRF output

Added by Ehsan Taghizadeh almost 4 years ago

Hi,
I hope you are doing great.
I would like to extract a small region from WRF output and save result in a .nc new file. I'll be thankful if I could have your help about this using cdo, nco, ncks, etc., just with a command line.

Sincerely
Ehsan Taghizadeh
Forecaster, I. R. of Iran Meteorological Organization (IRIMO)


Replies (6)

RE: extract region WRF output - Added by Ehsan Taghizadeh almost 4 years ago

Dear Brendan and Ralf,
Thank you so much for your helpful replies.

RE: extract region WRF output - Added by Ehsan Taghizadeh almost 4 years ago

Hi,
I've tried the following lines for wrf output files:

$ cdo -sellonlatbox,50.0,60.0,35.0,40.0 wrfout_d02_2021-02-09_12\:00\:00 wrfd2subreg.nc
$ cdo -selindexbox,30,40,30,40 wrfout_d02_2021-02-09_12\:00\:00 wrfd2subreg.nc

Unfortunately, none of them works and the following errors occurred:

Warning (cdf_set_var): Inconsistent variable definition for XLAT!
Warning (cdf_set_var): Inconsistent variable definition for XLONG!
Warning (cdf_set_var): Inconsistent variable definition for XLAT_U!
Warning (cdf_set_var): Inconsistent variable definition for XLONG_U!
Warning (cdf_set_var): Inconsistent variable definition for XLAT_V!
Warning (cdf_set_var): Inconsistent variable definition for XLONG_V!
Warning (cdfCheckVars): Unsupported data type (char/string), skipped variable Times!
Warning (cdf_read_coordinates): Time varying grids unsupported, using grid at time step 1!
cdo sellonlatbox: Unsupported grid type: generic

cdo sellonlatbox (Abort):

Obviously, wrf output file doesn't have lon and lat varibles, so what is the appropriate option for wrf?
I've attached output of "$ ncdump -h wrfout_d02_2021-02-09_12\:00\:00".

Sincerely,
Ehsan

wrf.dat (40.8 KB) wrf.dat

RE: extract region WRF output - Added by Ralf Mueller almost 4 years ago

    float XLAT(Time, south_north, west_east) ;
        XLAT:FieldType = 104 ;
        XLAT:MemoryOrder = "XY " ;
        XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ;
        XLAT:units = "degree_north" ;
        XLAT:stagger = "" ;
        XLAT:coordinates = "XLONG XLAT" ;
    float XLONG(Time, south_north, west_east) ;
        XLONG:FieldType = 104 ;
        XLONG:MemoryOrder = "XY " ;
        XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ;
        XLONG:units = "degree_east" ;
        XLONG:stagger = "" ;
        XLONG:coordinates = "XLONG XLAT" ;

CDO does not handle time-dependent coordinate variables. And I doubt that the values of the coordinate attribute is valid: a coordinate variable should not link to itself (XLONG -> XLONG). Same for XLONG_U and XLAT_U.

If you coordinate does not change with time, then you can remove the time-dependency from XLONG/XLAT. I expect CDO to work after this.

cheers
ralf

RE: extract region WRF output - Added by Ehsan Taghizadeh over 1 year ago

Hi,
Thanks all for your helps.

    (1-6/6)