SkillAgentSearch skills...

COASTGUARD

Coastal Observation + Analysis using Satellite-derived Timeseries, Generated Using AI + Real-time Data

Install / Use

/learn @fmemuir/COASTGUARD
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

COASTGUARD_logo

Coastal Observation + Analysis with Satellite-derived Timeseries,

Generated Using AI + Real-time Data

is a Python toolkit for coastal monitoring and modelling using machine learning approaches.

Useful Files to Start

  • :artificial_satellite: VedgeSat_DriverTemplate: For extracting coastal vegetation edges (and optional waterlines) from public satellite images
  • :chart_with_upwards_trend: CoasTrack_DriverTemplate: For generating cross-shore transects and intersecting with different remotely sensed coastal change metrics (vegetation, waterlines, waves, topography)
  • :crystal_ball: CoastLearn_DriverTemplate: For predicting future vegetation edge and waterline positions using an entirely satellite-data-driven neural network Currently, the main toolset <b>VedgeSat</b> is for extracting <b>coastal vegetation edges</b> from satellite imagery, which is partially built on the CoastSat toolbox. The paper validating this approach is here.

https://github.com/fmemuir/COASTGUARD/assets/22475417/0ffaeea4-adeb-41c7-9936-937d9899df6c

:warning: PATCH NOTES :wrench:

  • 28 October 2024: Related to 23 Oct updates, the transect intersection with waterlines has been streamlined to try and speed up the process. This is in a new function Transects.GetWaterIntersections(). Users can still call the old/stable Transects.GetBeachWidth() if desired.

  • 23 October 2024: CoastSat.slope has now been implemented to get more robust per-transect slopes for tidal correction of waterlines, as opposed to the old way of a user-provided single slope value. You can opt to use this by writing in your driver file and then calling:

    beachslope = None
    ...
    TransectInterGDFWater = Transects.GetWaterIntersections(BasePath, TransectGDF, TransectInterGDF, WaterlineGDF, settings, output, beachslope)
    

    (or use the old method by providing an average value between 0.007 and 0.565, e.g. beachslope = 0.01).

  • 14 October 2024: Google Earth Engine has migrated all Landsat images from Collection 1 to Collection 2. This means the server names/paths have changed from C01 to C02. This has been updated throughout the code, more details in this issue thread and in the GEE documentation.

  • 26 June 2024: Some new Sentinel-2 images no longer have the same quality assurance/masking band names (QA10, QA20, QA60). QA60 is used to generate cloud masks in pre-processing. An option has been added to use the new opaque cloud mask band name MSK_CLASSI_OPAQUE if QA60 isn't available. More details in this issue thread.

  • 25 March 2024: In response to the Copernicus Marine Service November 2023 updates, the wave data download functions have been overhauled (more info here). Use of Motu for downloading data has been discontinued, the in-house Copernicus client is now being used instead (which is only working via pip right now). This requires the copernicusmarine package; if you created a conda environment for COASTGUARD prior to this update, add it to your coastguard environment with:

    conda activate coastguard
    pip install copernicusmarine
    
  • 28 February 2024: Second update to the code in response to the same issue; location mismatches were found in the coastal buffer vs. satellite images, but only for Landsat imagery (see this issue thread for more info). The reason is Landsat images are always stored in projection system UTM North (even if in the southern hemisphere), to avoid issues with images falling across the equator. A function to find correct UTM codes for a user's AOI has been included in Toolbox.py. This requires the utm package; if you created a conda environment for COASTGUARD prior to this update, add it to your coastguard environment with:

    conda activate coastguard
    conda install utm
    
  • 21 February 2024: Recent updates have been made to incorporate the AROSICS package into the COASTGUARD toolkit, to coregister satellite images after obtaining their metadata (and georeferencing info) from GEE. Implementing this led to knock-on changes that were made (namely a big update to geemap). See this issue thread for more info. This requires the arosics package and an update to the geemap package; if you created a conda environment for COASTGUARD prior to this update, add it to your coastguard environment with:

    conda activate coastguard
    conda update geemap
    conda install arosics
    
  • January 2024: Google have recently updated their authentication proces for using Earth Engine. You may be prompted to create an Earth Engine cloud project before you can generate a token for using Earth Engine within notebook environments. Just call it something related like ee-coastguard.

