0

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.

The lat and lon value are in a matrix of 193*130. I am using R for my purpose. I want to run a loop so that it will give all the values of sund(1826) for each 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: [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/"

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.