Ali
Ali

Reputation: 43

Truncating netCDF

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?

Upvotes: 4

Views: 738

Answers (2)

ClimateUnboxed
ClimateUnboxed

Reputation: 8077

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).

Upvotes: 4

Charlie Zender
Charlie Zender

Reputation: 6322

Using NCO

ncks -d time,60, in.nc  1855-2005.nc
ncks -d time,,-60 in.nc 1850-2000.nc

See documentation

Upvotes: 8

Related Questions