diff --git a/.Rbuildignore b/.Rbuildignore index 7f20717..c9a603f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -2,3 +2,5 @@ ^\.Rproj\.user$ ^\.github$ ^data-raw$ +^LICENSE\.md$ +^cran-comments\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index 8bcea80..711a3f0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: BirdFlowExamples -Title: Data package with example BirdFlowR models +Title: Data Package with Example BirdFlowR Models Version: 0.0.1.9001 Authors@R: person("Ethan", "Plunkett", email = "plunkett@umass.edu", @@ -15,10 +15,8 @@ LazyData: true LazyDataCompression: gzip Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 Depends: R (>= 3.5) Imports: Matrix -Remotes: - birdflow-science/BirdFlowR diff --git a/LICENSE b/LICENSE index 531ebfa..4cf7945 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,2 @@ -MIT License - -Copyright (c) 2026 birdflow-science - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +YEAR: 2026 +COPYRIGHT HOLDER: birdflow-science diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..531ebfa --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 birdflow-science + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NEWS.md b/NEWS.md index 1ac3e26..0619856 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,12 @@ +## BirdFlowExamples 0.0.1.9001 +2026-10-22 + +* Renamed package from `BirdFlowModels` to `BirdFlowExamples`. The data + object names (`amewoo`, `rewbla`, `rewbla_observations`, + `rewbla_intervals`, `states`) are unchanged. + +* Refit `amewoo` and `rewbla` and reduced their file size. + ## BirdFlowModels 0.0.2.9003 2025-04-08 diff --git a/R/data.R b/R/data.R index 4336149..07b2fb3 100644 --- a/R/data.R +++ b/R/data.R @@ -1,8 +1,8 @@ # This file documents data -#' @name BirdFlowModels -#' @rdname BirdFlowModels -#' @aliases BirdFlowModels +#' @name BirdFlowExamples +#' @rdname BirdFlowExamples +#' @aliases BirdFlowExamples #' @aliases amewoo #' @aliases rewbla #' @title Birdflow Example Models @@ -12,13 +12,14 @@ #' #' @format `BirdFlow` model #' -#' @source Trained on eBird Status and Trends 2019 and 2021 Data. +#' @source Trained on eBird Status and Trends 2023 Data. #' -#' @references Fink, D., T. Auer, A. Johnston, M. Strimas-Mackey, S. Ligocki, O. -#' Robinson, W. Hochachka, L. Jaromczyk, A. Rodewald, C. Wood, I. Davies, A. -#' Spencer. 2022. eBird Status and Trends, Data Version: 2021; Released: 2022. -#' Cornell Lab of Ornithology, Ithaca, New York. -#' https://doi.org/10.2173/ebirdst.2021 +#' @references Fink, D., T. Auer, A. Johnston, M. Strimas-Mackey, S. Ligocki, O. Robinson, +#' W. Hochachka, L. Jaromczyk, C. Crowley, K. Dunham, A. Stillman, C. Davis, M. Stokowski, +#' P. Sharma, V. Pantoja, D. Burgin, P. Crowe, M. Bell, S. Ray, I. Davies, V. Ruiz-Gutierrez, +#' C. Wood, A. Rodewald. 2024. +#' eBird Status and Trends, Data Version: 2023; +#' Released: 2025. Cornell Lab of Ornithology, Ithaca, New York. https://doi.org/10.2173/WZTW8903 #' @seealso [BirdFlowR::load_model()] will load a vetted model from a #' BirdFlow model collection. `BirdFlowR::load_collection_index()` will #' return a data frame with information on available models. diff --git a/R/states.R b/R/states.R index ce7d680..c5b6be2 100644 --- a/R/states.R +++ b/R/states.R @@ -15,7 +15,7 @@ #' class **data.frame** and has columns: #' \describe{ #' \item{name}{State name} -#' \item{geometry}{Contains polyon information} +#' \item{geometry}{Contains polygon information} #' #' The code below was used to create this object: #' ``` diff --git a/README.md b/README.md index 6cd9b40..17ece3e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# BirdFlowModels +# BirdFlowExamples -[![R-CMD-check](https://github.com/birdflow-science/BirdFlowModels/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/birdflow-science/BirdFlowModels/actions/workflows/R-CMD-check.yaml) +[![R-CMD-check](https://github.com/birdflow-science/BirdFlowExamples/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/birdflow-science/BirdFlowExamples/actions/workflows/R-CMD-check.yaml) This is a "Data" R package that contains a fitted BirdFlow model for use with @@ -26,14 +26,14 @@ the data in the package will change frequently. Use the code below to install from github ```{r} -devtools::install_github("birdflow-science/BirdFlowModels") +devtools::install_github("birdflow-science/BirdFlowExamples") ``` ## Use After loading this package the dataset will be available for use. ```{r} -library(BirdFlowModels) +library(BirdFlowExamples) library(BirdFlowR) print(amewoo) species(amewoo) diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..31a5d2b --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,29 @@ +# CRAN comments + +## Package size + +`R CMD check` reports an installed size of 6.3 MB (`data` subdirectory +6.2 MB), driven by the example `BirdFlow` model objects the package +exists to provide (`amewoo.rda` 3.9 MB, `rewbla.rda` 1.1 MB, plus +`states.rda`, `rewbla_observations.rda`, and `rewbla_intervals.rda` +together under 0.2 MB on disk). This is over the informal 5 MB +guideline for source packages. + +These models and ancillary data are the package's sole purpose: fitted +example models for testing and demonstrating the companion `BirdFlowR` +package. They have already been fit at coarse spatial resolution +(`amewoo` at 150 km, `rewbla` at 350 km) and, for `rewbla`, with heavy +sparsification specifically to minimize size while still exercising the +code paths they are used for (geometry mismatches and season wraparound +in particular). `amewoo`'s resolution was kept finer than `rewbla`'s +because it is also used in `BirdFlowR` vignette figures, where coarser +resolution would visibly degrade example output. + +## Test environments + +* local macOS install, R 4.x +* GitHub Actions: macOS, Windows, Ubuntu (release and devel) + +## R CMD check results + +0 errors | 0 warnings | 0 notes diff --git a/data-raw/DATASET.R b/data-raw/DATASET.R deleted file mode 100644 index 030a0c1..0000000 --- a/data-raw/DATASET.R +++ /dev/null @@ -1,45 +0,0 @@ -# I haven't preserved the full story of this dataset, but am recording code -# to update it here. - - -# Setup - -library(BirdFlowR) - -# 1. amewoo - -# As of 11/21/2022 this was fit with the 2021 version of eBirdst -amewoo_hdf5 <- "../Models/BFModelsSource/amewoo_2021_150km_obs1.0_ent0.001443_dist0.008658_pow0.6.hdf5" -amewoo_rda_file <- "./data/amewoo.rda" - -amewoo <- import_birdflow(amewoo_hdf5) -save(amewoo, file = amewoo_rda_file) - -tools::resaveRdaFiles(amewoo_rda_file) - -tools::checkRdaFiles(amewoo_rda_file)$compress - -rewbla <- BirdFlowModels::rewbla - - -# Add new columns to dates (that are present in the rewbla model) - - -# resave -save(amewoo, file = amewoo_rda_file, compress = original_compression) - -# 2. rewbla - drop "week_" prefix - -# Load -rewbla_rda_file <- "./data/rewbla.rda" -loaded <- load(rewbla_rda_file) -stopifnot(loaded == "rewbla") -original_compression <- tools::checkRdaFiles(rewbla_rda_file)$compress - -d <- rewbla$dates -names(d) <- gsub("^week_", "", names(d)) -rewbla$dates <- d -str(rewbla$dates) - -# resave -save(rewbla, file = rewbla_rda_file, compress = original_compression) diff --git a/data-raw/models.R b/data-raw/models.R new file mode 100644 index 0000000..a628339 --- /dev/null +++ b/data-raw/models.R @@ -0,0 +1,88 @@ +# Code to fit amewoo model on Unity Cluster. It is unlikely to work +# in other contexts. + +# Currently there are two models the first amewoo is used in most examples. +# It is not a sparse model. +# The second rewbla was initial added to test evaluation code +# e.g. BirdFlowR::interval_log_likelihood() +# and is used in a few other tests. It is heavily sparsified. + + +dir <- "/work/pi_plunkett_umass_edu/birdflowexamples/" + +library(BirdFlowR) +library(BirdFlowPipeline) +bf <- load_model("amewoo") + +species <- "amewoo" +res <- 150 +hp <- bf$metadata$hyperparameters + +dir.create(dir, showWarnings = FALSE) +batch_species(species = species, + grid_search_type = "old", + dist_pow = hp$dist_pow, + dist_weight = hp$dist_weight, + ent_weight = hp$ent_weight, + res = res, + hdf_path = dir, + base_output_path = dir, + clip = BirdFlowPipeline::americas_clip, + crs = as.character(BirdFlowPipeline::americas_crs)[2]) + + + +result <- paste0(dir, species, "_", res, "km/", species, + "_", ebirdst::ebirdst_version()$status_version_year[1], "_", + res, "km_obs1.0_ent", + hp$ent_weight, + "_dist", hp$dist_weight, + "_pow", hp$dist_pow, ".hdf5") + + +bf <- import_birdflow(result) + +amewoo <- bf + +usethis::use_data(amewoo, compress = "xz") + + +# Note I'm using the tuned parameters from AMEWOO for rewbla as well +# This isn't best practice for models used for inference but +# is fine for creating a second model +species <- "rewbla" +res <- 350 +hp <- bf$metadata$hyperparameters + +dir.create(dir, showWarnings = FALSE) +batch_species(species = species, + grid_search_type = "old", + dist_pow = hp$dist_pow, + dist_weight = hp$dist_weight, + ent_weight = hp$ent_weight, + res = res, + hdf_path = dir, + base_output_path = dir, + clip = BirdFlowPipeline::americas_clip, + crs = as.character(BirdFlowPipeline::americas_crs)[2]) + + + +result <- paste0(dir, species, "_", res, "km/", species, + "_", ebirdst::ebirdst_version()$status_version_year[1], "_", + res, "km_obs1.0_ent", + hp$ent_weight, + "_dist", hp$dist_weight, + "_pow", hp$dist_pow, ".hdf5") + + + +bf <- import_birdflow(result) +rewbla <- sparsify(bf, method = "conditional", p = .95, p_protected = 0.05) + + + +usethis::use_data(rewbla, compress = "xz", overwrite = TRUE) + + + diff --git a/data/amewoo.rda b/data/amewoo.rda new file mode 100644 index 0000000..fd81dfc Binary files /dev/null and b/data/amewoo.rda differ diff --git a/data/rewbla.rda b/data/rewbla.rda new file mode 100644 index 0000000..86f61b3 Binary files /dev/null and b/data/rewbla.rda differ diff --git a/data/rewbla_intervals.rda b/data/rewbla_intervals.rda new file mode 100755 index 0000000..6c2d1b2 Binary files /dev/null and b/data/rewbla_intervals.rda differ diff --git a/data/rewbla_observations.rda b/data/rewbla_observations.rda new file mode 100755 index 0000000..fb7194d Binary files /dev/null and b/data/rewbla_observations.rda differ diff --git a/data/states.rda b/data/states.rda new file mode 100755 index 0000000..d5bf756 Binary files /dev/null and b/data/states.rda differ diff --git a/inst/WORDLIST b/inst/WORDLIST index f53185c..bd62702 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,26 +1,35 @@ Auer -BSM +birdflow BirdFlow +BirdFlowModels BirdFlowR Birdflow -CMD +BSM +Burgin Celis +CMD +Crowe +doi +Dunham +eBird +ebirdst +github Hochachka +https Jaromczyk Ligocki Mackey Malorodova Nakash -Rodewald -Strimas -birdflow -doi -eBird -ebirdst -github -https natively +Pantoja preprocessed rewbla rnaturalearthhires +Rodewald +Sharma +Stillman +Stokowski +Strimas +WZTW diff --git a/man/BirdFlowModels.Rd b/man/BirdFlowExamples.Rd similarity index 63% rename from man/BirdFlowModels.Rd rename to man/BirdFlowExamples.Rd index b4f6201..bf6ca04 100644 --- a/man/BirdFlowModels.Rd +++ b/man/BirdFlowExamples.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/data.R \docType{data} -\name{BirdFlowModels} -\alias{BirdFlowModels} +\name{BirdFlowExamples} +\alias{BirdFlowExamples} \alias{amewoo} \alias{rewbla} \title{Birdflow Example Models} @@ -10,7 +10,7 @@ \code{BirdFlow} model } \source{ -Trained on eBird Status and Trends 2019 and 2021 Data. +Trained on eBird Status and Trends 2023 Data. } \usage{ amewoo # American Woodcock @@ -23,11 +23,12 @@ demonstrating usage in \pkg{BirdFlowR}; they are not fully vetted and should not be used for research or inference. } \references{ -Fink, D., T. Auer, A. Johnston, M. Strimas-Mackey, S. Ligocki, O. -Robinson, W. Hochachka, L. Jaromczyk, A. Rodewald, C. Wood, I. Davies, A. -Spencer. 2022. eBird Status and Trends, Data Version: 2021; Released: 2022. -Cornell Lab of Ornithology, Ithaca, New York. -https://doi.org/10.2173/ebirdst.2021 +Fink, D., T. Auer, A. Johnston, M. Strimas-Mackey, S. Ligocki, O. Robinson, +W. Hochachka, L. Jaromczyk, C. Crowley, K. Dunham, A. Stillman, C. Davis, M. Stokowski, +P. Sharma, V. Pantoja, D. Burgin, P. Crowe, M. Bell, S. Ray, I. Davies, V. Ruiz-Gutierrez, +C. Wood, A. Rodewald. 2024. +eBird Status and Trends, Data Version: 2023; +Released: 2025. Cornell Lab of Ornithology, Ithaca, New York. https://doi.org/10.2173/WZTW8903 } \seealso{ \code{\link[BirdFlowR:load_model]{BirdFlowR::load_model()}} will load a vetted model from a diff --git a/man/states.Rd b/man/states.Rd index cedddd9..0464ee2 100644 --- a/man/states.Rd +++ b/man/states.Rd @@ -9,7 +9,7 @@ class \strong{data.frame} and has columns: \describe{ \item{name}{State name} -\item{geometry}{Contains polyon information} +\item{geometry}{Contains polygon information} The code below was used to create this object: