-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Point to the new PortalPredictions, portal-forecasts
Portal-forecasts is a revised version of portalPredictions Portal-forecasts contains forecasts as zipped files
- Loading branch information
1 parent
a35a772
commit 582f1c7
Showing
87 changed files
with
106 additions
and
10,604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: portalcasting | ||
Title: Model and Forecast Portal Rodent Dynamics | ||
Version: 0.60.1 | ||
Version: 0.60.2 | ||
Authors@R: c( | ||
person(c("Juniper", "L."), "Simonis", | ||
email = "[email protected]", role = c("aut", "cre"), | ||
|
@@ -21,7 +21,7 @@ Authors@R: c( | |
comment = c(ORCID = "0000-0001-6728-7745")), | ||
person(c("S. K.", "Morgan"), "Ernest", role = c("aut"), | ||
comment = c(ORCID = "0000-0002-6026-8530"))) | ||
Description: Create a directory, populate it with data, build models, forecast rodent populations, and visualize the results. The user can spin-up a local lightweight sandbox or full-scale production environment from the same code underlying the continuously deployed Portal Predictions Project continuous integration system <https://github.com/weecology/portalpredictions> and website <https://portal.naturecast.org>. | ||
Description: Create a directory, populate it with data, build models, forecast rodent populations, and visualize the results. The user can spin-up a local lightweight sandbox or full-scale production environment from the same code underlying the continuously deployed Portal Predictions Project continuous integration system <https://github.com/weecology/portal-forecasts> and website <https://portal.naturecast.org>. | ||
URL: https://weecology.github.io/portalcasting/, https://github.com/weecology/portalcasting | ||
BugReports: https://github.com/weecology/portalcasting/issues | ||
Depends: | ||
|
@@ -48,7 +48,8 @@ Imports: | |
shiny, | ||
stats, | ||
viridis, | ||
yaml | ||
yaml, | ||
zip | ||
Suggests: | ||
pkgdown, | ||
testthat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#' unZip and zip forecasts by forecast date | ||
#' | ||
#' @param type either zip or unzip | ||
#' | ||
#' @export | ||
#' | ||
zip_unzip <- function(type=NULL, forecast_path="forecasts/", date=NULL){ | ||
print("Preparing forecasts files") | ||
proj_path <- forecast_path | ||
forecasts_metadata = paste0(proj_path, "forecasts_metadata.csv") | ||
metadata <- read.csv(forecasts_metadata) | ||
unique_dates <- unique(metadata$forecast_date) | ||
unique_dates = sort(unique_dates) | ||
|
||
if (type=="zip"){ | ||
csv_file <- "_forecast_table.csv" | ||
yaml_file <- "_metadata.yaml" | ||
json_file <- "_model_forecast.json" | ||
if (!is.null(date)) { | ||
unique_dates = c(date) | ||
print(paste0("Zipping forecasts files for ", date)) | ||
} | ||
for (forecast_day in unique_dates){ | ||
id_date_files <- c() | ||
zipfile <- paste0(proj_path, "forecast_id_", forecast_day, ".zip") | ||
# Get all the values of that particular day in a data frame | ||
newdata <- subset(metadata, forecast_date == forecast_day, select=c(forecast_id, forecast_date)) | ||
# for each forecast_id get 3 files | ||
All_ids <- newdata$forecast_id | ||
for (id in All_ids){ | ||
csv_file_path = paste0(proj_path, "forecast_id_", id, csv_file) | ||
yaml_file_path = paste0(proj_path, "forecast_id_", id, yaml_file) | ||
json_file_path = paste0(proj_path, "forecast_id_", id, json_file) | ||
id_date_files <- c(id_date_files, csv_file_path, yaml_file_path, json_file_path) | ||
} | ||
# First remove old zip file if exists | ||
unlink(zipfile) | ||
# zip all id_date_files | ||
zipr(zipfile, id_date_files, compression_level = 9) | ||
unlink(id_date_files) | ||
} | ||
} | ||
|
||
if (type=="unzip"){ | ||
print("Unzipping forecasts files") | ||
# unzip files basing on unique_dates | ||
for (forecast_day in unique_dates){ | ||
zipfile <- paste0(proj_path, "forecast_id_", forecast_day, ".zip") | ||
if(file.exists(zipfile)){ | ||
unzip(zipfile, exdir = proj_path) | ||
unlink(zipfile) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.