Skip to content

Commit 57b67fa

Browse files
committed
organizing readme
1 parent 702e069 commit 57b67fa

File tree

2 files changed

+81
-77
lines changed

2 files changed

+81
-77
lines changed

README.Rmd

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ library(saltbush)
2727

2828
*saltbush* processes drone imagery and ausplot vegetation survey data to calculate spectral + taxonomic diversity values for assessment of the 'spectral variability hypothesis'.
2929

30-
# Installation
30+
## Installation
3131

3232
```{r install, eval= FALSE}
3333
install.packages("remotes")
@@ -36,63 +36,68 @@ library(saltbush)
3636

3737
## Usage
3838

39-
## Spectral metrics
40-
41-
### Spectral diversity metrics:
42-
43-
+ co-efficient of variance (CV)
44-
+ spectral variance (SV)
45-
+ convex hull volume (CHV)
46-
47-
1. List raster files and area of interest files
39+
1. **Direct the package to the input files** in this case we use a drone image from Fowlers Gap, NSW, Australia
4840

4941
```{r}
50-
raster_files <- list.files(system.file("extdata/example", package = "saltbush"),
42+
43+
raster_files <- list.files("inst/extdata/example",
5144
pattern = '.tif$', full.names = TRUE)
5245
53-
aoi_files <- list.files(system.file("extdata/aoi", package = "saltbush"),
46+
aoi_files <- list.files("inst/extdata/aoi",
5447
pattern = 'NSABHC0009_aoi.shp$', full.names = TRUE)
5548
56-
5749
```
5850

59-
2. Extract pixel values
51+
2. **Extract pixel values** from the area of interest in the image
6052

6153
```{r}
54+
6255
pixel_values <- extract_pixel_values(raster_files,
6356
aoi_files)
6457
6558
head(pixel_values)
59+
6660
```
6761

68-
3. Calculate spectral metrics
62+
3. **Calculate spectral metrics**
6963
```{r}
64+
7065
metrics <- calculate_spectral_metrics(pixel_values, masked = F, wavelengths = colnames(pixel_values[, 2:6]), rarefaction = F)
7166
7267
head(metrics)
7368
7469
```
7570

76-
## Taxonomic metrics
71+
+ co-efficient of variance (CV)
72+
+ spectral variance (SV)
73+
+ convex hull volume (CHV)
7774

78-
### Taxonomic diversity metrics:
75+
For a full discussion of this metrics see the manuscript
7976

80-
+ species richness
81-
+ shannon's diversity index
82-
+ simpson's diversity index
83-
+ pielou's evenness
84-
+ exponential shannon's index
85-
+ inverse simpson's index
86-
87-
1. Download example plot data from AusPlots. The `veg.PI` part extracts the point intercept data from the AusPlots data structure.
77+
4. **Download plot data** from AusPlots. The `veg.PI` part extracts the point intercept data from the AusPlots data structure. In this case we use the same AusplotID as in the drone images above.
8878

89-
```{r}
90-
my.data <- ausplotsR::get_ausplots(my.Plot_IDs=c("SATFLB0004", "QDAMGD0022", "NTASTU0002"), veg.PI=TRUE)$veg.PI
79+
```{r, message=FALSE}
80+
my.data <- ausplotsR::get_ausplots(my.Plot_IDs=c("NSABHC0009"), veg.PI=TRUE)
81+
my.data$site.info$visit_date
9182
```
9283

93-
2. Calculate diversity from the point intercepts using different diversity metrics. The output is a list which includes taxonomic metrics, and also community matrices for checks.
84+
This gets us data for two on-the-ground sampling visits to one particular AusPlot where we happen to have drone imagery.
85+
86+
5. **Calculate on-the-ground diversity** from the point intercepts using different diversity metrics. The output is a list which includes taxonomic metrics, and also community matrices for checks. Not that this takes the `PI` part of the AusPlot object which stands for point-intercept. For a general function to calculate on-the-ground diversity, see (vegan::diversity)[https://rdrr.io/cran/vegan/man/diversity.html].
9487

9588
```{r}
96-
field_diversity <- calculate_field_diversity(my.data)
89+
field_diversity <- calculate_field_diversity(my.data$veg.PI)
9790
field_diversity$taxonomic_diversity
9891
```
92+
93+
2012 was wetter than 2016 and there are a number of rain ephemeral species at this site so the higher species richness makes sense.
94+
95+
the calculated diversity metrics are:
96+
97+
+ species richness
98+
+ shannon's diversity index
99+
+ simpson's diversity index
100+
+ pielou's evenness
101+
+ exponential shannon's index
102+
+ inverse simpson's index
103+

README.md

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ coverage](https://codecov.io/gh/traitecoevo/saltbush/graph/badge.svg)](https://a
1414
calculate spectral + taxonomic diversity values for assessment of the
1515
‘spectral variability hypothesis’.
1616

17-
# Installation
17+
## Installation
1818

1919
``` r
2020
install.packages("remotes")
@@ -23,27 +23,22 @@ calculate spectral + taxonomic diversity values for assessment of the
2323

2424
## Usage
2525

26-
## Spectral metrics
27-
28-
### Spectral diversity metrics:
29-
30-
- co-efficient of variance (CV)
31-
- spectral variance (SV)
32-
- convex hull volume (CHV)
33-
34-
1. List raster files and area of interest files
26+
1. **Direct the package to the input files** in this case we use a
27+
drone image from Fowlers Gap, NSW, Australia
3528

3629
``` r
37-
raster_files <- list.files(system.file("extdata/example", package = "saltbush"),
30+
31+
raster_files <- list.files("inst/extdata/example",
3832
pattern = '.tif$', full.names = TRUE)
3933

40-
aoi_files <- list.files(system.file("extdata/aoi", package = "saltbush"),
34+
aoi_files <- list.files("inst/extdata/aoi",
4135
pattern = 'NSABHC0009_aoi.shp$', full.names = TRUE)
4236
```
4337

44-
2. Extract pixel values
38+
2. **Extract pixel values** from the area of interest in the image
4539

4640
``` r
41+
4742
pixel_values <- extract_pixel_values(raster_files,
4843
aoi_files)
4944

@@ -57,9 +52,10 @@ head(pixel_values)
5752
#> 6 NSABHC0009 0.03945594 0.03824322 0.04755034 0.04384791 0.05770193 1
5853
```
5954

60-
3. Calculate spectral metrics
55+
3. **Calculate spectral metrics**
6156

6257
``` r
58+
6359
metrics <- calculate_spectral_metrics(pixel_values, masked = F, wavelengths = colnames(pixel_values[, 2:6]), rarefaction = F)
6460

6561
head(metrics)
@@ -68,49 +64,52 @@ head(metrics)
6864
#> 1: NSABHC0009 1 0.3314709 0.001708346 3.302738e-10 unmasked
6965
```
7066

71-
## Taxonomic metrics
67+
- co-efficient of variance (CV)
68+
- spectral variance (SV)
69+
- convex hull volume (CHV)
7270

73-
### Taxonomic diversity metrics:
71+
For a full discussion of this metrics see the manuscript
7472

75-
- species richness
76-
- shannon’s diversity index
77-
- simpson’s diversity index
78-
- pielou’s evenness
79-
- exponential shannon’s index
80-
- inverse simpson’s index
81-
82-
1. Download example plot data from AusPlots. The `veg.PI` part extracts
83-
the point intercept data from the AusPlots data structure.
73+
4. **Download plot data** from AusPlots. The `veg.PI` part extracts the
74+
point intercept data from the AusPlots data structure. In this case
75+
we use the same AusplotID as in the drone images above.
8476

8577
``` r
86-
my.data <- ausplotsR::get_ausplots(my.Plot_IDs=c("SATFLB0004", "QDAMGD0022", "NTASTU0002"), veg.PI=TRUE)$veg.PI
87-
#> Calling the database. Please wait...
88-
#> downloading (search) [---------------] ( 1%) time: 00:00:00downloading (search) [===============] (100%) time: 00:00:00
89-
#> 200
90-
#> User-supplied Plot_IDs located.
91-
#> Calling the database. Please wait...
92-
#> downloading (site) [-----------------] ( 1%) time: 00:00:00downloading (site) [=================] (100%) time: 00:00:00
93-
#> 200
94-
#> Calling the database. Please wait...
95-
#> downloading (veg_pi) [---------------] ( 1%) time: 00:00:00downloading (veg_pi) [===============] (100%) time: 00:00:00
96-
#> 200
78+
my.data <- ausplotsR::get_ausplots(my.Plot_IDs=c("NSABHC0009"), veg.PI=TRUE)
79+
my.data$site.info$visit_date
80+
#> [1] "2012-09-03" "2016-09-13"
9781
```
9882

99-
2. Calculate diversity from the point intercepts using different
100-
diversity metrics. The output is a list which includes taxonomic
101-
metrics, and also community matrices for checks.
83+
This gets us data for two on-the-ground sampling visits to one
84+
particular AusPlot where we happen to have drone imagery.
85+
86+
5. **Calculate on-the-ground diversity** from the point intercepts
87+
using different diversity metrics. The output is a list which
88+
includes taxonomic metrics, and also community matrices for checks.
89+
Not that this takes the `PI` part of the AusPlot object which stands
90+
for point-intercept. For a general function to calculate
91+
on-the-ground diversity, see
92+
(vegan::diversity)\[<https://rdrr.io/cran/vegan/man/diversity.html>\].
10293

10394
``` r
104-
field_diversity <- calculate_field_diversity(my.data)
95+
field_diversity <- calculate_field_diversity(my.data$veg.PI)
10596
field_diversity$taxonomic_diversity
10697
#> site_unique site_location_name species_richness shannon_diversity
107-
#> 1 SATFLB0004-58658 SATFLB0004 28 2.379688
108-
#> 2 NTASTU0002-58429 NTASTU0002 22 2.200076
109-
#> 3 QDAMGD0022-53501 QDAMGD0022 20 2.179534
110-
#> 4 SATFLB0004-53705 SATFLB0004 18 2.149992
98+
#> 1 NSABHC0009-58026 NSABHC0009 52 3.041263
99+
#> 2 NSABHC0009-53604 NSABHC0009 38 2.833114
111100
#> simpson_diversity pielou_evenness exp_shannon inv_simpson
112-
#> 1 0.8649789 0.7141483 10.801533 7.406252
113-
#> 2 0.8509874 0.7117585 9.025696 6.710843
114-
#> 3 0.8242833 0.7275464 8.842187 5.690977
115-
#> 4 0.8375000 0.7438460 8.584786 6.153846
101+
#> 1 0.9195892 0.7696978 20.93167 12.43614
102+
#> 2 0.9039217 0.7788445 16.99831 10.40818
116103
```
104+
105+
2012 was wetter than 2016 and there are a number of rain ephemeral
106+
species at this site so the higher species richness makes sense.
107+
108+
the calculated diversity metrics are:
109+
110+
- species richness
111+
- shannon’s diversity index
112+
- simpson’s diversity index
113+
- pielou’s evenness
114+
- exponential shannon’s index
115+
- inverse simpson’s index

0 commit comments

Comments
 (0)