Я хочу прочитать два файла netcdf (климатические данные в течение двух лет) и объединить данные одной сетки (lon [15] и lat [15]) в массив (с именем prec_year), сценарий ниже.ошибка при указании латентного измерения при чтении файлов Netcdf
я получил ошибку:
"Error in R_nc_get_vara_double: NetCDF: Index exceeds dimension bound
Var: precip Ndims: 3 Start: 0,4294967284,59Count: 366,1,1Error in get.var.ncdf (ex.nc, "precip", start = c(lon[1], lat[15], 1), :
функция C R_nc_get_vara_double возвратил ошибку "
Но когда я не указать Lat [], например, сказать," начать = с (долгота [1], 1, Пожалуйста, помогите (1) Почему я получил эту ошибку и (2) как ее исправить?
Огромное спасибо! ------------- -------
setwd ("D://Historic Climate data/Aphrodyte/Prec_025/join 2 years")
Prec_origin <- c(1:2)
filenames <- list.files(pattern = NULL, all.files = FALSE)
for(i in filenames){
filepath <- file.path("D://Historic Climate data/Aphrodyte/Prec_025/join 2 years/",paste (i,sep=""))
ex.nc = open.ncdf (filepath, readunlim=FALSE)
lon = get.var.ncdf(ex.nc, "longitude") # coordinate variable
lat = get.var.ncdf(ex.nc, "latitude") # coordinate variable
day = get.var.ncdf(ex.nc, "time") # time variable
#change lon[x] and lat[y] to select different files/locations for comparison
prec_year = get.var.ncdf(ex.nc, "precip", start = c(lon[1],lat[15],1), count = c(1,1,-1))
Prec_origin <- c(Prec_origin, prec_year) #combine all data into one array
close.ncdf (ex.nc)
}
Prec_origin <- Prec_origin[-(1:2)] # delete first two rows-
--------------
[1] "file D://Historic Climate data/Aphrodyte/Prec_025/join 2 years//APHRO_MA_025deg_V1003R1.1952.nc has 3 dimensions:"
[1] "time Size: 366"
[1] "longitude Size: 360"
[1] "latitude Size: 280"
[1] "------------------------"
[1] "file D://Historic Climate data/Aphrodyte/Prec_025/join 2 years//APHRO_MA_025deg_V1003R1.1952.nc has 2 variables:"
[1] "float precip[longitude,latitude,time] Longname:daily precipitation analysis interpolated onto 0.25deg grids [mm/day] Missval:-99.9000015258789"
[1] "float rstn[longitude,latitude,time] Longname:ratio of 0.05deg-grids with station [%] Missval:-99.9000015258789"
Какой пакет вы используете? Можете ли вы сделать воспроизводимый пример? – vitale232