Project

General

Profile

Country mask problem

Added by Aleksandar Janković about 6 years ago

Hello. I just started using CDO, so the problem I have can be pretty simple for those who use CDO for a long time. I have NetCDF file with annual accumulated temperature difference for the Mediterranean area with grid resolution 0.5 x 0.5 degrees. I am trying to extract and operate with data for just one country. I found the country shapefile, rasterized it in QGiS, and then converted it to nc file, so i can use it as mask in CDO. But when I use command:
cdo reducegrid,mask.nc 1990-2007hddyear.nc out.nc
I got message:
Grid type >generic< unsupported!
I think I created a wrong mask file in QGiS or is something else in question. Could someone help me? Does anyone have experience in creating masks for countries in QGiS? I looked everywhere on the internet and I did not find the answer, as well as in CDO user guide. I tried to make various masks with QGiS and shapefiles, but unsuccessfully. I attached the input file, as well as the country mask file.

mask.nc (1.14 KB) mask.nc Country_mask
1990-2007hddyear.nc (663 KB) 1990-2007hddyear.nc Whole_area

Replies (1)

RE: Country mask problem - Added by Karin Meier-Fleischer about 6 years ago

Hi Aleksandar,

the problem is your mask file which doesn't contain a lat/lon grid but x-, y- and z-range in meters and a z variable (?).

netcdf mask {
dimensions:
    side = 2 ;
    xysize = 144 ;
variables:
    double x_range(side) ;
        x_range:units = "meters" ;
    double y_range(side) ;
        y_range:units = "meters" ;
    double z_range(side) ;
        z_range:units = "meters" ;
    double spacing(side) ;
    int dimension(side) ;
    float z(xysize) ;
        z:scale_factor = 1. ;
        z:add_offset = 0. ;
        z:node_offset = 1 ;

// global attributes:
        :title = "" ;
        :source = "" ;
}


-Karin
    (1-1/1)