简体   繁体   中英

how to extract precipitation data from netcdf file in R?

I am trying to extract precipitation data from a netcdf file downloaded from the cordex climate model. I applied the following codes:

library(ncdf4)    
v1 <- nc_open('pr_EUR-44_ICHEC-EC-EARTH_rcp45_r12i1p1_SMHI-RCA4_v1_day_20960101-21001231.nc')
data_v1<-ncvar_get(v1,attributes(v1$var)$names[3]) 

I got this data:

在此处输入图像描述

Here, my need is to get the data with row number 1826.

I uploaded the 20 mb size nc file here:

https://easyupload.io/ch55ic

The array consists of 1826 matrices, each with 106 rows and 103 columns.

data_v1[,,1826]

Should extract the matrix you're after. Please refer to Grouping functions (tapply, by, aggregate) and the *apply family , for a concise overview of some useful functions for handling arrays.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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