Description Details Author(s) References Examples
Downscaling the coarse-resolution remote sensing images into fined-resolution images is important for preprocessing. This package provides the functions for this with high accuracy. Currently, the resautonet is used as the deep learning algorithm for downscaling. This work was done based on this paper, Lianfa Li (2019) <doi:10.3390/rs11111378>.
This package provides the downscaling functions for the coarse-resolution remote sensing images. Currently, we used the deep learning algorithm as the base learner in downscaling.
The major functions defined in this package include:
AutoEncoderModel
:The residual network function used in downscaling;
ResautoDownscale
:The major downscaling function that uses AutoEncoderModel
;
r2_squ
:The function calculating R2 ;
rmse
:The function calculate RMSE.
Lianfa Li
Maintainer: Lianfa Li <lspatial@gmail.com>
~~ Literature or other references for background information ~~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #Load the high-resolution raster of a covariate,
# elevation to be used for downscaling
eleFile=file.path(system.file(package = "downscaledl"), "extdata", "sample_ele.tif")
ele=raster::raster(eleFile)
#Load the coarse-resolution raster of the target variable to be downscaled
coarseFile=file.path(system.file(package = "downscaledl"), "extdata", "sample_coarse_res.tif")
coarseRst=raster::raster(coarseFile)
#Extract x and y to be used as two predictors in downscaling
xRast=ele
yRast=ele
pos=raster::rasterToPoints(ele,spatial=TRUE)
cell=raster::cellFromXY(xRast,pos)
xyc=sp::coordinates(pos)
xRast[cell]=xyc[,"x"]
yRast[cell]=xyc[,"y"]
#Merge the covariates
covStk=raster::stack(xRast,yRast,ele)
names(covStk)=c("x","y","ele")
#Use the fine-resolution covariate (elevation) as the target image
fineTarget=ele
#Set the paramneters and start to downscale ...
ares=ResautoDownscale(covStk,fineTarget,coarseRst,ss= 0.2, cores= 5, thresh = 0.01,ntime=3)
#Show the iteration results
message(paste(capture.output(ares$diogRMSE), collapse = "\n",sep=""))
#Show the optimal results in the final predictions
message(paste("test R2:",round(ares$r2,2),",test RMSE:",round(ares$rmse,4),sep=""))
#Obtain the downscaled
downscaled_img=ares$raster
#Save the current par setting
curpar = par(no.readonly = TRUE)
#Set the new par setting
par(mfrow=c(1,2),mar=c(1,1,1,1))
#Show the final predictions of fine resolution and
# original coarse-resolution image for a comparison
raster::plot(coarseRst)
raster::plot(downscaled_img)
#Restore the previous par setting
par(curpar)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.