View source: R/predict_ptf_raster.R
predict.ptf.raster | R Documentation |
Wrapper for running any of the European hydraulic PTFs based on the European HYdropedological Data Inventory enclosed in package euptf on a stack of raster layers (RasterStack.)
predict.ptf(dataStack, PTF, filename, format="GTiff", overwrite = !file.exists(filename), transfo=NULL)
dataStack |
RasterStack containing layers with the predictors. The predictors referred to in PTF must be present as named layers in dataStack. To get the correct names, follow example: data(ptf.data). //
Layers containing the categorical variables TEXT_FAO_MOD, TEXT_US, TOPSOIL should use the numbered coding as given in |
PTF |
Name of the PTF to be run, as a character. Any of ("PTF01","PTF02",...,"PTF15"). |
filename |
Output filename. Character |
format |
Output file format. Character. See |
overwrite |
Should existing "filename" be overwritten? Logical. Defaults to FALSE. |
transfo |
List of transformations to operate on the predictors before running the PTFs, e.g. list(PH_H2O='/10',BD='/1000'). For details on the units required by the PTFs, see |
A RasterLayer
or RasterBrick
object.
The pedotransfer functions in this package use the following units:
Length: | centimeter |
Time: | day |
Mass: | gram |
M. Weynants
ptf.data,
ChoosePTF
, raster:raster
, raster:RasterStack
# load example data data(ptf.data) # set modified FAO texture class ptf.data$TEXT_FAO_MOD <- psd2classFAO_MOD(ptf.data$USSAND,ptf.data$USSILT,ptf.data$USCLAY,ptf.data$OC,option=FALSE) # set USDA texture class ptf.data$TEXT_US <- psd2classUS(ptf.data$USSAND,ptf.data$USSILT,ptf.data$USCLAY,ptf.data$OC,option=FALSE) # reset TOPSOIL to numeric ptf.data$TOPSOIL <- as.numeric(ptf.data$TOPSOIL)-1;ptf.data$TOPSOIL[ptf.data$TOPSOIL==0]<-2 # create a RasterStack s <- brick(ncol=10,nrow=10,nl=ncol(ptf.data)) ind <- sort(sample(1:100,60)) m <- matrix(NA,ncol=ncol(ptf.data),nrow=ncell(s)) m[ind,] <- as.matrix(ptf.data,ncol=ncol(ptf.data)) s <- stack(setValues(s, as.numeric(m))) names(s) <- names(ptf.data) # examples of usage of predict.ptf.raster ths_fao <- predict.ptf.raster(s,"PTF01",filename='tmp1.tif') fc_usda <- predict.ptf.raster(s,"PTF07",filename='tmp2.tif') wp_psd_OC <- predict.ptf.raster(s,"PTF10",filename='tmp3.tif') ### Parameters estimation of Mualem-van Genuchten model ## if only MRC is needed # get van Genuchten parameters vg_psd_oc_bd_ph <- predict.ptf.raster(s,"PTF22",filename='tmp4.tif') ## if both MRC and HCC are needed # get Mualem-van Genuchten parameters mv_psd_oc_bd_ph <- predict.ptf.raster(s,"PTF19",filename='tmp5.tif')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.