Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
86fb8bc
Documentation and code for data_fmt, data_buff, landcover_download, a…
rdjmacklin Mar 18, 2026
290e01e
Update documentation and code for data_fmt, data_buff, landcover_down…
rdjmacklin Mar 18, 2026
a121736
Build more tests for data_fmt
rdjmacklin Mar 20, 2026
8bc0a4f
Formatting edits to code and mans, finish tests for data_fmt, start t…
rdjmacklin Mar 20, 2026
fa53fa3
March 23 2026: finish tests for data_buff, landcover_download, start …
rdjmacklin Mar 23, 2026
09ecd4a
March 23 2026: small edits to landcover_extract, first tests.
rdjmacklin Mar 23, 2026
9cd82cf
Finish tests for landcover_extract(), fix to landcover_extract() to m…
rdjmacklin Mar 25, 2026
001ade5
Starting covariate formatting vignette
rdjmacklin Mar 25, 2026
bff9bc1
Update renv check for EarthData credentials
rdjmacklin Mar 26, 2026
70c4008
Merge branch 'main' into rory-landcover
steffilazerte Mar 26, 2026
4effecf
Fixes from local R CMD CHECK, update _pkgdown.yml, finish vignette fo…
rdjmacklin Mar 26, 2026
9167e93
Merge branch 'rory-landcover' of https://github.com/BirdsCanada/natur…
rdjmacklin Mar 26, 2026
506453c
Integrate Steffi's changes
rdjmacklin Apr 1, 2026
7f70501
Fix problems identified by pkgdown check
rdjmacklin Apr 1, 2026
58651e6
Merge branch 'main' into rory-landcover
rdjmacklin Apr 1, 2026
fa53617
Apr 8 2026: add incomplete vignette for landcover functions.
rdjmacklin Apr 9, 2026
369ad67
Merge branch 'rory-landcover' of https://github.com/BirdsCanada/natur…
rdjmacklin Apr 9, 2026
5141fdf
April 9, 2026: finish landcover vignette.
rdjmacklin Apr 9, 2026
ef13b26
Apr 23 2026: Upgrade landcover_download to only download data years r…
rdjmacklin Apr 23, 2026
9c94a84
May 27 2026: implement function and docs for vegetation_download and …
rdjmacklin May 27, 2026
75c6308
May 28, 2026: finish vegetation tests, go back to tweak landcover tes…
rdjmacklin May 28, 2026
d44f736
May 29, 2026: repair landcover tests
rdjmacklin May 29, 2026
02a76d6
May 30, 2026: tweaks to download process for vegetation_download and …
rdjmacklin May 30, 2026
41b7921
June 2 2026: Fixes after review with Steffi
rdjmacklin Jun 2, 2026
3ef67ff
June 3, 2026: small fixes following R-CMD-CHECK
rdjmacklin Jun 3, 2026
d85a1bb
June 3, 2026: precompile vignettes
rdjmacklin Jun 3, 2026
5e8e4e8
June 3, 2026: more fixes for R-CMD-CHECK
rdjmacklin Jun 3, 2026
25b6dce
June 3, 2026: incorporate elevation functions.
rdjmacklin Jun 3, 2026
ba887c7
June 4, 2026: changes to warnings.
rdjmacklin Jun 4, 2026
92e25d6
June 4, 2026: More fiddly tests for landcover and vegetation.
rdjmacklin Jun 4, 2026
690addd
June 4, 2026: more weird fixes.
rdjmacklin Jun 4, 2026
877f650
June 5, 2026: messing with tests for bad credentials without much suc…
rdjmacklin Jun 7, 2026
94ff449
June 8, 2026: changes regarding verbosity and credential checking fol…
rdjmacklin Jun 8, 2026
62d432f
June 6, 2026: more verbosity fixes
rdjmacklin Jun 8, 2026
112066f
June 6, 2026: adjust verbosity options, adjust warning system in elev…
rdjmacklin Jun 9, 2026
305e453
June 9, 2026: elevation vignette
rdjmacklin Jun 9, 2026
a10662c
June 10, 2026: add elevation vignette to _pkgdown.yml
rdjmacklin Jun 10, 2026
143ee63
June 10, 2026: add worldclim functions, man, and tests
rdjmacklin Jun 10, 2026
395d02c
June 11, 2026: more WorldClim tests
rdjmacklin Jun 11, 2026
8592756
June 14, 2026: complete WorldClim tests, adjust process for identifyi…
rdjmacklin Jun 14, 2026
edecf23
June 14, 2026: Elevation vignette link fix
rdjmacklin Jun 14, 2026
a39eab8
June 14, 2026: WorldClim vignette
rdjmacklin Jun 14, 2026
595ef58
June 15, 2026: try switching to worldclim_wind in examples to try to …
rdjmacklin Jun 15, 2026
fb79cfd
June 15, 2026: add scanfi download and update to SCANFI v2
rdjmacklin Jun 16, 2026
7d0dcad
June 21, 2026: small fixes to scanfi_download().
rdjmacklin Jun 21, 2026
2472fdc
June 22, 2026: add scanfi_extract(), tweaks to scanfi_download and ma…
rdjmacklin Jun 22, 2026
028d32b
June 24, 2026: add tests for scanfi functions and fix as needed
rdjmacklin Jun 25, 2026
06ce38a
June 24, 2026: apply AIR formatter
rdjmacklin Jun 25, 2026
5e08d69
June 26, 2026: finish tests for scanfi functions.
rdjmacklin Jun 27, 2026
2393eb4
June 28, 2026: update man pages w correct citation.
rdjmacklin Jun 28, 2026
81711c8
June 28th, 2026: vignette for scanfi functions + small fix.
rdjmacklin Jun 28, 2026
0d34681
June 29, 2026: complete rework of daymet_ functions.
rdjmacklin Jun 30, 2026
761dde5
June 30, 2026: tests and fixes for daymet_ functions.
rdjmacklin Jun 30, 2026
c03bcb6
July 2, 2026: vignette for daymet_ functions and a few other changes.
rdjmacklin Jul 2, 2026
d5864ed
July 2, 2026: add nc_covariates_merge() and tests, begin troubleshoot…
rdjmacklin Jul 3, 2026
0eb2c68
July 2, 2026: fix pkgdown
rdjmacklin Jul 3, 2026
4b395b6
July 2, 2026: fix pkgdown again
rdjmacklin Jul 3, 2026
f548dbb
July 3, 2026: more tests and fixes for nc_covariates_merge()
rdjmacklin Jul 3, 2026
c6a2423
July 3, 2026: update vignettes to point users to nc_covariates_merge()
rdjmacklin Jul 3, 2026
88c1817
July 3, 2026: update See Also tabs in man pages to point to nc_covari…
rdjmacklin Jul 3, 2026
b75567e
July 23, 2026: testing R CMD Check fixes after chatting w Steffi.
rdjmacklin Jul 23, 2026
84880fb
July 23, 2026: more R CMD Check fixes
rdjmacklin Jul 23, 2026
0cb156a
August 1, 2026: add more try statements to getNASA calls to try and q…
rdjmacklin Aug 1, 2026
5afdcac
August 1, 2026: move try call to authentication attempt causing errors.
rdjmacklin Aug 1, 2026
601eeeb
August 1, 2026: add missing }.
rdjmacklin Aug 1, 2026
12357a4
August 1, 2026: add multiple login attempts to vegetation_download().
rdjmacklin Aug 1, 2026
57d20cb
August 2, 2026: print extr_table() in R CMD Check to diagnose issue.
rdjmacklin Aug 2, 2026
39cac56
August 2, 2026: testing the nature of the modis object after finding …
rdjmacklin Aug 2, 2026
164b164
August 2, 2026: adding print
rdjmacklin Aug 2, 2026
5f4b7c8
August 2, 2026: attempt to use varname to identify column.
rdjmacklin Aug 2, 2026
269da04
August 2, 2026: don't use varnames, just use column number.
rdjmacklin Aug 2, 2026
51eeb2f
August 2, 2026: fully integrate column number approach.
rdjmacklin Aug 2, 2026
3fd7ef1
August 2, 2026: add timeout catch for login in landcover_download()
rdjmacklin Aug 2, 2026
a58d4db
August 2, 2026: another try with some fixes
rdjmacklin Aug 2, 2026
6e41478
August 2, 2026: apply column number strategy to vegetation_extract().
rdjmacklin Aug 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
^misc$
^\.vscode$
^[.]?air[.]toml$
^\.positai$
^\.claude$
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@ docs
misc
cache
rosm.cache
*.zip
*.zip
testdir
.positai
vignettes/articles/modis
vignettes/articles/TerrainTiles
vignettes/articles/worldclim
vignettes/articles/daymet
modis
scanfi
daymet
50 changes: 29 additions & 21 deletions CODE_DESIGN.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,59 @@
# naturecounts design principles

