使用R netcdf4数据提取

时间:2015-04-28 14:12:21

标签: r netcdf data-extraction

我在从netcdf4文件latitude 25 to 32, longitude 81 to 98中提取区域sund_WAS-44_ICHEC-EC-EARTH_rcp26_r12i1p1_SMHI-RCA4_v2_day_20510101-20551231.nc的数据时遇到问题。

lat和lon值的矩阵为193 * 130。我正在使用R作为我的目的。我想运行一个循环,以便为每个sund(1826)提供lat,lon的所有值。

File sund_WAS-44_ICHEC-EC-EARTH_rcp26_r12i1p1_SMHI-RCA4_v2_day_20510101-20551231.nc (NC_FORMAT_NETCDF4_CLASSIC):"

 5 variables (excluding dimension variables):"
    double lat[rlon,rlat]   "
        standard_name: latitude"
        long_name: latitude"
        units: degrees_north"
    double lon[rlon,rlat]   "
        standard_name: longitude"
        long_name: longitude"
        units: degrees_east"
    char rotated_pole[]   "
        grid_mapping_name: rotated_latitude_longitude"
        grid_north_pole_latitude: 79.95"
        grid_north_pole_longitude: -123.34"
    float sund[rlon,rlat,time]   "
        grid_mapping: rotated_pole"
        _FillValue: 1.00000002004088e+20"
        missing_value: 1.00000002004088e+20"
        standard_name: duration_of_sunshine"
        long_name: Duration of Sunshine"
        units: s"
        coordinates: lon lat"
        cell_methods: time: sum"
    double time_bnds[bnds,time]   "

 4 dimensions:"
   rlat  Size:130"
        standard_name: grid_latitude"
        long_name: latitude in rotated pole grid"
        units: degrees"
        axis: Y"
    rlon  Size:193"
        standard_name: grid_longitude"
        long_name: longitude in rotated pole grid"
       units: degrees"
        axis: X"
    time  Size:1826   *** is unlimited ***"
        standard_name: time"
        units: days since 1949-12-01 00:00:00"
        calendar: standard"
        long_name: time"
        bounds: time_bnds"
        axis: T"
    bnds  Size:2"

    22 global attributes:"        
    Conventions: CF-1.4"
    contact: rossby.cordex@smhi.se"
    creation_date: 2013-12-08-T04:22:00Z"
    experiment: RCP2.6"
    experiment_id: rcp26"
    driving_experiment: ICHEC-EC-EARTH, rcp26, r12i1p1"
    driving_model_id: ICHEC-EC-EARTH"
    driving_model_ensemble_member: r12i1p1"
    driving_experiment_name: rcp26"
    frequency: day"
    institution: Swedish Meteorological and Hydrological Institute, Rossby Centre"
    institute_id: SMHI"
    model_id: SMHI-RCA4"
    rcm_version_id: v2"
    project_id: CORDEX"
    CORDEX_domain: WAS-44"
    product: output"
    references: http://www.smhi.se/en/Research/Research-departments/climate-research-rossby-centre"
    tracking_id: 26296ff2-4f1b-429c-9081-4f9eed7b08d0"
    rossby_comment: 201258: CORDEX West Asia 0.44 deg | RCA4 v2 | ICHEC-EC-EARTH | r12i1p1 | rcp26 | L40"
    rossby_run_id: 201258"
    rossby_grib_path: /nobackup/rossby16/rossby/joint_exp/cordex/201258/raw/"

2 个答案:

答案 0 :(得分:1)

The easiest way to extract across lat/lon bands is by using ncks from NCO: http://nco.sourceforge.net/nco.html

ncks -d latitude,25,32 -d longitude,81,95 your_netcdf.nc -O new_netcdf.nc

答案 1 :(得分:0)

您的数据是WAS域中的cordex数据。您应该将常规坐标转换为旋转坐标,然后在nc文件中找到rlat和rlon变量中的坐标。 要旋转坐标,您可以使用:Cordex RotationCORDEX Data Extractor https://agrimetsoft.com/Cordex%20Coordinate%20Rotation.aspx https://agrimetsoft.com/CordexDataExtractor.aspx

在你获得旋转坐标后,你可以使用任何软件或编程,如CDO,Matlab,NCL,R,Netcdf-Extractor