if (FALSE) {
require(IceSat2R)
require(magrittr)
#........................................
# 1st. Option: Select an AOI from the map
#........................................
init = select_aoi_global_grid$new(area_of_interest = NULL,
verbose = TRUE)
init$draw_edit_aoi()
sf_obj = init$selected_areas_global_grid(plot_data = TRUE)
sf_obj
#...............................................
# observe the available countries and continents
# using the 'rnaturalearth' R package
#...............................................
cntr_cnt = rnaturalearth::ne_countries(scale = 110,
type = 'countries',
returnclass = 'sf')
cntr_cnt = cntr_cnt[, c('sovereignt', 'continent')]
# sort(cntr_cnt$sovereignt)
# sort(unique(cntr_cnt$continent))
#.......................................
# 2nd. Option: Select a 'country' as AOI (5-degrees query)
#.......................................
init = select_aoi_global_grid$new(area_of_interest = 'Antarctica',
verbose = TRUE)
init$draw_edit_aoi(degrees = 5.0, square_geoms = TRUE)
sf_obj = init$selected_areas_global_grid(plot_data = TRUE)
sf_obj
#.........................................
# 3rd. Option: Select a 'continent' as AOI (1-degree query)
#.........................................
init = select_aoi_global_grid$new(area_of_interest = 'North America',
verbose = TRUE)
init$draw_edit_aoi(degrees = 1.0, square_geoms = TRUE)
sf_obj = init$selected_areas_global_grid(plot_data = TRUE)
sf_obj
#.........................................
# 4th. Option: Use a bounding box as input ('Greenland Ice Sheet')
#.........................................
data(ne_10m_glaciated_areas)
dat_bbx = ne_10m_glaciated_areas %>%
subset(!is.na(name)) %>%
subset(name == "Greenland Ice Sheet") %>%
sf::st_bbox(crs = 4326)
dat_bbx
init = select_aoi_global_grid$new(area_of_interest = dat_bbx,
verbose = TRUE)
init$draw_edit_aoi(degrees = 1.0, square_geoms = TRUE)
sf_obj = init$selected_areas_global_grid(plot_data = TRUE)
sf_obj
#......................................................
# 5th. Option: Create a global hexagonal 5-degrees grid
#......................................................
bbx_global = c(xmin = -180, xmax = 180, ymin = -90, ymax = 90)
init = select_aoi_global_grid$new(area_of_interest = bbx_global,
verbose = TRUE)
init$draw_edit_aoi(degrees = 5.0, square_geoms = FALSE)
sf_obj = init$selected_areas_global_grid(plot_data = TRUE)
sf_obj
}
Run the code above in your browser using DataLab