问题描述
我正在处理具有以下结构的 netCDF 文件:
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 = "" ;
问题是 XLONG 和 XLAT 实际上并不取决于时间.
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 ?
我曾考虑使用 nco,但我找不到这样做的方法.
I was thinking about using nco but I couldn't find the way to do so.
在此先感谢您的帮助!
推荐答案
阅读手册以找到以下含义,一种将时间相关变量子集到一个文件中,将时间维度从坐标中取平均值的方法,然后将时间常数坐标附加回带有时变变量的文件中.
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
这篇关于NetCDF:将变量设置为时间常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!