library(raster)
library(rgdal)
1. 读raster
#band1为NDVI,band2为EVI
imported_raster=raster(filename[f],band=1)
imported_raster
#plot(imported_raster,axes=FALSE)
#imported_matrix<-as.matrix(imported_raster)
#把raster值除以1e4,达到NDVI的正常范围值。
max(values(imported_raster))
min(values(imported_raster))
values(imported_raster)<-values(imported_raster)/1e4
2. 写raster
writeRaster(imported_raster, save_name, format = "HFA")
3. convert matrix to raster
r_ds_025<-raster(
dust_source_r,
xmn=range(lon)[1], xmx=range(lon)[2],
ymn=range(lat)[1], ymx=range(lat)[2],
crs=CRS("+proj=longlat +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +no_defs ")
)
网友评论