Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid cell sizes are different - but should be the same? #68

Open
johnForne opened this issue Feb 1, 2024 · 0 comments
Open

Grid cell sizes are different - but should be the same? #68

johnForne opened this issue Feb 1, 2024 · 0 comments

Comments

@johnForne
Copy link

Kia ora

We using the awesome dggridR grids in Environmental Reporting in Aotearoa/New Zealand - thanks for your excellent work!

I'm not sure whether this is an issue per se - or more of a question...

I'm looking to describe the grid that we have used (or reporting on Sea Surface Temperature). From https://cran.r-project.org/web/packages/dggridR/vignettes/dggridR.html I understood that

dggridR builds discrete global grids which partition the surface of the Earth into hexagonal, triangular, or diamond cells, all of which have the same size. (There are some minor caveats which are detailed in the vignettes.)

However, I've noticed that the cells in the grid are not the same size. And the differences don't appear to be explained by the fact that

At every resolution, the Icosahedral grids contain 12 pentagonal cells which each have an area exactly 5/6 that of the hexagonal cells.

I've created an example below that is hopefully reproducible below to show the type of variation in grid cell sizes that I'm struggling to explain.

Can you please clarify why grid cell sizes do not have the same area?

Thanks in advance,

John

library(dggridR)
library(rnaturalearth)
library(tidyverse)

ne_countries(returnclass = 'sf') %>%
  filter(name == "New Zealand") %>% 
  st_write("data/poly.shp")

dggs300 <- dgconstruct(area = 300, metric = TRUE, resround='nearest') 

nz_grid_300 <- dgshptogrid(dggs300, "data/poly.shp", cellsize = 0.01) %>% 
  mutate(area_m2= st_area(.) %>% as.numeric())
  
nz_grid_300 %>% 
  mutate(area_m2_n = cut_number(area_m2, 6)) %>%  
  ggplot() + 
  geom_sf(data = nz, linewidth = 2) +
  geom_sf(aes(fill = area_m2_n)) +
  scale_fill_viridis_d(alpha = 0.5)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant