gpt4 book ai didi

netcdf - NCO:使用 NCO ncks 从 NetCDF 文件中提取变量

转载 作者:行者123 更新时间:2023-12-04 22:35:40 26 4
gpt4 key购买 nike

我试图通过输入以下命令从多变量 netcdf 文件中提取变量:

ncks -v ta temp1.nc out.nc

但是,然后我查看了 out.nc header ,所有变量仍然存在。

temp1.nc 和 out.nc 的标题如下:
--- temp1.nc header ---
dimensions:
time = UNLIMITED ; // (124 currently)
lon = 256 ;
bnds = 2 ;
lat = 128 ;
lev = 40 ;
variables:
double time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:units = "days since 1850-1-1" ;
time:calendar = "365_day" ;
time:axis = "T" ;
double lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
lon:bounds = "lon_bnds" ;
double lon_bnds(lon, bnds) ;
double lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
lat:bounds = "lat_bnds" ;
double lat_bnds(lat, bnds) ;
double p0 ;
p0:long_name = "reference pressure" ;
p0:units = "Pa" ;
double lev(lev) ;
lev:standard_name = "atmosphere_hybrid_sigma_pressure_coordinat
lev:axis = "Z" ;
lev:positive = "down" ;
lev:long_name = "hybrid sigma pressure coordinate" ;
lev:units = "1" ;
lev:formula_terms = "a: a b: b p0: p0 ps: ps" ;
lev:bounds = "lev_bnds" ;
lev:formula = "p = a*p0 + b*ps" ;
double lev_bnds(lev, bnds) ;
lev_bnds:standard_name = "atmosphere_hybrid_sigma_pressure_coor
lev_bnds:units = "1" ;
lev_bnds:formula_terms = "a: a_bnds b: b_bnds p0: p0 ps: ps" ;
double a(lev) ;
a:long_name = "vertical coordinate formula term: ap(k)" ;
a:units = "Pa" ;
double b(lev) ;
b:long_name = "vertical coordinate formula term: b(k)" ;
b:units = "1" ;
double a_bnds(lev, bnds) ;
a_bnds:long_name = "vertical coordinate formula term: ap(k+1/2)
a_bnds:units = "Pa" ;
double b_bnds(lev, bnds) ;
b_bnds:long_name = "vertical coordinate formula term: b(k+1/2)"
b_bnds:units = "1" ;
float ps(time, lat, lon) ;
ps:standard_name = "surface_air_pressure" ;
ps:long_name = "Surface Air Pressure" ;
ps:units = "Pa" ;
ps:comment = "surface pressure, not mean sea level pressure" ;
ps:original_units = "hPa" ;
ps:history = "2011-10-17T12:45:37Z altered by CMOR";
ps:cell_measures = "area: areacella" ;
float ta(time, lev, lat, lon) ;
ta:standard_name = "air_temperature" ;
ta:long_name = "Air Temperature" ;
ta:units = "K" ;
ta:_FillValue = 1.e+20f ;
ta:missing_value = 1.e+20f ;
ta:original_name = "T" ;
ta:cell_measures = "area: areacella" ;
ta:history = "2011-10-17T12:45:37Z altered by CMOR ;
// global attributes:

--- out.nc 头文件 ---
dimensions:
lev = 40 ;
bnds = 2 ;
lat = 128 ;
lon = 256 ;
time = UNLIMITED ; // (124 currently)
variables:
double a(lev) ;
a:long_name = "vertical coordinate formula term: ap(k)" ;
a:units = "Pa" ;
double a_bnds(lev, bnds) ;
a_bnds:long_name = "vertical coordinate formula term: ap(k+1/2)" ;
a_bnds:units = "Pa" ;
double b(lev) ;
b:long_name = "vertical coordinate formula term: b(k)" ;
b:units = "1" ;
double b_bnds(lev, bnds) ;
b_bnds:long_name = "vertical coordinate formula term: b(k+1/2)" ;
b_bnds:units = "1" ;
double lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
lat:bounds = "lat_bnds" ;
double lat_bnds(lat, bnds) ;
double lev(lev) ;
lev:standard_name = "atmosphere_hybrid_sigma_pressure_coordinate" ;
lev:axis = "Z" ;
lev:positive = "down" ;
lev:long_name = "hybrid sigma pressure coordinate" ;
lev:units = "1" ;
lev:formula_terms = "a: a b: b p0: p0 ps: ps" ;
lev:bounds = "lev_bnds" ;
lev:formula = "p = a*p0 + b*ps" ;
double lev_bnds(lev, bnds) ;
lev_bnds:standard_name = "atmosphere_hybrid_sigma_pressure_coordinate" ;
lev_bnds:units = "1" ;
lev_bnds:formula_terms = "a: a_bnds b: b_bnds p0: p0 ps: ps" ;
double lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
lon:bounds = "lon_bnds" ;
double lon_bnds(lon, bnds) ;
double p0 ;
p0:long_name = "reference pressure" ;
p0:units = "Pa" ;
float ps(time, lat, lon) ;
ps:standard_name = "surface_air_pressure" ;
ps:long_name = "Surface Air Pressure" ;
ps:units = "Pa" ;
ps:comment = "surface pressure, not mean sea level pressure" ;
ps:original_units = "hPa" ;
ps:history = "2011-10-17T12:45:37Z altered by CMOR" ;
ps:cell_measures = "area: areacella" ;
float ta(time, lev, lat, lon) ;
ta:standard_name = "air_temperature" ;
ta:long_name = "Air Temperature" ;
ta:units = "K" ;
ta:_FillValue = 1.e+20f ;
ta:missing_value = 1.e+20f ;
ta:original_name = "T" ;
ta:cell_measures = "area: areacella" ;
ta:history = "2011-10-17T12:45:37Z altered by CMOR" ;
double time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:units = "days since 1850-1-1" ;
time:calendar = "365_day" ;
time:axis = "T" ;

// global attributes:

我希望在 out.nc 上只有 ta。我没有从 ncks 收到任何错误消息。

我在这里做错了什么?我很感激任何帮助。

谢谢你。

最佳答案

出现此行为的原因是,默认情况下,NCO 提取与请求的变量“关联”的所有变量。这样,用户无需自己寻找即可获得所需的一切。换句话说,它是一个功能,而不是一个错误。要仅提取明确请求的变量,请使用 -C 开关,文档 here ,例如

ncks -C -v ta temp1.nc out.nc

文档还展示了如何去除与 CF 约定相关的变量,同时保留坐标,例如,具有各种更长的选项。

关于netcdf - NCO:使用 NCO ncks 从 NetCDF 文件中提取变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49459995/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com