-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
empirische berekening winFun voor vwf functie
- Loading branch information
1 parent
1deaa5b
commit 5a16619
Showing
5 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PROJCS["Belge_Lambert_1972",GEOGCS["GCS_Belge_1972",DATUM["D_Belge_1972",SPHEROID["International_1924",6378388.0,297.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",150000.013],PARAMETER["False_Northing",5400088.438],PARAMETER["Central_Meridian",4.36748666666667],PARAMETER["Standard_Parallel_1",51.1666672333333],PARAMETER["Standard_Parallel_2",49.8333339],PARAMETER["Latitude_Of_Origin",90.0],UNIT["Meter",1.0]] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
--- | ||
title: "calibration winFun" | ||
author: "Stien Heremans" | ||
date: "2025-01-20" | ||
output: html_document | ||
--- | ||
|
||
```{r} | ||
library(sf) # For spatial vector data | ||
library(raster) # For CHM (raster data) | ||
crowns <- st_read("../data/Kruinen referentie/kruinen_Dilsen1.shp") | ||
chm <- raster("../output/CHM/chm_rescaled Dilsen 1.tif") | ||
crowns <- st_transform(crowns, crs = crs(chm)) | ||
``` | ||
|
||
```{r} | ||
library(exactextractr) # For extracting raster values by polygons | ||
crowns$area <- st_area(crowns) | ||
crowns$radius <- sqrt(as.numeric(crowns$area) / pi) | ||
crowns$height_75 <- exact_extract(chm, crowns, function(values, coverage_fraction) { | ||
quantile(values, probs = 0.75, na.rm = TRUE) | ||
}) | ||
crowns$max_height <- exact_extract(chm, crowns, function(values, coverage_fraction) { | ||
max(values, na.rm = TRUE) | ||
}) | ||
crowns$average_height <- exact_extract(chm, crowns, function(values, coverage_fraction) { | ||
mean(values, na.rm = TRUE) | ||
}) | ||
``` | ||
|
||
|
||
```{r} | ||
head(crowns) | ||
``` | ||
```{r} | ||
# Remove rows with missing values | ||
crowns <- crowns[!is.na(crowns$radius) & !is.na(crowns$height_75), ] | ||
``` | ||
|
||
|
||
```{r} | ||
library(ggplot2) | ||
p1 <- ggplot(crowns, aes(x = height_75, y = radius)) + | ||
geom_point() + | ||
geom_smooth(method = "lm", se = FALSE, color = "blue") + | ||
theme_minimal() + | ||
labs(title = "Radius vs Height", | ||
x = "Crown Height (75th Percentile)", | ||
y = "Crown Radius (m)") | ||
p1 | ||
``` | ||
|
||
```{r} | ||
# Fit the model | ||
model_75height <- lm(radius ~ height_75, data = crowns) | ||
# Summarize the model | ||
summary(model_75height) | ||
``` | ||
|
||
|
||
```{r} | ||
# Remove rows with missing values | ||
crowns <- crowns[!is.na(crowns$radius) & !is.na(crowns$max_height), ] | ||
``` | ||
|
||
|
||
```{r} | ||
library(ggplot2) | ||
p1 <- ggplot(crowns, aes(x = max_height, y = radius)) + | ||
geom_point() + | ||
geom_smooth(method = "lm", se = FALSE, color = "blue") + | ||
theme_minimal() + | ||
labs(title = "Radius vs Height", | ||
x = "Crown Height (max)", | ||
y = "Crown Radius (m)") | ||
p1 | ||
``` | ||
|
||
```{r} | ||
# Fit the model | ||
model_maxheight <- lm(radius ~ max_height, data = crowns) | ||
# Summarize the model | ||
summary(model_maxheight) | ||
``` | ||
|
||
|
||
|
||
```{r} | ||
# Remove rows with missing values | ||
crowns <- crowns[!is.na(crowns$radius) & !is.na(crowns$average_height), ] | ||
``` | ||
|
||
|
||
```{r} | ||
library(ggplot2) | ||
p1 <- ggplot(crowns, aes(x = average_height, y = radius)) + | ||
geom_point() + | ||
geom_smooth(method = "lm", se = FALSE, color = "blue") + | ||
theme_minimal() + | ||
labs(title = "Radius vs Height", | ||
x = "Crown Height (average)", | ||
y = "Crown Radius (m)") | ||
p1 | ||
``` | ||
|
||
```{r} | ||
# Fit the model | ||
model_75height <- lm(radius ~ average_height, data = crowns) | ||
# Summarize the model | ||
summary(model_75height) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters