Tag: r raster

在R中从netCDF中提取时间序列

我在1998年1月1日至1998年12月31date间使用TRMM_3B42_Daily产品创build了这个文件 。 这是我在R中使用的脚本: lon=seq(-91.875,-86.875,by= 0.25) lat=seq(13.875,16.875,by= 0.25) x_dim <- ncdim_def( "lon", "degrees_east", lon, create_dimvar=TRUE) y_dim <- ncdim_def( "lat", "degrees_north", lat, create_dimvar=TRUE) t_dim <- ncdim_def( "time", "days since 1997-12-31 12:00:00.0 -0:00", 1:365, unlim=FALSE) mv=9999.900390625 precipitation_var <- ncvar_def("precipitation", "mm", list(y_dim,x_dim,t_dim), mv) nrow = 13 ncol = 21 NA.matrix=matrix(rep(NA,nrow*ncol)) precip=array(NA.matrix,c(nrow,ncol, 1)) for (i in 1:length(test01)){precip_nc=nc_open(test01[i]) precip_get_nc=ncvar_get(precip_nc,"precipitation") precip=abind(precip,precip_get_nc)} precip=precip[,,-1] […]