I have a netCDF file of monthly surface air temperature from 1850-2005. How can I truncate the file in unix so that the new file has a time dimension from 1855 - 2005? And vice versa, truncating the file so that it is instead for 1850-2000?
Asked
Active
Viewed 624 times
2 Answers
8
Using NCO
ncks -d time,60, in.nc 1855-2005.nc
ncks -d time,,-60 in.nc 1850-2000.nc
See documentation

Charlie Zender
- 5,929
- 14
- 19
4
CDO allows you use a direct date format if you prefer:
cdo seldate,date1,date2 in.nc out.nc
so the equivalent to Charlie's nco commands would be
cdo seldate,18550101,20051231 in.nc 1855-2005.nc
cdo seldate,18500101,20001231 in.nc 1850-2000.nc
(assuming you want to include the years specified in the year range).

ClimateUnboxed
- 7,106
- 3
- 41
- 86