-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
77 lines (56 loc) · 1.83 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# nert
<!-- badges: start -->
[![R-CMD-check](https://github.com/AAGI-AUS/nert/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/AAGI-AUS/nert/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/AAGI-AUS/nert/graph/badge.svg)](https://app.codecov.io/gh/AAGI-AUS/nert)
<!-- badges: end -->
The goal of {nert} is to provide access to Australian TERN (Terrestrial Ecosystem Research Network) data in your R session.
## Installation
You can install the development version of {nert} from [GitHub](https://github.com/AAGI-AUS/nert) with:
```{r install, eval=FALSE}
if (!require("pak")) {
install.packages("pak")
}
pak::pak("AAGI-AUS/nert")
```
## 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 (currently the only supported data set in TERN) and visualise it:
```{r example_cog}
library(nert)
r <- read_smips(day = "2024-01-01")
plot(r)
```
## Extract Values Given Lat/Lon Values
Extract Soil Moisture for Corrigin and Merriden, WA and Tamworth, NSW given latitude and longitude values for each.
```{r}
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
```
## Citing {nert}
To cite nert:
```{r cite}
citation("nert")
```