Skip to content

Commit 22d564a

Browse files
committed
initial commit
0 parents  commit 22d564a

13 files changed

+416
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.Rhistory
2+
.DS_Store
3+
.Rproj.user/*
4+
rasters/
5+
.Rproj.user
6+
/.quarto/
7+
_book
8+
_site
9+
*.html
10+
*.js
11+
*.css

LT_for_FEMC.Rproj

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: Default
4+
SaveWorkspace: Default
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 2
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX

_quarto.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "LT-GEE Lessons and Resources"
6+
site-url: https://cafri-labs.github.io/lab-manual/
7+
repo-url: https://github.com/cafri-labs/lab-manual
8+
repo-actions: [edit,issue]
9+
reader-mode: true
10+
page-navigation: true
11+
sidebar:
12+
style: docked
13+
search: true
14+
contents:
15+
- index.qmd
16+
- getting_started.qmd
17+
- tuning.qmd
18+
- timesync.qmd
19+
20+
format:
21+
html:
22+
theme: cosmo
23+
toc: true
24+

files/LTparams.csv

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Parameter,Description,Default
2+
spike threshold,Sets the size of abrupt deviation in spectral value that is considered a spike. Smaller values filter out spikes more aggressively,0.9
3+
p-value threshold,The p-value threshold for trajectory selection. Trajectories with p-values that exceed this threshold are considered no change. ,0.05
4+
max segments,The maximum number of segments allowed in trajectory fitting,
5+
vertex count overshoot,Initial regression-based detection of potential vertices can overshoot the number of vertices allowed by max segments by this value; angle-based culling is used to return to the desired number of vertices if overshoot occurs. This allows for a mix of criteria for vertex identification.,3
6+
recovery threshold,Disallows candidate segment that have a recovery rate faster than 1/recovery threshold (in years).,0.25
7+
prevent one year recovery,"Disallows all segments with recovery rates equal to one year, either true or false. ",FALSE
8+
best model proportion,Allows models with more vertices than allowed by max segments to be chosen if their p-value is no more than (2 – best model proportion) times the p-value of the best model.,0.75
9+
minimum observations needed,Minimum number of cloud free images needed to perform fitting.,6
10+
delta,Change type to map – either loss (disturbance) or gain (recovery/growth). ,loss*
11+
sort,"The type of change to identify if there is more than one change event in the pixel of interest – one of greatest, least, newest, oldest, fastest, slowest.",greatest*
12+
magnitude,Either a minimum or maximum value for filtering change events by change in spectral reflectance value; filtering is not required.,> 50*
13+
duration,Either a minimum or maximum value for filtering change events by length of event. Filtering by disturbance duration is not required.,< 4*
14+
preval,Either a minimum or maximum value for filtering change events by the pre-change value of the spectral index. Filtering by preval is not required.,> 300*
15+
minimum mapping unit (mmu),Indicates the smallest allowable disturbance patch. Pixels disturbed in the same year and adjacent following an 8-neightbor rule are considered to be of the same patch. Filtering by mmu is not required.,7*

files/cafri_logo.png

514 KB
Loading

files/combo_params.csv

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
parameter combination,max segments,vertex count overshoot,recovery threshold,p value threshold,best model proportion
2+
1,12,1,0.75,0.1,0.75
3+
2,16,1,0.75,0.1,0.75
4+
3,16,5,0.75,0.1,0.75
5+
4,12,5,0.75,0.1,0.75
6+
5,16,5,0.5,0.1,0.75
7+
6,12,5,0.5,0.1,0.75
8+
7,16,5,0.75,0.2,0.75
9+
8,12,5,0.75,0.2,0.75
10+
9,16,5,0.5,0.05,0.75
11+
10,16,1,0.75,0.05,0.75
12+
11,12,1,0.5,0.1,0.75
13+
12,16,1,0.5,0.1,0.75

files/multidist_tuning_results.csv

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"Tuning","TP","FN","TN","FP","precision","recall","f1","accuracy"
2+
"combo 12",1509535.27605174,1588569.19965991,43543788.6376249,2200050.05378651,0.406928306490138,0.487244793675007,0.443479453138745,0.922431029402683
3+
"combo 5",1486925.8574341,1611178.61827756,43677821.5020522,2066017.18935922,0.418505401817829,0.479946970507681,0.447125314441921,0.924712335972087
4+
"combo 6",1411988.15263775,1686116.32307391,43926408.9217305,1817429.76968083,0.437226827435207,0.455758727217682,0.446300483449036,0.928267675985646
5+
"combo 7",1513192.61316499,1584911.86254666,43612569.7679635,2131268.92344786,0.415203342925481,0.488425301673341,0.448847696974439,0.92391414949895
6+
"recovery threshold 0.75",1346368.21587367,1751736.25983798,44060070.3357728,1683768.3556386,0.444325918683503,0.434578054558474,0.439397930172336,0.929660771199842
7+
"defaults",939588.629023333,2158515.84668832,44883295.5275216,860543.16388977,0.521955466106636,0.303278548670475,0.38364365355007,0.9381871642525

files/tune_params.csv

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameter,values tested
2+
max segments,"8, 10, 12, 14, 16"
3+
vertex count overshoot,"1, 3, 5"
4+
recovery threshold,"0.25, 0.5, 0.75, 0.8, 0.9, 1 "
5+
p value threshold,"0.05, 0.1, 0.2"
6+
best model proportion,"0.5, 0.75, 1"

files/tuning_results.csv

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
file_name,short_name,maxSegments,vertexCountOvershoot,recoveryThreshold,pvalThreshold,bestModelProportion,TN,FN,TP,FP,Precision,Recall,F1,Accuracy
2+
lt_nbr_greatest_tuning_recoverythreshold_75,recovery threshold 0.75,10,3,0.75,0.05,0.75,337800,85464,36001,20230,0.640234035,0.296389907,0.405197641,0.779572258
3+
lt_gee_nbr_greatest_defaults,defaults,10,3,0.25,0.05,0.75,344025,94976,27014,13480,0.667111177,0.221444381,0.33251274,0.773812031
4+
rasters/lt_gee_nbr_greatest_tuning_maxsegments_8,max segmetns 08,8,3,0.25,0.05,0.75,344365,95283,26762,13085,0.671618942,0.219279774,0.330615472,0.773995558
5+
rasters/lt_gee_nbr_greatest_tuning_maxsegments_12,max segments 12,12,3,0.25,0.05,0.75,343921,94646,27365,13563,0.668613174,0.224283056,0.335892573,0.774327157
6+
lt_gee_nbr_greatest_tuning_vertexovershoot_1,vertex overshoot 1,10,1,0.25,0.05,0.75,344315,95019,27006,13155,0.672443415,0.221315304,0.333025045,0.77440015
7+
lt_gee_nbr_greatest_tuning_vertexovershoot_5,vertex overshoot 5,10,5,0.25,0.05,0.75,344023,94815,27194,13463,0.66886391,0.222885197,0.334353829,0.774183255
8+
lt_gee_nbr_greatest_tuning_recoverythreshold_05,recovery threshold 0.5,10,3,0.5,0.05,0.75,341428,86589,35100,16378,0.681844672,0.288440204,0.405389018,0.785259492
9+
lt_gee_nbr_greatest_tuning_pval_1,pval 0.1,10,3,0.25,0.1,0.75,344011,94700,27275,13509,0.668767164,0.223611396,0.335158117,0.774327157
10+
lt_gee_nbr_greatest_tuning_pval_2,pval 0.2,10,3,0.25,0.2,0.75,344081,94412,27553,13449,0.67199161,0.225909072,0.338142078,0.77505292
11+
lt_gee_nbr_greatest_tuning_modelproportion_1,modelproportion 1,10,3,0.25,0.2,1,344187,95138,26880,13290,0.669156087,0.220295366,0.331467186,0.773870426
12+
lt_gee_nbr_greatest_tuning_modelproportion_5,model proportion 0.5,10,3,0.25,0.2,0.5,344187,95138,26880,13290,0.669156087,0.220295366,0.331467186,0.773870426
13+
lt_gee_nbr_greatest_tuning_maxsegments_16,max segments 16,16,3,0.25,0.05,0.75,343860,94576,27455,13604,0.668671911,0.224983816,0.336685266,0.774387637
14+
lt_gee_nbr_greatest_tuning_maxsegments_14,max segments 14,14,3,0.25,0.05,0.75,343864,94711,27299,13621,0.667130987,0.223743955,0.335100964,0.774070637
15+
lt_gee_nbr_greatest_tuning_recoverythreshold_08,recovery threshold 0.8,10,3,0.8,0.05,0.75,336819,85239,36129,21308,0.629019621,0.297681432,0.404116216,0.777793303
16+
lt_gee_nbr_greatest_tuning_recoverythreshold_09,recovery threshold 0.9,10,3,0.9,0.05,0.75,335408,84959,36275,22853,0.613499526,0.299214742,0.402246593,0.775155111
17+
lt_gee_nbr_greatest_tuning_recoverythreshold_1,recoverythreshold 1,10,3,1,0.05,0.75,334394,84785,36347,23969,0.602609589,0.30006109,0.400632688,0.773190544
18+
lt_gee_nbr_greatest_tuning_combo_1,combo 01,12,1,0.75,0.1,0.75,336098,84606,36545,22246,0.62160875,0.301648356,0.406186438,0.777157217
19+
lt_gee_nbr_greatest_tuning_combo_2,combo 02,16,1,0.75,0.1,0.75,334581,83863,37104,23947,0.607754173,0.306728281,0.407695942,0.775159282
20+
lt_gee_nbr_greatest_tuning_combo_3,combo 03,16,5,0.75,0.1,0.75,334741,83807,37190,23757,0.610202307,0.307362992,0.408807105,0.775672322
21+
lt_gee_nbr_greatest_tuning_combo_4,combo 04,12,5,0.75,0.1,0.75,336362,84389,36813,21931,0.626668255,0.303732612,0.40915608,0.778266718
22+
lt_gee_nbr_greatest_tuning_combo_5,combo 05,16,5,0.5,0.1,0.75,339750,85242,36167,18336,0.663578152,0.297893896,0.411194233,0.783985234
23+
lt_gee_nbr_greatest_tuning_combo_6,combo 06,12,5,0.5,0.1,0.75,340656,85643,35910,17286,0.675050756,0.295426686,0.410989476,0.785338742
24+
lt_gee_nbr_greatest_tuning_combo_7,combo 07,16,5,0.75,0.2,0.75,334598,83648,37366,23883,0.610067103,0.308774191,0.410022879,0.775741144
25+
lt_gee_nbr_greatest_tuning_combo_8,combo 08,12,5,0.75,0.2,0.75,336217,84214,36972,22092,0.625965055,0.305084746,0.410230236,0.778295915
26+
lt_gee_nbr_greatest_tuning_combo_10,combo 10,16,1,0.75,0.05,0.75,334787,83921,37118,23669,0.610623982,0.306661489,0.408280444,0.775618098
27+
lt_gee_nbr_greatest_tuning_combo_9,combo 09,16,5,0.5,0.05,0.75,340170,85441,35994,17890,0.667990498,0.296405484,0.410611514,0.78450036
28+
lt_gee_nbr_greatest_tuning_combo_11,combo 11,12,1,0.5,0.1,0.75,340207,85702,35775,17811,0.667618408,0.294500193,0.408710007,0.784120794
29+
lt_gee_nbr_greatest_tuning_combo_12,combo 12,16,1,0.5,0.1,0.75,339370,85050,36363,18712,0.66024512,0.299498406,0.412073342,0.783601497
30+
lt_gee_nbr_greatest_tuning_combo12_dur_1,duration 1,16,1,0.5,0.1,0.75,355725,123770,0,0,NA,0,NA,0.741874264
31+
lt_gee_nbr_greatest_tuning_combo12_dur_2,duration 2,16,1,0.5,0.1,0.75,341655,91897,29475,16468,0.641555841,0.242848433,0.352329438,0.774001814
32+
lt_gee_nbr_greatest_tuning_combo12_mmu_10,mmu 10,16,1,0.5,0.1,0.75,341116,86639,35001,16739,0.676478547,0.287742519,0.403748991,0.78440234
33+
lt_gee_nbr_greatest_tuning_combo12_mmu_15,mmu 15,16,1,0.5,0.1,0.75,342603,88443,33428,15021,0.689962641,0.274290028,0.392531705,0.784222985

getting_started.qmd

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Getting Started
2+
3+
## Recommended papers and resources
4+
Both the original LandTrendr paper [Kennedy et al. 2010](https://sciencedirect.com/science/article/pii/S0034425710002245?via%3Dihub) and the GEE engine implementation paper [Kennedy et al. 2018](https://www.mdpi.com/2072-4292/10/5/691) are excellent jumping off points for understanding how the algorithm works.
5+
6+
For more specific information on LandTrendr in GEE, the holy grail is the [eMapR LT GEE Guide](https://emapr.github.io/LT-GEE/index.html). This document walks you through running LandTrendr in GEE step by step, with example code. Speaking of code, most of us in the CAFRI lab use the [eMapR API code](https://emapr.github.io/LT-GEE/example-scripts.html) (or derivatives of it) when running LandTrendr. These scripts are the easiest place to start if you would like to run LandTrendr on your own. For quick reference, the [GEE developers guide](https://developers.google.com/earth-engine/apidocs/ee-algorithms-temporalsegmentation-landtrendr) has good information about algorithm parameter defaults.
7+
8+
For those who may be interested in exploring LandTrendr without wading into running the algorithm themselves, the eMapR group have also developed several [UI applications](https://developers.google.com/earth-engine/apidocs/ee-algorithms-temporalsegmentation-landtrendr) of LandTrendr that offer several different ways to interact with LandTrendr timeseries data.
9+
10+
11+
## Understanding algorithm parameters
12+
The LandTrendr algorithm has several parameters that a user can adjust to control how the algorithm segments the time series of spectral data. While each of these parameters serves a specific purpose, there are some that we have found to be more useful than others. For more detailed discussion of each parameter, and their sensitivity, see [Kennedy et al. 2010](https://sciencedirect.com/science/article/pii/S0034425710002245?via%3Dihub). For information on adjusting these parameters for using Landtrendr in the Northern Forest Region see [Algorithm Tuning](tuning.qmd)
13+
14+
### Recovery Threshold
15+
The recovery threshold parameter sets the minimum allowable length of time after a disturbance event for spectral recovery. That is, this parameter control what length of time is 'too fast' to see a recovery of spectral values. By default this time period is 4 years (recovery period is the inverse of recovery threshold, 0.25 = 4 year recovery period) which in the Northeast is quite a long time, as our forest disturbance events tend to be low intensity and there is often advanced regeneration ready to fill any new canopy gaps. This parameter is the first parameter that we adjust in the CAFRI lab, often setting it to 0.75 (see [Algorithm Tuning](tuning.qmd) for more).
16+
17+
### Max Segments
18+
This parameter is the only algorithm parameter without a default value as the appropriate number of segments depends on how long of a time period you are studying. For example, if you have a 3 year time period you wouldn't want to have the same maximum number of segments as a 30 year time period, otherwise you would have a segmentation that is much more complex than would be reasonable for a short amount of time. Therefore the general rule is, the longer the time period, the more segments that you need.
19+
20+
```{r, echo = FALSE}
21+
library(kableExtra)
22+
23+
data <- read.csv("files/LTparams.csv")
24+
25+
kbl(data[1:8,],
26+
align = "llc",
27+
caption = "LandTrendr Segmentation Parameters") %>% kable_styling("striped")
28+
29+
```
30+
### Mapping Parameters
31+
There is also a second set of parameters that are easily adjusted by the user that control which parts of the segmented time series are exported to a change map output. These parameters can greatly affect how your change map appears, and as such are important to understand. For more details on these parameters see the [eMapR API documentation](https://emapr.github.io/LT-GEE/api.html#getchangemap).
32+
33+
```{r, echo = FALSE}
34+
35+
data <- readr::read_csv("files/LTparams.csv", show_col_types = FALSE)
36+
rownames(data) <- NULL
37+
38+
kbl(data[9:14,1:2],
39+
align = "llc",
40+
caption = "LandTrendr Change Map Parameters") %>% kable_styling("striped")
41+
42+
```
43+
44+
## Selecting imagery
45+
46+
One thing to be aware of when you are running LandTrendr is what imagery you are feeding into the algorithm. If you are using one of the eMapR scripts, the selection of imagery happens under the hood in a separate piece of code that is called to actually run the algorithm. As of April 2024, all the eMapR scripts default to Collection 2 Landsat imagery. For most users, who want to run Landtrendr on Landsat imagery, this is not a problem. However, if you want to use other timeseries data or if you are generating outputs over long periods of time, you may need to adjust this.
47+
48+
Additionally, if you are using the eMapR scripts, their API is designed to automatically be compatible with [many common spectral indcies](https://emapr.github.io/LT-GEE/api.html#spectral-index-codes) which makes it easy to switch between indices. In the CAFRI lab we almost always run LandTrendr on NBR, as we have found it to have the best performance.

index.qmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Introduction
2+
This document is a collection of resources for using the LandTrendr change detection algorithm. While it is by no means a comprehensive overveiw of all of the information available on this popular algorithm, it can hopefully serve as a jumping off point for expoloration of the many applications of this algorithm. Additionally, it serves as a discussion of the tuning work undertaken by the [Climate and Applied Forest Research Institue](https://cafri-ny.org/) at SUNY ESF made possible through funding from the Forest Ecosystem Monitoring Collective (FEMC).
3+
4+
5+
6+
7+
![ ](files/cafri_logo.png){width=30% fig-align="center"}

timesync.qmd

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Time Sync
2+
3+
Checking the accuracy of your LandTrendr outputs requires a separate set of forest disturbance data. LandTrendr was developed with a companion program for developing reference data called TimeSync [(Cohen et al. 2010)](https://www.sciencedirect.com/science/article/pii/S0034425710002269?casa_token=5dwPh35iYXEAAAAA:JAHBTinrPXKX1c33228fJrUDY0ZAv9Wczlm7gXrGik8lvaEWdvlPkADw4F46sNNEnj4IhOStdQ). For CAFRI members in the past, [gaining access](https://timesync.forestry.oregonstate.edu/Projects.html) to this program has been a challenging, requiring lots of chasing the system administrators around by email. Using the program can also be some frustrating, as it doesn’t allow for any customization to the labeling process, however we have not found or created a better alternative yet (maybe you will!). The eMapR group does have a [desktop version](https://github.com/eMapR/TimeSync-Legacy) for windows computers available, but this has not yet been tested by any CAFRI personnel.
4+
5+
6+
## Using TimeSync
7+
8+
Once you are able to set up a timesync project, using the software is fairly straight forward. The [user manual](https://timesync.forestry.oregonstate.edu/tutorial.html) is the best available instructional document that we have found. The mentioned online tutorial with examples no longer appears to exist. Some disturbance types are difficult to distinguish based on spectral trajectory alone, and we found it to be helpful to have auxillery imagery to compare with the data presented in timesync. For this imagery we used the historical imagery in the Desktop version of Google Earth. This interface was easy to use, allows the user to import shapefiles (ie. your timesync plot locaions), and requires no local hosting of imagery. However, the temporal frequency of this imagery is not ideal, with gaps of 10+ years in some locations.
9+
10+
One final note, any comments made within the TimeSync platform do not export with your final data, so keep that in mind if you are leaving commments that are important for the interpretation of your final labeled trajectories.
11+
12+
## Alternatives to TimeSync
13+
14+
The only alternative to TimeSync that we have come across is [CollectEarth](https://www.collect.earth/) software. In our exploration this software was much more customizable, but lacked the tailored timeseries comparisons that makes TimeSync work so well with LandTrendr. CollectEarth does have many more imagery options, so could be used as a source of auxillery refernce imagery.

0 commit comments

Comments
 (0)