Skip to content

Commit

Permalink
Revert to old parameters
Browse files Browse the repository at this point in the history
Keep parameter name as portalPredictions
  • Loading branch information
henrykironde committed Nov 20, 2023
1 parent 582f1c7 commit 769e3fa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ testing_dir/*
/Meta/
inst/app/models.knit.md
*.DS_Store*
.Rproj.user
48 changes: 24 additions & 24 deletions R/settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#'
#' @param PortalData `list` of `source` and `version` elements of `character` values for the Portal Data download. Default values retrieve the latest data from github
#'
#' @param portal-forecasts `list` of `source` and `version` elements of `character` values for the archive download. Default values point to github, but `verison = NULL` indicates no download.
#' @param portalPredictions `list` of `source` and `version` elements of `character` values for the archive download. Default values point to github, but `verison = NULL` indicates no download.
#'
#' @param climate_forecasts `list` of `source`, `version`, and `data` elements of `character` values for the climate forecasts download. Default values retrieve the current day's forecast of min, mean, and max temperature and precipitation from the Northwest Knowledge Network's North American Multi-Model Ensemble (NMME) climate forecasts.
#'
Expand All @@ -69,7 +69,7 @@
#'
#' @param force `logical` indicator of whether or not existing files or folders (such as the archive) should be over-written if an up-to-date copy exists (most users should leave as `FALSE`).
#'
#' @param unzip_pause Positive `integer` or integer `numeric` seconds for pausing during steps around unzipping that require time delay.
#' @param unzip_pause Positive `integer` or integer `numeric` seconds for pausing during steps around unzipping that require time delay.
#'
#' @param download_timeout Positive `integer` or integer `numeric` seconds for timeout on downloads. Temporarily overrides the `"timeout"` option in [`base::options`].
#'
Expand All @@ -79,8 +79,8 @@
#'
#' @param timeseries_start `Date` after which historic samples are included in the timeseries fit. Default value is `1995-01-01`, corresponding to moon 217.
#'
#' @param lead_time `integer` (or integer `numeric`) value for the number of calendar days forward a forecast will cover. \cr
#' As of version 0.51.0, default is now `365`, which when divided by 29.5 (duration of a lunar month), gives 13. The previous value was previously 12. We are now using 13 to align with the timestep being a lunar month, and 13 lunar months covers a full calendar year.
#' @param lead_time `integer` (or integer `numeric`) value for the number of calendar days forward a forecast will cover. \cr
#' As of version 0.51.0, default is now `365`, which when divided by 29.5 (duration of a lunar month), gives 13. The previous value was previously 12. We are now using 13 to align with the timestep being a lunar month, and 13 lunar months covers a full calendar year.
#'
#' @param max_lag `integer` (or integer `numeric`) maximum number of calendar days that any covariate is lagged for prediction in a model. \cr
#' Default is `365` for the logistic covariate models.
Expand All @@ -89,11 +89,11 @@
#' Default value of `60` corresponds to two additional lunar months.
#'
#' @param lead_time_buffer `integer` (or integer `numeric`) additional number of calendar days forward in time to forecast. \cr
#' Default value of `30` corresponds to one additional lunar month.
#' Default value of `30` corresponds to one additional lunar month.
#'
#' @param confidence_level `numeric` confidence level used in summarizing model output. Must be between `0` and `1`.
#'
#' @param nsamples `integer` (or integer `numeric`) number of samples used to summarizing model output of sample-based estimates.
#' @param nsamples `integer` (or integer `numeric`) number of samples used to summarizing model output of sample-based estimates.
#'
#' @return Named `list` of settings for the directory (for `directory_settings`) or `list` of settings components (for `directory_files`, `directory_subdirectories`, and `directory_resources`).
#'
Expand Down Expand Up @@ -125,8 +125,8 @@ directory_settings <- function (files = directory_files( ),
confidence_level = 0.95,
nsamples = 1e4,
save = TRUE,
overwrite = TRUE,
force = FALSE,
overwrite = TRUE,
force = FALSE,
unzip_pause = 30,
download_timeout = getOption("timeout")) {

Expand All @@ -137,9 +137,9 @@ directory_settings <- function (files = directory_files( ),
confidence_level = confidence_level,
nsamples = nsamples,
time = time,
save = save,
force = force,
overwrite = overwrite,
save = save,
force = force,
overwrite = overwrite,
unzip_pause = unzip_pause,
download_timeout = download_timeout)

Expand All @@ -149,7 +149,7 @@ directory_settings <- function (files = directory_files( ),
#'
#' @export
#'
time_settings <- function (timeseries_start = as.Date("1995-01-01"),
time_settings <- function (timeseries_start = as.Date("1995-01-01"),
origin = Sys.Date( ),
forecast_date = Sys.Date( ),
lead_time = 365,
Expand All @@ -158,7 +158,7 @@ time_settings <- function (timeseries_start = as.Date("1995-01-01"),
lead_time_buffer = 30) {


timeseries_start_lagged <- timeseries_start - max_lag - lag_buffer
timeseries_start_lagged <- timeseries_start - max_lag - lag_buffer
forecast_start <- origin + 1
forecast_end <- origin + lead_time
forecast_end_buffered <- origin + lead_time + lead_time_buffer
Expand All @@ -185,7 +185,7 @@ directory_files <- function (directory_configuration = "directory_configuration.
app = "app.R",
newmoons = "newmoons.csv",
covariates = "covariates.csv",
datasets_controls = "datasets_controls.yaml",
datasets_controls = "datasets_controls.yaml",
models_controls = "models_controls.yaml",
forecasts_evaluations = "forecasts_evaluations.csv",
forecasts_results = "forecasts_results.csv",
Expand All @@ -202,7 +202,7 @@ directory_files <- function (directory_configuration = "directory_configuration.
app = app,
newmoons = newmoons,
covariates = covariates,
datasets_controls = datasets_controls,
datasets_controls = datasets_controls,
models_controls = models_controls,
forecasts_evaluations = forecasts_evaluations,
forecasts_results = forecasts_results,
Expand All @@ -229,11 +229,11 @@ directory_subdirectories <- function (forecasts = "forecasts",
data = "data",
www = "www") {

list(forecasts = forecasts,
fits = fits,
models = models,
resources = resources,
data = data,
list(forecasts = forecasts,
fits = fits,
models = models,
resources = resources,
data = data,
www = www)

}
Expand All @@ -244,7 +244,7 @@ directory_subdirectories <- function (forecasts = "forecasts",
#'
directory_resources <- function (PortalData = list(source = "github",
version = "latest"),
portal-forecasts = list(source = "github",
portalPredictions = list(source = "github",
version = NULL),
climate_forecasts = list(source = "NMME",
version = as.character(Sys.Date()),
Expand All @@ -254,7 +254,7 @@ directory_resources <- function (PortalData = list(source = "github",
precipitation = "pr"))) {

list(PortalData = PortalData,
portal-forecasts = portal-forecasts,
portalPredictions = portalPredictions,
climate_forecasts = climate_forecasts)

}
Expand All @@ -266,7 +266,7 @@ directory_resources <- function (PortalData = list(source = "github",
#'
production_settings <- function (download_timeout = max(getOption("timeout"), 600)) {

resources <- directory_resources(portal-forecasts = list(source = "github",
resources <- directory_resources(portalPredictions = list(source = "github",
version = "latest"))

directory_settings(resources = resources,
Expand All @@ -279,7 +279,7 @@ production_settings <- function (download_timeout = max(getOption("timeout"), 6
#'
#' @export
#'
sandbox_settings <- function ( ) {
sandbox_settings <- function () {

directory_settings( )

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ install.packages("remotes")
remotes::install_github("weecology/portalcasting")
```

You will need to install `rjags` and JAGS.

MacOS users are recommended to install rjags after reading the instructions on the package's README file, or use the JAGS discussion forum thread for help under the [MacOS installation of JAGS](https://sourceforge.net/p/mcmc-jags/discussion/search/?q=MacOS+installation&project=0).


```r
install.packages("rjags", configure.args="--enable-rpath")
```

## Production environment

If you wish to spin up a local container from the `latest` `portalcasting` image (to ensure that you are using a copy of the current production environment for implementation of the `portalcasting` pipeline), you can run
Expand Down

0 comments on commit 769e3fa

Please sign in to comment.