1

I have a netcdf file and I need to perform a spatial subsetting. Here is the file structure:

netcdf input {
dimensions:
        x = 5762 ;
        y = 3963 ;
        time_counter = UNLIMITED ; // (36 currently)
        tbnds = 2 ;
variables:
         ....

I tried the following NCO command and it worked fine:

ncks -d x,1,5 -d y,1,5 input.nc -O output.nc

Which is the equivalent command for CDO? I only found the sellonlatbox command, but it isn't the command I'm looking for.

Thanks

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
Fab
  • 1,145
  • 7
  • 20
  • 40

1 Answers1

1

The command I think you are looking for is

cdo  selindexbox,idx1,idx2,idy1,idy2  infile outfile

which allows you to select an area based on indices. I don't have an example file with the spatial dimensions defined as x and y, instead of lat and lon (CDO tends to often run into trouble with non "climate" default files), so you will have to let us know if this works in this case too. Hopefully this answer is useful though for people wanting to perform a cut based on indices with a standard climate netcdf files.

In general though, one has to remember that CDO is targeted at climate data manipulation and therefore has a lot of specific tools to this end, (statistics, grid interpolations etc) but not always all the generic functionality of NCO (i.e. there is not a 1-1 relationship between their functionality). I tend to use CDO where commands exist simply because I find it easier to remember them, but often resort to a mix of the two.

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86