## Non-cloud data

- Put data required to precompile vignettes in the `misc` folder
- This isn't uploaded to GitHub

## Locations

- API urls
- are stored in `meta_info`, a tibble created in `data-raw/data_creation.R`
- This is where you can change from main to sandbox versions
- https://naturecounts.ca/api vs. https://sandbox.naturecounts.ca/api
- To apply this you must **re-run** `data-raw/data_creation.R` and then
**re-load** the functions/package
- <https://naturecounts.ca/api> vs. <https://sandbox.naturecounts.ca/api>
- To apply this you must **re-run** `data-raw/data_creation.R` and then **re-load** the functions/package

## Fields returned by the API

#### Desired behaviour

Required and extra fields returned by the API are expected and treated, respectively, as follows:

Function | API Entry Point | Required fields | Extra fields
------------------ |-------------------------- | -------------------------- | ------------
`nc_count()` | `data/list_collections` | `collection`, `nrecords` | Ignored
`nc_count()` | `data/list_permissions` | `collection`, `akn_level` | Ignored
`nc_count()` | `metadata/collections` | `collection`, `akn_level` | Ignored
`nc_permissions()` | `data/list_permissions` | `collection`, `akn_level` | Ignored
`srv_auth()` | `data/authenticate` | `token` | Ignored
`nc_data_dl()` | `data/release_request_id` | None (close request only) | Ignored
`nc_data_dl()` | `data/get_data` | Any | Added
`meta_XXX()` | `metadata/XXX` | Any | Added
| Function | API Entry Point | Required fields | Extra fields |
|----|----|----|----|
| `nc_count()` | `data/list_collections` | `collection`, `nrecords` | Ignored |
| `nc_count()` | `data/list_permissions` | `collection`, `akn_level` | Ignored |
| `nc_count()` | `metadata/collections` | `collection`, `akn_level` | Ignored |
| `nc_permissions()` | `data/list_permissions` | `collection`, `akn_level` | Ignored |
| `srv_auth()` | `data/authenticate` | `token` | Ignored |
| `nc_data_dl()` | `data/release_request_id` | None (close request only) | Ignored |
| `nc_data_dl()` | `data/get_data` | Any | Added |
| `meta_XXX()` | `metadata/XXX` | Any | Added |

