Getting Started¶
CoastSeg works best on sand and gravel beaches. It is not as effective at other sites or a marsh beaches.
Prerequisites¶
1.Sign up to use Google Earth Engine Python API
-
Follow the guide to setup Google Earth Engine: Sign up for Google Earth Engine for the First Time
-
Follow the guide to enable Google earth Engine for your project : Check if Google Earth Engine API is Enabled
2. Install Git
- Install git on your computer following the guide here
3. Install CoastSeg in Anaconda
Follow one of the install guides under "Installation" to install CoastSeg.
-
For most users the basic install guide will work
-
If you are on a secure network then you may need to follow the secure install guide
Installation & SetUp¶
1.Activate the coastseg conda environment
- Open anaconda prompt.
- Make sure you have coastseg installed if not follow the installation guide : basic install guide
1 |
|
- If you have successfully activated coastseg you should see that your terminal's command line prompt should now start with
(coastseg)
.
2.Download CoastSeg from GitHub
-
Before you run this step make you have install git on your computer a guide is linked here
-
Open 'git bash' (use this in the search bar on windows) and open the app.
-
Here is an example below where I have installed CoastSeg in a folder called 'projects', but you can install it wherever you'd like just make sure to remember the location.
-
After the download finishes close git bash.
1 2 3 |
|
Extract Shorelines¶
1.Launch Jupyter Lab
-
If you have never used jupyter notebook before please check out this guide: How to Use Jupyter Notebook
-
Open Anaconda prompt
-
Enter
jupyter lab SDS_coastsat_classifier.ipynb
in anaconda prompt and your notebook should automatically open in the browser -
- PLEASE MAKE SURE YOU RUN THIS IN THE COASTSEG DIRECTORY WHERE THE NOTEBOOK
SDS_coastsat_classifier.ipynb
IS LOCATED
- PLEASE MAKE SURE YOU RUN THIS IN THE COASTSEG DIRECTORY WHERE THE NOTEBOOK
1 2 3 |
|
- If this doesn't work then try entering the full path to the notebook
-- If you notebook is at C:\projects\CoastSeg
then you would enter the path C:\projects\CoastSeg\SDS_coastsat_classifier.ipynb
1 |
|
2.Authenticate with Google Earth Engine
- Run the cell located under 'Authenticate with Google Earth Engine (GEE)'
3.Run the Cell 'Create Coastseg Map Dashboard'
- Run the cell to create the map dashboard
-
After you run the cell you should see the UI appear
-
Scroll down to the interactive map
4.Draw an Bounding Box
-
Draw a bounding box along the coast in this box is where ROIs will be created.
-
You can only draw bounding boxes along the coast to generate ROIs this is because CoastSeg is only designed to extract shorelines.
Option 1: Draw a Bounding Box with the box tool
Option 2: Draw a Bounding Box with the polygon tool
- This is useful if you have back - barrier shorelines that you don't want to include
5.Generate ROI (Region of Interest)
-
ROIs can only be generated along a shoreline
-
If no shoreline is found then an error message will appear telling you no ROIs can be created. If this happens create your own reference shoreline following the guide here How to Create Reference Shoreline
6.Load Transects
-
Not all locations in the world have transects or shorelines available. Feel free to submit an issue to contribute transects or shorelines.
-
Make sure there are transects inside the ROI you have selected otherwise you won't be able to extract shorelines
-
If there isn't a reference shoreline or any transects available for your site check out the guide on how to upload your own here
7.Modify the Settings
-
Change the satellites to L8 and L9
-
Change the dates to 12/01/2023 - 03/01/2024
-
Click
Save Settings
8.Name the Session
-
Name the session 'demo_session'. This will be the name of the folder saved in
CoastSeg/sessions
. -
The folder will contain a subdirectory for each ROI from which shorelines were extracted.
-
Keeping sessions and downloaded data separate allows users to create multiple sessions from the same downloaded data, enabling experimentation with different settings.
9.Preview the available Imagery
-
Preview the amount of available imagery for the selected ROI between the dates
-
In this example ROI 'cwm3' has 18 images available from LandSat 8 and 16 images available from LandSat 9 for the date range
10. Download the ROIs
-
Click the ROIs you want to download on the map (they will turn blue when selected).
-
If no transects or reference shorelines are available for the region you have uploaded, follow the guide here.
-
NEVER rename your ROIs. This is because CoastSeg keeps track of the filename in the 'config.json' and you won't be able to load it into CoastSeg again if you do. The ROI's ID is the filename, so that information will be lost if you rename it.
-
The downloaded data can be found in
CoastSeg/data
under a folder with a name in the formatID_<ROI ID>_datetime<currenttime>
. For example, you can see the JPGs for all the images you downloaded inCoastSeg/data/ID_<ROI ID>_datetime06-17-24__11_12_40/jpg_files/preprocessed/RGB
. You can read more on how ROIs are structured in this guide -
This is example of the RGB imagery from a downloaded ROI. Here you can see the user sorted some of the imagery into a bad folder so it would not be used to extract shorelines. A full tutorial on how to filter bad imagery is available here.
11.Extract Shorelines
-
Extracting shorelines involves loading the ROI data for each selected ROI from
CoastSeg/data/<ROI ID>
and processing the downloaded rasters to extract shorelines. The resulting files are saved inCoastSeg/sessions/<YOUR SESSION NAME>/ROI_ID_NAME
for each ROI. Note that the downloaded data is NOT copied to the session; instead, theconfig.json
file in each session keeps track of the location of the downloaded ROI inCoastSeg/data
. You can read more about what is in each session in this guide. -
Extracting shorelines works by finding the land water interface in the image and drawing a line along this boundary.
-
Additionally, a time series of shoreline positions along each transect is generated.
-
You can find images that show the extracted shoreline on each image in
CoastSeg/sessions/<YOUR SESSION NAME>/ROI_ID_NAME/jpg_files/detection
as illustrated below:
Apply Tidal Correction to Extracted Shorelines (Optional)¶
1.Download the tide model
-
Before tidal correction can be applied the tide model must be downloaded
-
Follow the tutorial: How to Download Tide Model
2.Load the Session with Extracted Shorelines
-
Re-open the jupyter notebook
-
Under the 'Kernel' menu Click 'restart and clear outputs of all cells'
- Click 'Load Session' and load 'sample_session'
3.Click Correct Tides
-
Click the ROI ID from the dropdown
-- You should see some extracted shorelines on the map if you don't then the ROI ID won't appear in the dropdown
-
Enter Beach Slope
-
Enter Beach Elevation relative to Mean Sea Level