Description and Scope

The goal of this toolkit is to have a fully operational framework for predicting coastal change, using machine learning techniques that are trained with satellite observations. With just one satellite image, multiple indicators of coastal change can be automatically extracted such as wave breaking zones, wet-dry boundaries, high water marks and vegetation edges. These automatically extracted indicators can then be fed into a machine learning network which makes future predictions based on the past changes and relationships between these indicators. The result is an automated, early warning system for coastal erosion at a potentially global scale.

https://github.com/fmemuir/COASTGUARD/assets/22475417/cb27e704-f361-4f34-b999-dcd5c990816c

Enhancements

Various improvements have been made to the toolkit to address recent advancements in satellite-derived coastal monitoring, and to incorporate new Python packages and tools for more seamlessness. These are detailed further in the methods paper, but include:

  • ⚙️ The use of geemap to download and process satellite imagery from Google Earth Engine entirely from within the cloud server;
  • 📐 Improved transect creation based on the Dynamic Coast project's Coastal Mapping Tools;
  • 🐼 The use of geopandas to handle geospatial data (both loading in and exporting out) and for transect+shoreline intersections;
  • ↔️ Beach width (the distance between vegetation edge and wet-dry line) extracted for each transect (based on calling of some of the original CoastSat functions to classify the water line);
  • ☑️ Validation functions to quantify the error between satellite-derived vegetation edges and ground-truthed validation edges (from ground surveys or manual digitisation of aerial imagery);
  • 📊 Various plotting functions, such as violin plots for distances between satellite lines and validation lines, and GIFs of extracted edges and their respective satellite images.

1. Installation

INSTALL QUICK VERSION

  1. Open a command line, navigate to your favoured spot for the repo folder, and download the repo: git clone https://github.com/fmemuir/COASTGUARD.git
  2. Navigate into COASTGUARD and run the shell script from the command line: ./install.sh

INSTALL STEPS SUMMARY

  1. Download repo: git clone https://github.com/fmemuir/COASTGUARD.git

    These next steps are the ones contained in the install.sh shell script.

  2. Create conda environment: conda env create -f coastguard_env.yml

  3. Activate env: conda activate coastguard

  4. Authenticate GEE: earthengine authenticate

  5. Optional: Install wave data package: pip install "copernicusmarine>=1.0,<=2.0"

Remember!: Always run conda activate coastguard each time you want to use the toolbox. You should not need to authenticate earthengine each time, just the once when installing.

1.1 Download the code

The Python tool relies on packages downloaded through Anaconda and the Google Earth Engine API to run. The preliminary step is downloading this repository. You can do this either by clicking the <span style="color:white;background-color:#2EA043;">Code</span> button at the top and downloading + extracting the zipped folder, or by navigating to where you want to download it on your local machine and running

git clone https://github.com/fmemuir/COASTGUARD.git

from a command line (if you have git command line tools installed).

If you downloaded the code zip file manually, it's recommended you extract the files to a new local folder rather than keeping it in your Downloads.

1.2 Create a conda enviroment

To run the toolbox you first need to install the required Python packages in an environment. If you don't already have it, Anaconda can be downloaded freely here.

Once you have Anaconda installed on your PC:

  • Windows: open the Anaconda Prompt (not Powershell)
  • Mac and Linux: open a terminal window

and navigate to the folder with the repository files using cd.

Navigate to the COASTGUARD repository folder (cd COASTGUARD) and then create a new conda environment named coastguard with all the required packages by entering this command (make sure you're in the repo

View on GitHub
GitHub Stars53
CategoryEducation
Updated22d ago
Forks13

Languages

Python

Security Score

85/100

Audited on Mar 4, 2026

No findings