【问题标题】:nco - how to remove "cut" values from a specific areanco - 如何从特定区域删除“剪切”值
【发布时间】:2017-04-20 08:49:19
【问题描述】:

我有一个这样的 netcdf 文件:

dimensions:
    time = 8760 ;
    lon_lat = 35047 ;
    temperature = 8760 ;
variables:
    float temp(temperature, lon_lat) ;
        temp:units = "C" ;
    float time(time) ;
    float longitude(lon_lat) ;
        longitude:units = "degrees east" ;
    float latitude(lon_lat) ;
        latitude:units = "degrees north" ;

netcdf 覆盖了整个美国。我想用 nco 做的是删除一个特定的区域,比如一个正方形。

因此,通过为某个区域提供某些坐标,我将删除“切出”该区域。

然后我会得到一个带有三个变量但没有该特定区域数据的州的 netcdf。假设我会让美国有一个洞。

我已经用 Hyperslabs (http://nco.sourceforge.net/nco.html#hyp) 进行了尝试:

ncks -d lon,-106.,-102. -d lat, 20.,30. in.nc out.nc

但是,它说:

ncks: ERROR dimension longitude is not in input file

对,因为维度是 (lon_lat)。有没有办法通过变量来削减它?

【问题讨论】:

  • 这个文件看起来不对,为什么temperature是一个维度?为什么会有一个空间维度lat_lon?该文件可能应该是 3D,time x lat x lon,并且将 temperature 作为变量,而不是维度。整理好文件后,您可以使用 hyperslabs 在 latlon 之间提取一个矩形。

标签: netcdf nco


【解决方案1】:

关于temperature 维度,我有与 N1B4 相同的问题。 lat_lon 维度可能表示非结构化网格。

试试 NCO 的辅助坐标feature。 首先添加这些standard_name 属性:

ncatted -a standard_name,latitude,o,c,latitude -a standard_name,longitude,o,c,longitude in.nc 

然后使用-X 对你想要的区域进行超切片,即除了洞之外的所有区域:

ncks -X 10,180,10,90 -X -180,0,-90,0 in.nc out.nc

【讨论】:

  • 这很好,我不知道这些 ncks 功能!
【解决方案2】:

您可以使用以下方法将区域设置为 CDO 中的 netcdf 缺失值:

 cdo setclonlatbox,missing_vlaue,lon1,lon2,lat1,lat2 infile outfile

这是你想要达到的目标吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-23
    • 2014-08-13
    • 1970-01-01
    • 2020-02-14
    • 2014-03-17
    • 1970-01-01
    • 1970-01-01
    • 2015-09-29
    相关资源
    最近更新 更多