#### What will break the package
- Missing "Required fields"
- Missing/renamed "container"
Some API entry points return data in a container, for example,

- `data/get_data` -> `results` (holds main data)
- `data/list_collections` -> `results` (holds counts); `request_id` (holds request id)
- `data/list_requests` -> `requests` (holds details on individual requests)

- Missing "Required fields"

- Missing/renamed "container"\
Some API entry points return data in a container, for example,

- `data/get_data` -\> `results` (holds main data)
- `data/list_collections` -\> `results` (holds counts); `request_id` (holds request id)
- `data/list_requests` -\> `requests` (holds details on individual requests)

If these "containers" change names, the package will break.

#### Coding Principles
- In package, after accessing the API, explictly `select()` the fields/columns expected. This way extra fields won't break existing code

- In package, after accessing the API, explictly `select()` the fields/columns expected. This way extra fields won't break existing code
- Missing fields **will** break the code, but at least they will break the code early!
- Do **not** do this for data downloads (i.e. `nc_single_dl()` under `nc_data_dl()`) or metadata downloads (i.e. `meta_XXX()`)
- **Unless**, using a `meta_XXX()` download internally. Then always `select()` the fields required

## Testing

- Tests are run using the user "testuser"
- Locally password can be stored in .Renviron as naturecounts_testuser = PASSWORD
- For remote testing, password is supplied as encrypted values
- Tests for covariate download and extraction functions are run using the EarthData user with email `[email protected]` and username `rdjmacklin_bc`. If Rory Macklin can't be contacted to access credentials, a new user can be made with necessary changes to `ed_email` argument in tests for `landcover_download()` and `vegetation_download()` and to `ed_username` argument in tests for `daymet_download()` , `daymet_request()` and `daymet_check()`.
- Locally, password can be stored in .Renviron as EarthData_password = PASSWORD or supplied via `askpass::askpass()` built into functions.
20 changes: 16 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: naturecounts
Type: Package
Title: Access and download data on plant and animal populations from NatureCounts
Version: 0.5.0
Version: 0.5.0.9000
Authors@R: c(
person("Steffi", "LaZerte", email = "[email protected]", role = "aut"),
person("Denis", "Lepage", email = "[email protected]", role = c("aut", "cre")))
Expand Down Expand Up @@ -35,19 +35,31 @@ Imports:
units (>= 0.8.1),
wk (>= 0.7.1)
Suggests:
appeears,
elevatr,
exactextractr,
geodata,
ggspatial (>= 1.1.10),
here,
knitr,
landscapemetrics,
luna (>= 0.4-1),
mapview,
measurements,
patchwork,
prettymapr (>= 0.2.5),
rmarkdown,
rnaturalearth,
rnaturalearthhires,
readr,
rosm,
roxygen2,
sf (>= 1.0-9),
spData,
spelling,
stats,
tidyterra,
terra,
testthat,
vdiffr
Language: en-US
Expand All @@ -58,6 +70,6 @@ URL: https://github.com/BirdsCanada/naturecounts,
https://birdscanada.github.io/naturecounts/
VignetteBuilder: knitr
Config/testthat/edition: 3
Remotes:
ropensci/rnaturalearthhires,
wranglezone/tibblify
Remotes: ropensci/rnaturalearthhires,
rspatial/luna,
wranglezone/tibblify
17 changes: 17 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ export("%>%")
export(.data)
export(cosewic_plot)
export(cosewic_ranges)
export(data_buff)
export(data_fmt)
export(daymet_check)
export(daymet_download)
export(daymet_extract)
export(daymet_request)
export(elevation_download)
export(elevation_extract)
export(format_dates)
export(format_zero_fill)
export(grid_canada)
export(landcover_download)
export(landcover_extract)
export(map_canada)
export(meta_bcr_codes)
export(meta_bmde_fields)
Expand All @@ -25,6 +35,7 @@ export(meta_statprov_codes)
export(meta_subnational2_codes)
export(meta_utm_squares)
export(nc_count)
export(nc_covariates_merge)
export(nc_data_dl)
export(nc_metadata)
export(nc_metadata_version)
Expand All @@ -33,11 +44,17 @@ export(nc_query_table)
export(nc_remove_cache)
export(nc_requests)
export(region_search)
export(scanfi_download)
export(scanfi_extract)
export(search_region)
export(search_species)
export(search_species_code)
export(species_code_search)
export(species_search)
export(vegetation_download)
export(vegetation_extract)
export(worldclim_download)
export(worldclim_extract)
importFrom(dbplyr,sql)
importFrom(magrittr,"%>%")
importFrom(magrittr,"%T>%")
Expand Down
Loading
Loading