From 251c83deea2c6c593b1ae091fbda152a825ec6c0 Mon Sep 17 00:00:00 2001 From: addelany Date: Fri, 10 May 2024 13:13:26 -0500 Subject: [PATCH] update bbox method --- R/build_forecast_scores.R | 6 ++---- R/build_model.R | 6 +----- R/get_bbox.R | 8 -------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/R/build_forecast_scores.R b/R/build_forecast_scores.R index bc9d4ae..b7af5fa 100644 --- a/R/build_forecast_scores.R +++ b/R/build_forecast_scores.R @@ -33,6 +33,7 @@ build_forecast_scores <- function(table_schema, link_items, thumbnail_link, thumbnail_title, + group_sites, model_child ){ @@ -146,10 +147,7 @@ build_forecast_scores <- function(table_schema, "title" = theme_title, "extent" = list( "spatial" = list( - 'bbox' = list(list(as.numeric(catalog_config$bbox$min_lon), - as.numeric(catalog_config$bbox$min_lat), - as.numeric(catalog_config$bbox$max_lon), - as.numeric(catalog_config$bbox$max_lat)))), + 'bbox' = stac4cast::get_bbox(site_metadata = catalog_config$site_metadata_url, sites = group_sites)), "temporal" = list( 'interval' = list(list( paste0(start_date,"T00:00:00Z"), diff --git a/R/build_model.R b/R/build_model.R index a306d37..c87812a 100644 --- a/R/build_model.R +++ b/R/build_model.R @@ -61,11 +61,7 @@ build_model <- function(model_id, "stac_extensions"= list('https://stac-extensions.github.io/table/v1.2.0/schema.json'), "type"= "Feature", "id"= model_id, - "bbox"= - list(list(as.numeric(catalog_config$bbox$min_lon), - as.numeric(catalog_config$bbox$max_lat), - as.numeric(catalog_config$bbox$max_lon), - as.numeric(catalog_config$bbox$max_lat))), + "bbox"= stac4cast::get_bbox(site_metadata = site_table, sites = site_values), "geometry"= list( "type"= catalog_config$site_type, "coordinates"= stac4cast::get_site_coords(site_metadata = site_table, sites = site_values) diff --git a/R/get_bbox.R b/R/get_bbox.R index 423799f..fd3835e 100644 --- a/R/get_bbox.R +++ b/R/get_bbox.R @@ -12,14 +12,6 @@ get_bbox <-function(site_metadata, sites){ if (!is.null(sites)){ - # site_lat <- site_df |> - # filter(field_site_id %in% (sites)) |> - # select(latitude) - # - # site_lon <- site_df |> - # filter(field_site_id %in% (sites)) |> - # select(longitude) - if ('site_id' %in% names(site_df) == FALSE){ site_df <- site_df |> rename(site_id = field_site_id) ## rename the neon site_id column