generated from HugoBlox/theme-academic-cv
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
118 lines (118 loc) · 4.99 KB
/
.Rhistory
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
data <- readRDS("C:/Users/konst/Documents/master_marburg/Semester_01/Umweltmodelierung/Aufgaben/sapflow_tree_all_cluster_sf.rds")
View(data)
sapflow_tree_all_cluster <- readRDS("C:/Users/konst/Documents/master_marburg/Semester_01/Umweltmodelierung/Aufgaben/sapflow_tree_all_cluster_sf.rds")
View(sapflow_tree_all_cluster)
unique(sapflow_tree_all_cluster$pr_arma)
unique(sapflow_tree_all_cluster$species_mode)
str(sapflow_tree_all_cluster)
sapflow_tree_all_cluster <- readRDS("C:/Users/konst/Documents/master_marburg/Semester_01/Umweltmodelierung/Aufgaben/sapflow_tree_all_cluster_sf.rds")
mean_tree <- sapply(sapflow_tree_all_cluster, mean)
sapflow_tree_all_cluster <- readRDS("C:/Users/konst/Documents/master_marburg/Semester_01/Umweltmodelierung/Aufgaben/sapflow_tree_all_cluster_sf.rds")
mean_tree <- sapply(sapflow_tree_all_cluster, mean)
mean_tree
View(sapflow_tree_all_cluster)
mean_tree <- as.data.fram(sapply(sapflow_tree_all_cluster, mean))
mean_tree <- as.data.frame(sapply(sapflow_tree_all_cluster, mean))
View(mean_tree)
View(mean_tree)
mean_tree
mean_tree$`sapply(sapflow_tree_all_cluster, mean)`
mean_tree
# Create a 10x10 matrix filled with zeros
test_matrix <- matrix(0, nrow=10, ncol=10)
# Add 'river' segments
test_matrix[3, 3:8] <- 1 # Horizontal river segment
test_matrix[3:7, 8] <- 1 # Vertical river segment
# Convert the matrix to a SpatRaster
raster <- rast(test_matrix)
library(terra)
# Create a 10x10 matrix filled with zeros
test_matrix <- matrix(0, nrow=10, ncol=10)
# Add 'river' segments
test_matrix[3, 3:8] <- 1 # Horizontal river segment
test_matrix[3:7, 8] <- 1 # Vertical river segment
# Convert the matrix to a SpatRaster
raster <- rast(test_matrix)
plot(raster)
# Step 1: Identify river pixels
river_indices <- which(values(raster) == 1, arr.ind = TRUE)
river_indices
# Initialize an empty matrix or raster to store indices of the nearest river pixel
nearest_river_index <- matrix(NA, nrow=nrow(raster), ncol=ncol(raster))
nearest_river_index
row <- 1
col <-1
raster_matrix[row, col] == 0
# Convert raster to matrix for easier manipulation
raster_matrix <- matrix(values(raster), nrow=nrow(raster), byrow=TRUE)
raster_matrix
raster_matrix[row, col] == 0
# Calculate distances to all river pixels
distances <- sqrt((river_indices[, "row"] - row)^2 + (river_indices[, "col"] - col)^2)
distances
# Find the index of the nearest river pixel
min_distance_index <- which.min(distances)
# Store the index (or a unique identifier) of the nearest river pixel
nearest_river_index[row, col] <- raster_matrix[nearest_river_pixel["row"], nearest_river_pixel["col"]]
nearest_river_pixel <- river_indices[min_distance_index, ]
nearest_river_pixel
# Store the index (or a unique identifier) of the nearest river pixel
nearest_river_index[row, col] <- raster_matrix[nearest_river_pixel["row"], nearest_river_pixel["col"]]
nearest_river_pixel["row"]
raster_matrix[nearest_river_pixel["row"], nearest_river_pixel["col"]]
raster_matrix
# Step 1: Identify river pixels
river_indices <- which(values(raster) == 1, arr.ind = TRUE)
river_indices
# Step 1: Identify river pixels
river_indices <- which(values(raster) == 1, arr.ind = FALSE)
river_indices
library(tensorflow)
tensorflow::tf_version()
library(terra)
relativ_height <- rast("E:/UNI_Master/GeoAI/full_research_area/relative_heights_testing.tif")
relativ_height[relativ_height < 0] <- 0
library(mapview)
mapview(relativ_height)
plot(relativ_height)
library(sf)
library(sf)
library(sf)
line <- read_sf("C:/Users/konst/Downloads/Wege.shp")
# Segmentize: add vertices every 100m
segmentized_line <- st_segmentize(line, units::set_units(100, "meters"))
# Segmentize: add vertices every 100m
segmentized_line <- st_segmentize(line, units::set_units(300, "meters"))
# Convert line to points
points <- st_cast(segmentized_line, "POINT")
plot(points)
plot(points$geometry)
library(sf)
line <- read_sf("C:/Users/konst/Downloads/Wege.shp")
# Segmentize: add vertices every 100m
segmentized_line <- st_segmentize(line, units::set_units(300, "meters"))
# Convert line to points
points <- st_cast(segmentized_line, "POINT")
# Step 3: Export as Shapefile
st_write(points, "C:/Users/konst/Downloads/Wege_points.shp")
line <- st_transform(line, "25832")
line <- st_transform(line, "EPSG:25832")
# Segmentize: add vertices every 100m
segmentized_line <- st_segmentize(line, units::set_units(300, "meters"))
# Convert line to points
points <- st_cast(segmentized_line, "POINT")
# Step 3: Export as Shapefile
st_write(points, "C:/Users/konst/Downloads/Wege_points.shp")
# Step 3: Export as Shapefile
st_write(points, "C:/Users/konst/Downloads/Wege_points.shp", overwrite = TRUE)
# Step 3: Export as Shapefile
st_write(points, "C:/Users/konst/Downloads/Wege_points.shp", overwrite = TRUE)
# Step 3: Export as Shapefile
st_write(points, "C:/Users/konst/Downloads/Wege_points.shp", overwrite = TRUE)
# Step 3: Export as Shapefile
st_write(points, "C:/Users/konst/Downloads/Wege_points.shp", append =TRUE)
setwd("C:/Users/konst/Documents/master_marburg/Websites/Academic_CV")
library(blogdown)
blogdown::build_site()
blogdown::serve_site()
stop_server()