从域NCFILE提取数据

问题描述 投票:1回答:1

我试图从在由纬度/经度边界限定一个用户指定的(非矩形的)域中的每个网格单元中提取数据。我的输入文件是一个曲线网格。我已经试过各种方法蟒蛇,CDO,NCK上,但我仍然无法弄清楚。我只是想在输入NCFILE我的多边形区域子集的每一个网格单元信息的时间序列。我NCFILE信息输入在这里给出:

$ ncdump -h 1979_sfc_out.nc 

netcdf \1979_sfc_out {
dimensions:
    x = 83 ;
    y = 94 ;
    time = UNLIMITED ; // (8736 currently)
    nv4 = 4 ;
variables:
    float time(time) ;
        time:axis = "T" ;
        time:long_name = "time" ;
        time:standard_name = "time" ;
        time:units = "hours since 1979-1-2 00:00:00" ;
        time:calendar = "standard" ;
    float x(x) ;
        x:axis = "x" ;
        x:long_name = "X-coordinate in Cartesian system" ;
        x:standard_name = "projection_x_coordinate" ;
        x:units = "meters" ;
    float y(y) ;
        y:axis = "y" ;
        y:long_name = "Y-coordinate in Cartesian system" ;
        y:standard_name = "projection_y_coordinate" ;
        y:units = "meters" ;
    float lon(y, x) ;
        lon:units = "degrees_east" ;
        lon:valid_range = -180., 180. ;
        lon:standard_name = "longitude" ;
        lon:bounds = "lon_bnds" ;
    float lat(y, x) ;
        lat:units = "degrees_north" ;
        lat:valid_range = -90., 90. ;
        lat:standard_name = "latitude" ;
        lat:bounds = "lat_bnds" ;
    float lon_bnds(y, x, nv4) ;
        lon_bnds:units = "degreesE" ;
    float lat_bnds(y, x, nv4) ;
        lat_bnds:units = "degreesN" ;
    char mapping ;
        mapping:false_easting = 0. ;
        mapping:false_northing = 0. ;
        mapping:grid_mapping_name = "polar_stereographic" ;
        mapping:latitude_of_projection_origin = 90. ;
        mapping:standard_parallel = 64. ;
        mapping:straight_vertical_longitude_from_pole = -152. ;
        mapping:semi_major_axis = 6370000. ;
        mapping:semi_minor_axis = 6370000. ;
    float SEAICE(time, y, x) ;
        SEAICE:_FillValue = -9999.f ;
        SEAICE:units = "fraction" ;
        SEAICE:long_name = "Ice concentration (ice=1;no ice=0)" ;
        SEAICE:grid_mapping = "mapping" ;
        SEAICE:coordinates = "lon lat" ;

有些事情我已经尝试是

lat1=71.2
lat2=72.9
lon1=-176.5
lon2=-160

cdo sellonlatbox,lon1,lon2,lat1,lat2 $ifile $box1_ofile
cdo sellonlatbox (Abort): Float parameter >lon1< contains invalid character at position 1!

我认为这个问题是我的输入文件具有X,Y尺寸以米为单位(不具有负号,并有可能是“在位置1无效字符”),并且我要求CDO提取经/纬度维度度。我在我的NCFILE变量“映射”,这可能是米转换为经/纬度有用的,但我无法弄清楚如何做到这一点。

< - >经度/纬度问题,我与CDO看到和NCK上不适合我,由于同一电表在这里工作,有可能。

ncks -v SEAICE,U10,V10 -d latitude,71.2,72.9 -d longitude,-176.5,-160. $ifile -O $box1_ofile

ncks: ERROR dimension latitude is not in input file

虽然我想提取的多边形,这些例子我曾尝试都只是矩形子集,我认为让我可以做多个矩形子集来实现我的最终多边形形状的多边形,但如果有更好的方法来做到这一点的任何建议是赞赏。

谢谢

python coordinates netcdf nco
1个回答
1
投票

NCO的辅助坐标feature被设计成hyperslab上非结构化网格曲线坐标与1- d纬度和经度。尝试这个:

ncks -X lon_min,lon_max,lat_min,lat_max in.nc out.nc
ncks -X -176.5,-160.,71.2,72.9 in.nc out.nc

您也可以菊花链的多个-X选项来获得怪异的多边形。不幸的是,可能是因为,我只注意到不会为你工作,你必须使用二维纬度和经度曲线网格。对于尝试ncap2其中feature。该手册中的示例显示了如何沿着矩形边界面膜,你可以菊花链的条件在其中()语句获取多边形。这不会改变输出文件的维数,但它可以让你的多边形外面的一切设置为_FillValue。

© www.soinside.com 2019 - 2024. All rights reserved.