The goal of {nert} is to provide access to Australian TERN (Terrestrial Ecosystem Research Network) data in your R session.
Installation instructions
{nert} is available through the R-Universe with pre-built binaries (this is the easy way).
To get started:
Install
install.packages("nert")
The hard(er) way
Note that for Linux users, you will need to install system libraries to support geospatial packages in R, e.g., {sf} and {terra} as well as some packages for downloading data via curl, please see Note for Linux Installers. If you run into errors, e.g., Bad GitHub Credentials
, please read this: Managing Git(Hub) Credentials and set up your GitHub credentials in R and try again.
You can install the development version of {nert} from GitHub with:
Example: reading a COG as a spatial object
This is a basic example which shows you how you can fetch one day’s data from the SMIPS data and visualise it:
library(nert)
r <- read_smips(day = "2024-01-01")
# `autoplot` is re-exported from {tidyterra}
autoplot(r)
#> <SpatRaster> resampled to 501270 cells.
Extract Values Given Lat/Lon Values
Extract Soil Moisture for Corrigin and Merriden, WA and Tamworth, NSW given latitude and longitude values for each.
library(terra)
df <- structure(
list(
location = c("Corrigin", "Merredin", "Tamworth"),
x = c(117.87, 118.28, 150.84),
y = c(-32.33, -31.48, -31.07)
),
row.names = c(NA, -3L),
class = "data.frame"
)
cog_df <- extract(x = r, y = df[, c("x", "y")], xy = TRUE)
cog_df <- cbind(df$location, cog_df)
names(cog_df) <- c("location", "ID", "smips_totalbucket_mm_20240101", "x", "y")
cog_df
#> location ID smips_totalbucket_mm_20240101 x y
#> 1 Corrigin 1 0.06715473 117.8688 -32.33328
#> 2 Merredin 2 0.22716530 118.2787 -31.48353
#> 3 Tamworth 3 93.44989014 150.8408 -31.07365
Keeping {nert} Updated
{nert} is undergoing active development and is not yet on CRAN. If you installed {nert} using the R-Universe (the preferred method), you can keep {nert} up-to-date locally like so:
and answering yes
or y
when asked if you would like to upgrade {nert}.
Note for Linux Installers
If you are using Linux, you will likely need to install several system-level libraries, {pak} will do it’s best to install most of them but some may not be installable this way. For Nectar with a fresh Ubuntu image, you can use the following command to install system libraries to install {pak} and then install {fifo}. In your Linux terminal (not your R console, the “terminal” tab in RStudio should do here in most cases) type:
Citing {nert}
To cite nert:
citation("nert")
#> To cite package 'nert' in publications use:
#>
#> Sparks A, Pipattungsakul W, Edson R, Rogers S, Moldovan M (2025).
#> _nert: An API Client for TERN Data_. R package version 0.0.1.9000,
#> commit 39ab8b7f2f03152ea3702f3089f095b9adebb9ee,
#> <https://github.com/AAGI-AUS/nert>.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> title = {nert: An API Client for TERN Data},
#> author = {Adam H. Sparks and Wasin Pipattungsakul and Russell Edson and Sam Rogers and Max Moldovan},
#> year = {2025},
#> note = {R package version 0.0.1.9000, commit 39ab8b7f2f03152ea3702f3089f095b9adebb9ee},
#> url = {https://github.com/AAGI-AUS/nert},
#> }