From 946d5f515b48adcd6e179b97c0421b9c2030b0b7 Mon Sep 17 00:00:00 2001 From: Zwart Date: Tue, 10 Sep 2024 15:19:12 -0700 Subject: [PATCH] update stac functions --- catalog/forecasts/forecast_models.R | 15 ++++++++++++++- catalog/scores/scores_models.R | 15 ++++++++++++++- catalog/summaries/summaries_models.R | 15 ++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/catalog/forecasts/forecast_models.R b/catalog/forecasts/forecast_models.R index f1cf7dfa53..c667455b23 100644 --- a/catalog/forecasts/forecast_models.R +++ b/catalog/forecasts/forecast_models.R @@ -317,6 +317,17 @@ for (i in 1:length(config$variable_groups)){ ## organize variable groups model_keywords <- c(list('Forecasts',config$project_id, names(config$variable_groups)[i], m, var_name_full[j], var_name, duration_value, duration_name), as.list(model_sites$site_id)) + ## build radiantearth stac and raw json link + stac_link <- paste0('https://radiantearth.github.io/stac-browser/#/external/raw.githubusercontent.com/eco4cast/usgsrc4cast-ci/main/catalog/forecasts/', + names(config$variable_groups)[i],'/', + var_formal_name, '/models/', + m,'.json') + + json_link <- paste0('https://raw.githubusercontent.com/eco4cast/usgsrc4cast-ci/main/catalog/forecasts/', + names(config$variable_groups)[i],'/', + var_formal_name, '/models/', + m,'.json') + stac4cast::build_model(model_id = m, stac_id = stac_id, team_name = registered_model_id$`Long name of the model (can include spaces)`[idx], @@ -338,7 +349,9 @@ for (i in 1:length(config$variable_groups)){ ## organize variable groups table_description = forecast_description_create, full_var_df = model_vars, code_web_link = model_code_link, - model_keywords = model_keywords) + model_keywords = model_keywords, + stac_web_link = stac_link, + raw_json_link = json_link) } ## end model loop } ## end duration loop diff --git a/catalog/scores/scores_models.R b/catalog/scores/scores_models.R index bbb5e657a9..908663dd26 100644 --- a/catalog/scores/scores_models.R +++ b/catalog/scores/scores_models.R @@ -311,6 +311,17 @@ for (i in 1:length(config$variable_groups)){ # LOOP OVER VARIABLE GROUPS -- BUIL model_keywords <- c(list('Scores',config$project_id, names(config$variable_groups)[i], m, var_name_full[j], var_name, duration_value, duration_name), as.list(model_sites$site_id)) + ## build radiantearth stac and raw json link + stac_link <- paste0('https://radiantearth.github.io/stac-browser/#/external/raw.githubusercontent.com/eco4cast/usgsrc4cast-ci/main/catalog/scores/', + names(config$variable_groups)[i],'/', + var_formal_name, '/models/', + m,'.json') + + json_link <- paste0('https://raw.githubusercontent.com/eco4cast/usgsrc4cast-ci/main/catalog/scores/', + names(config$variable_groups)[i],'/', + var_formal_name, '/models/', + m,'.json') + stac4cast::build_model(model_id = m, stac_id = stac_id, team_name = registered_model_id$`Long name of the model (can include spaces)`[idx], @@ -331,7 +342,9 @@ for (i in 1:length(config$variable_groups)){ # LOOP OVER VARIABLE GROUPS -- BUIL table_description = scores_description_create, full_var_df = model_vars, code_web_link = model_code_link, - model_keywords = model_keywords) + model_keywords = model_keywords, + stac_web_link = stac_link, + raw_json_link = json_link) } ## end model loop } ## end duration loop diff --git a/catalog/summaries/summaries_models.R b/catalog/summaries/summaries_models.R index 7d6d20185e..1e7ca09b68 100644 --- a/catalog/summaries/summaries_models.R +++ b/catalog/summaries/summaries_models.R @@ -305,6 +305,17 @@ for (i in 1:length(config$variable_groups)){ # LOOP OVER VARIABLE GROUPS -- BUIL model_keywords <- c(list('Summaries',config$project_id, names(config$variable_groups)[i], m, var_name_full[j], var_name, duration_value, duration_name), as.list(model_sites$site_id)) + ## build radiantearth stac and raw json link + stac_link <- paste0('https://radiantearth.github.io/stac-browser/#/external/raw.githubusercontent.com/eco4cast/usgsrc4cast-ci/main/catalog/summaries/', + names(config$variable_groups)[i],'/', + var_formal_name, '/models/', + m,'.json') + + json_link <- paste0('https://raw.githubusercontent.com/eco4cast/usgsrc4cast-ci/main/catalog/summaries/', + names(config$variable_groups)[i],'/', + var_formal_name, '/models/', + m,'.json') + stac4cast::build_model(model_id = m, stac_id = stac_id, team_name = registered_model_id$`Long name of the model (can include spaces)`[idx], @@ -325,7 +336,9 @@ for (i in 1:length(config$variable_groups)){ # LOOP OVER VARIABLE GROUPS -- BUIL table_description = summaries_description_create, full_var_df = model_vars, code_web_link = model_code_link, - model_keywords = model_keywords) + model_keywords = model_keywords, + stac_web_link = stac_link, + raw_json_link = json_link) } ## end model loop