简体   繁体   English

使用R netcdf4进行数据提取

[英]Using R netcdf4 data extraction

I am facing problem to extract data for a region latitude 25 to 32, longitude 81 to 98 from a netcdf4 file sund_WAS-44_ICHEC-EC-EARTH_rcp26_r12i1p1_SMHI-RCA4_v2_day_20510101-20551231.nc . 我面临着从netcdf4文件sund_WAS-44_ICHEC-EC-EARTH_rcp26_r12i1p1_SMHI-RCA4_v2_day_20510101-20551231.nc提取区域latitude 25 to 32, longitude 81 to 98的数据的sund_WAS-44_ICHEC-EC-EARTH_rcp26_r12i1p1_SMHI-RCA4_v2_day_20510101-20551231.nc

The lat and lon value are in a matrix of 193*130. 纬度和经度值位于193 * 130的矩阵中。 I am using R for my purpose. 我正在出于我的目的使用R。 I want to run a loop so that it will give all the values of sund(1826) for each lat,lon . 我想运行一个循环,以便为每个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: 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/"

跨经/ ncks带提取的最简单方法是使用NCO的nckshttp : ncks

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

your data are cordex data in WAS domain. 您的数据是WAS域中的cordex数据。 You should convert your regular coordinate to rotated coordinate and after you can find your coordinate in rlat and rlon variables in nc file. 您应该将常规坐标转换为旋转坐标,然后才能在nc文件的rlat和rlon变量中找到坐标。 for rotation of your coordinate you can use: Cordex Rotation Or CORDEX Data Extractor https://agrimetsoft.com/Cordex%20Coordinate%20Rotation.aspx https://agrimetsoft.com/CordexDataExtractor.aspx 要旋转坐标,可以使用: Cordex旋转CORDEX数据提取器 https://agrimetsoft.com/Cordex%20Coordinate%20Rotation.aspx https://agrimetsoft.com/CordexDataExtractor.aspx

and after you get rotated coordinate you can use any software or programming such as CDO, Matlab, NCL, R, Netcdf-Extractor 旋转坐标后,您可以使用任何软件或程序,例如CDO,Matlab,NCL,R,Netcdf-Extractor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM