问题
I am dealing with netCDF files with the following structure :
netcdf YYY {
dimensions:
Time = UNLIMITED ; // (XXX currently)
lat = XX ;
lon = XX ;
variables:
double U_p_500hPa(Time, lat, lon) ;
U_p_500hPa:units = "m/s" ;
U_p_500hPa:_FillValue = -9999. ;
U_p_500hPa:description = "U at 500hPa" ;
U_p_500hPa:PlotLevelID = "500 hPa" ;
float XLAT(Time, lat, lon) ;
XLAT:FieldType = 104 ;
XLAT:MemoryOrder = "XY " ;
XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ;
XLAT:units = "degree_north" ;
XLAT:stagger = "" ;
float XLONG(Time, lat, lon) ;
XLONG:FieldType = 104 ;
XLONG:MemoryOrder = "XY " ;
XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ;
XLONG:units = "degree_east" ;
XLONG:stagger = "" ;
The thing is XLONG and XLAT do not actually depend of time.
Therefore i wonder if there is a way to set the coordinates variables as independent of time in order to get lighter files ?
I was thinking about using nco but I couldn't find the way to do so.
Thanks in advance for any help !
回答1:
Read the manual to find the meaning of the following, an approach that subsets the time-dependent variable into one file, averages the Time dimension out of the coordinates, and then appends the time-constant coordinates back into the file with the time-varying variable.
ncks -v U_p_500hPa in.nc u.nc
ncwa -a Time -v XLAT,XLONG in.nc latlon.nc
ncks -A latlon.nc u.nc
来源:https://stackoverflow.com/questions/53428813/netcdf-set-variable-as-constant-in-time