Description References Examples
The LandClimTools package contains several useful functions for working with the LandClim software
Website at ETH Zurich giving an introduction to LandClim:
https://www1.ethz.ch/fe/research/disturbance/landclim
Website about the LandClim software:
https://uwis-server102.ethz.ch/openaccess/software/view/2
Style guide for R packages by Hadley Wickham:
http://r-pkgs.had.co.nz/style.html
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ###############################################################
### Create and write LandClim maps ####
require(raster)
gk_projection<-CRS("+init=epsg:31467")
nr <-50
nc <- 50
res <- 40
ex <- extent(0, nc*res, 0, nr*res)
dem <- raster(nrows=nr, ncols=nc, ex)
projection(dem) <- gk_projection
dem
dem[] <- rep(seq(400, 2200,len=nr), each=nc)
x11()
plot(dem)
### Create LandClim map "slope".
slope <- dem
slope[]<- 0
### LandClim map "soil".
soil <- dem
soil[] <- 20
soil ### Check min, max values
### LandClim map "landtype".
landtype <- slope
landtype[] <- 1
### Aspect
aspect <- slope
aspect[] <- 0
### LandClim map "nitrogen".
nitro <- slope
nitro[] <- 1
### Create raster-stack
maps <- stack(dem, slope, aspect, soil, landtype, nitro)
names(maps) <- c("dem", "slope", "aspect", "soil", "landtype", "nitro")
x11()
plot(maps)
maps25 <- resample_landclim_maps(landClimRasterStack=maps)
res(maps25$dem)
### Write as LandClim files.
write_landclim_maps(landClimRasterStack=maps25, nodata_value="-9999", lcResolution=25)
################################################################### Plot LandClim output ####
### Elevation gradient
dat <- read.table(system.file("elevation_biomass_out.csv", package = "LandClimTools"), sep=",", dec=".", header=TRUE)
species <- c("abiealba" , "piceabie", "fagusylv", "pinusilv", "querpetr")
x11()
plot_elevation_gradient(elevationBiomassOut=dat, species=species, selection=30, lty=1, cols= rainbow(length(species)))
### LandClim forest
trees <- tree_coordinates(file=system.file("fullOut_50.csv", package = "LandClimTools"), a=25)
stand <- trees[trees$row > 20 & trees$row <=40,]
stand$row <- stand$row - min(stand$row)
stand <- trees[trees$col > 20 & trees$col <=40,]
stand$col <- stand$col - min(stand$col)
x11(width=7, height=7)
par(mar=c(2,2,1,1))
plot_forest(trees=stand, species=unique(stand$species), scol=rainbow(length(unique(stand$species))), plotlegend=TRUE, aspect=1, cex=sqrt(stand$biomass)/2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.