2015-04-28 37 views
0

我面臨的問題是從netcdf4文件sund_WAS-44_ICHEC-EC-EARTH_rcp26_r12i1p1_SMHI-RCA4_v2_day_20510101-20551231.nc中提取區域latitude 25 to 32, longitude 81 to 98的數據。使用R netcdf4數據提取

經度和緯度值的矩陣爲193 * 130。我使用R來達到我的目的。我想運行一個循環,以便爲每個lat,lon提供sund(1826)的所有值。

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: [email protected]" 
    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/" 

回答

0

跨經/緯度帶中提取最簡單的方法是使用ncks從NCO:http://nco.sourceforge.net/nco.html

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

非常感謝。它像一個冠軍:D –