Skip to content

Commit

Permalink
Merge pull request #1 from b-cubed-eu/debug-process-cube
Browse files Browse the repository at this point in the history
try out gcube processing
  • Loading branch information
wlangera authored Jul 9, 2024
2 parents 1539feb + 0e6df56 commit 93e8ce0
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions source/gcube_integration_for_b3gbi.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ polygon <- st_polygon(list(cbind(c(5, 10, 8, 2, 3, 5), c(2, 1, 7, 9, 5, 2))))
# Simulate occurrences within polygon
occurrences_df <- simulate_occurrences(
plgn = polygon,
n_time_points = 4,
seed = 123)
# Detect occurrences
Expand Down Expand Up @@ -122,22 +123,13 @@ occurrence_cube_df <- grid_designation(
grid = grid_df,
seed = 123)
# Get sampled points within uncertainty circle
sampled_points <- grid_designation(
observations = observations_df,
grid = grid_df,
aggregate = FALSE,
seed = 123)
# Visualise grid designation
ggplot() +
geom_sf(data = occurrence_cube_df, linewidth = 1) +
geom_sf_text(data = occurrence_cube_df, aes(label = n)) +
geom_sf(data = buffered_observations,
fill = alpha("firebrick", 0.3)) +
geom_sf(data = sampled_points, colour = "blue") +
geom_sf(data = observations_df, colour = "firebrick") +
labs(x = "", y = "", fill = "n") +
facet_wrap(~time_point) +
labs(x = "", y = "", fill = "n",
title = "Data cube for 1 species over multiple time points") +
theme_minimal()
```

Expand Down Expand Up @@ -168,4 +160,6 @@ gcube_data <- process_cube(
)
```

> You can only choose specific grid types. But why is this necessary? You can calculate indicators on this either way and you can visualise if you do not drop the geometry.
> Should be able to use a custom grid_type with forced grid code. Now metadata is wrong.
> This code does not work if you have only 1 time point.

0 comments on commit 93e8ce0

Please sign in to comment.