Code Documentation
Overview
This code provides a set of functions to calculate and append various statistics and properties related to transects and shorelines using Google Earth Engine (GEE). The primary functionalities include calculating distances, classifying transect change rates, generating statistics, and appending useful properties to transects and shorelines.
Dependencies
- Google Earth Engine (GEE)
- Utility functions from
../utils
- Metadata constants from
../../common/metadata
- Utility constants from
../../common/utils
Functions
calculateDistances
Calculates the distance of each shoreline to the point of interest given by the intersection of the transect with the baseline.
Parameters
-
transect
(ee.Feature
): The transect feature. -
baseline
(ee.Geometry.LineString
): The reference baseline. -
shorelines
(ee.FeatureCollection
): The collection of shoreline features.
Returns
-
ee.Dictionary
: A dictionary containing the distances.
Example
const distances = calculateDistances(transect, baseline, shorelines);
estevesLabelling
Classifies the transect change rate using the intervals proposed by Esteves and Finkl (1998).
Parameters
-
lrr
(ee.Number
): The linear regression rate.
Returns
-
ee.String
: The classified linear regression rate.
Example
const label = estevesLabelling(lrr);
calculateStatistics
Calculates the general DSAS Statistics (SCE, NSM, EPR, LRR) and Esteves classification for a given dictionary of a transect's distance set.
Parameters
-
measurement
(ee.Dictionary
): The dictionary of distances of the transect.
Returns
-
ee.Dictionary
: A dictionary containing the statistics.
Example
const stats = calculateStatistics(measurement);
complementaryProperties
Appends useful transect data to its properties, such as latitude, longitude, serialized dates, and distance vectors.
Parameters
-
transect
(ee.Feature
): The transect feature. -
measurement
(ee.Dictionary
): The dictionary of distances of the transect. -
keepProps
(Array<String>
): The array of transect properties to keep.
Returns
-
ee.Dictionary
: A dictionary containing the useful and kept properties.
Example
const props = complementaryProperties(transect, measurement, keepProps);
generateTransectsStatistics
Adds information about DSAS statistics and Esteves classification while adding useful properties to the transects.
Parameters
-
transects
(ee.List
): The orthogonal transects. -
baseline
(ee.Geometry
): The baseline. -
shorelines
(ee.FeatureCollection
): The shorelines. -
keepProps
(Array<String>
): The array of transect properties to keep.
Returns
-
ee.List<ee.Feature>
: The transects with added statistics.
Example
const transectsWithStats = generateTransectsStatistics(transects, baseline, shorelines, keepProps);
summaryShorelineStatistics
Adds statistics about the distances observed in transects, such as standard deviation and mean, to the shorelines.
Parameters
-
transects
(ee.List<Feature>
): The list of transect features. -
shorelines
(ee.FeatureCollection
): The collection of shoreline features.
Returns
-
ee.FeatureCollection
: The shorelines with added statistics.
Example
const shorelinesWithStats = summaryShorelineStatistics(transects, shorelines);
Edge Cases and Assumptions
- Assumes that input data will always be in the expected format.
- Handles cases where no distances are calculated by returning an empty dictionary.
- If the code is based on a research paper, external libraries, or online resources, provide links or references to those resources.
References
- Esteves and Finkl (1998) for transect change rate classification intervals.