如何从 R 中的 netcdf 文件中提取降水数据?

how to extract precipitation data from netcdf file in R?

我正在尝试从从 cordex 气候模型下载的 netcdf 文件中提取降水数据。我应用了以下代码:

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]) 

我得到了这个数据:

这里,我的需求是获取行号为1826的数据。

我在此处上传了 20 MB 大小的 nc 文件:

https://easyupload.io/ch55ic

该数组由 1826 个矩阵组成,每个矩阵有 106 行和 103 列。

data_v1[,,1826]

应该提取您要查找的矩阵。请参阅 Grouping functions (tapply, by, aggregate) and the *apply family,了解一些处理数组的有用函数的简要概述。