Skip to content

Commit

Permalink
windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gisma committed Sep 13, 2023
1 parent 1d57639 commit 34c6dc6
Show file tree
Hide file tree
Showing 54 changed files with 15,739 additions and 325 deletions.
23 changes: 16 additions & 7 deletions Machine_Learning_Session/ML_AOA.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ For this tutorial we need the raster package for processing of the satellite dat
```{r start, message=FALSE, warning=FALSE}
rm(list=ls())
#major required packages:
library(devtools)
install_github("HannaMeyer/CAST")
require(devtools)
devtools::install_github("HannaMeyer/CAST")
library(raster)
library(terra)
library(caret)
library(randomForest)
library(twosamples)
library(mapview)
library(sf)
library(CAST)
library(tmap)
library(rprojroot)
# create a string containing the current working directory
wd = paste0(find_rstudio_root_file(),"/Machine_Learning_Session/data/")
```

Expand All @@ -49,7 +58,7 @@ To start with, let's load and explore the remote sensing raster data as well as
### Raster data (predictor variables)

```{r load, message=FALSE,warning=FALSE}
mof_sen <- rast("data/sentinel_uniwald.grd")
mof_sen <- rast(paste0(wd,"sentinel_uniwald.grd"))
print(mof_sen)
```

Expand All @@ -66,14 +75,14 @@ plotRGB(mof_sen,r=3,g=2,b=1,stretch="lin")
The vector file is read as sf object. It contains the training sites that will be regarded here as a ground truth for the land cover classification.

```{r loadPoly}
trainSites <- read_sf("data/trainingsites_LUC.gpkg")
trainSites <- read_sf(paste0(wd,"trainingsites_LUC.gpkg"))
```


Using mapview we can visualize the aerial image channels in the geographical context and overlay it with the polygons. Click on the polygons to see which land cover class is assigned to a respective polygon.

```{r visMV, warning=FALSE, message= FALSE}
mapview(as(mof_sen[[1]],"Raster"), map.types = "Esri.WorldImagery")+
mapview(raster(mof_sen[[1]]), map.types = "Esri.WorldImagery") +
mapview(trainSites)
```

Expand Down Expand Up @@ -177,7 +186,7 @@ model <- ffs(trainDat[,predictors],
metric="Kappa",
trControl=ctrl,
importance=TRUE,
ntree=75,
ntree=200,
verbose=FALSE)
```

Expand Down Expand Up @@ -267,7 +276,7 @@ prediction_LAI <- predict(mof_sen,model_lm,na.rm=T)
plot(prediction_LAI)
limodelpred <- -0.8518+mof_sen$NDVI*6.8433
mapview(as(limodelpred,"Raster"))
mapview(raster(limodelpred))
```


Expand Down
183 changes: 96 additions & 87 deletions docs/Machine_Learning_Session/ML_AOA.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Machine_Learning_Session/ML_AOA_files/figure-html/lm-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 34c6dc6

Please sign in to comment.