How to crop a NetCDF file by longitude in NCO

1.8k Views Asked by At

I am trying to extract a geographic subregion from global NetCDF files available over opendap. The required region runs from 13 degrees west to 10 degrees east: longitudes -13 to 10.

NCO can normally do this as follows:

ncks -d lat,40.,70.-d lon,-10.,13. https://dataserver.nccs.nasa.gov/thredds/dodsC/CMIP5/NASA/GISS/rcp85/E2-H_rcp85_r2i1p1_day/tos_day_GISS-E2-H_rcp85_r2i1p1_20510101-20751231.nc out.nc

However, the longitudes in the resulting NetCDF file goes from 0 to 13 degrees, not -10 to 13. This is because the longitudes are recordes as "degrees east", so NCO does not appear to handle negative values. Does anyone know a way of adjusting the above to accept negatives?

Note: CDO can handle negative longitudes. However, in this case CDO is not a suitable solution as it a) has to download the the global dataset first before cropping, and b) is not able to handle this particular opendap file.

1

There are 1 best solutions below

0
On BEST ANSWER

NCO handles these "wrapped coordinates" as described here. Please re-try with your bounding-box limits in [0,360], e.g.,

ncks -d lat,40.,70. -d lon,347.,10. https://dataserver.nccs.nasa.gov/thredds/dodsC/CMIP5/NASA/GISS/rcp85/E2-H_rcp85_r2i1p1_day/tos_day_GISS-E2-H_rcp85_r2i1p1_20510101-20751231.nc out.nc