Skip to content

Commit

Permalink
#212 add tide model screenshot, how to create custom ROIs, and how to…
Browse files Browse the repository at this point in the history
… load a session by another user
  • Loading branch information
2320sharon committed Apr 19, 2024
1 parent dd211ae commit ba6a261
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Table of Contents
To learn how to load these features in follow the guide at [How to Upload Features](https://satelliteshorelines.github.io/CoastSeg/how-to-upload-features/)

## How to Create Reference Shoreline

Expand Down Expand Up @@ -60,7 +60,21 @@ In this example we will be creating a reference Shoreline for Fire Island in New
![how to add an id geojson io](https://github.com/SatelliteShorelines/CoastSeg/assets/61564689/b5be22e7-722c-4037-aac6-209a4eb692d7)
</br>

**2.Save the transects to a geoJSON file**
**3.Save the a geoJSON file**

![save geojson transects](https://github.com/SatelliteShorelines/CoastSeg/assets/61564689/9a9ccfae-96cd-49e9-b2fa-a53c48debfdb)

## How to Create ROIs

**1.Use the box tool in https://geojson.io/ to create a ROI**

**2.Edit the geojson contents to give each ROI its own ID otherwise CoastSeg will automatically assign them**

- This example shows how to do it with a transect but the process is the same for ROIs

- Make your ROI ID follows the format <3 letters 1 number> example : fvk6

![how to add an id geojson io](https://github.com/SatelliteShorelines/CoastSeg/assets/61564689/b5be22e7-722c-4037-aac6-209a4eb692d7)
</br>

**3.Save the a geoJSON file**
115 changes: 74 additions & 41 deletions docs/How-to-Download-Tide-Model.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This guide will walk you through signing up for the necessary account and then choosing between two methods to download and clip the tide model for use in CoastSeg.

# Part 1: Signing Up for the FES2014 Model

Step 1: Register for an AVISO+ Account

## Step 1: Register for an AVISO+ Account
Expand All @@ -14,20 +15,24 @@ Step 1: Register for an AVISO+ Account

![image](https://github.com/Doodleverse/CoastSeg/assets/61564689/5f188ced-0f7e-4732-b065-8eb8f2d54986)
<br>

## Step 2: Verify Your AVISO+ Account

1. Check your email for a confirmation from AVISO+.
2. Click the verification link in the email to activate your account.

## Step 3: Access Your Subscriptions

1. Log into your [AVISO account](https://www.aviso.altimetry.fr/en/my-aviso-plus.html).
2. Navigate to My products in the left side menu.
3. Confirm that FES2014 / FES2012 (Oceanic Tides Heights) is listed under Your current subscriptions.
<br>
<img src="https://github.com/Doodleverse/CoastSeg/assets/61564689/bf5382f0-6bc0-4867-893d-c8f84a3d3760" alt="drawing" width="900" height="500"/>
<br>
<img src="https://github.com/Doodleverse/CoastSeg/assets/61564689/bf5382f0-6bc0-4867-893d-c8f84a3d3760" alt="drawing" width="900" height="500"/>

![image](https://github.com/Doodleverse/CoastSeg/assets/61564689/d5758b7c-7a4a-4f48-8b0b-244a0f8d7d7a)

# Part 2: Downloading and Clipping the Tide Model

You have two options to download and clip the tide model: using a Jupyter Notebook (Recommended) or using a Script (Alternative). Choose one based on your comfort level and requirements.

### Space and Time Requirements
Expand All @@ -36,50 +41,74 @@ You have two options to download and clip the tide model: using a Jupyter Notebo
- **Time Commitment:** The download and setup process for the fes2014 model takes approximately 1-2 hours. This is a one-time requirement.

## Option 1: Using the Download_tide_model.ipynb Notebook (Recommended)

The easiest way to download and clip the tide model is to use this notebook. Run all the code in the notebook and you're done!

1. **Prepare:** Ensure you have you are in an activated coastseg environment and know your AVISO email and password.
2. **Open Notebook:** Launch `Download_tide_model.ipynb` in Jupyter Notebook.

```
cd CoastSeg
jupyter lab Download_tide_model.ipynb
```

3.**Run Code:** Execute all cells in the notebook. The code will guide you through the download and clipping process automatically.
4. **Check Results:** Confirm that the model files are correctly downloaded and clipped in the specified directory.
- **Example Output from Downloading Tide Model Step in Notebook**

4.**Check Results:** Confirm that the model files are correctly downloaded and clipped in the specified directory.

- **Example Output from Downloading Tide Model Step in Notebook**

![image](https://github.com/Doodleverse/CoastSeg/assets/61564689/6f4b8998-2d9f-4284-b0bb-075634efd1e8)
- **Example Output from Clipping Tide Model Step in Notebook**
![image](https://github.com/Doodleverse/CoastSeg/assets/61564689/7251f6ca-acd4-4dda-9429-28bb83daad04)

- **Example Output from Clipping Tide Model Step in Notebook**
![image](https://github.com/Doodleverse/CoastSeg/assets/61564689/7251f6ca-acd4-4dda-9429-28bb83daad04)

5.**Downloaded Tide Model Contents**

![tide model contents](https://github.com/SatelliteShorelines/CoastSeg/assets/61564689/2a8f2425-993f-4184-90cf-01b6ff65af4a)

# Option 2: Using the Script (Alternative)

## Setup

1. Create Directory: Navigate to your CoastSeg installation directory and create a new folder named tide_model.
2. Script Location: Change directory to the scripts folder within CoastSeg.

```
cd <location of your coastseg directory>
mkdir tide_model
cd scripts
```

![image](https://github.com/Doodleverse/CoastSeg/assets/61564689/abe482c6-e1d8-4d0b-adba-45ce6a0fd952)

## Download & Clip
1. **Run Download Script:** Execute the `aviso_fes_tides.py` script with the necessary parameters, including your AVISO credentials and target directory for the tide model.

1. **Run Download Script:** Execute the `aviso_fes_tides.py` script with the necessary parameters, including your AVISO credentials and target directory for the tide model.

- ⚠️ Enter your AVISO password when prompted. Note that the password won't display as you type. After you have finished typing, press Enter to proceed.
- Replace `C:\Users\Sample\coastseg` with the actual location of your CoastSeg directory.
- ![AVISO Password Prompt](https://github.com/Doodleverse/CoastSeg/assets/61564689/70c9306a-853c-45d5-8957-fd214c1c7ffd)
Example command:
Example command:

```
python aviso_fes_tides.py --user [email protected] -D C:\Users\Sample\coastseg\tide_model --load --log --tide FES2014 -G
```

2. **Clip Model to Regions:** After downloading, run the `clip_and_write_new_nc_files_cmd_line.py` script with the paths to your tide model directory and the regions geojson file.

To make the tide predictions compute faster we will clip the model it to various regions across the planet. After we've clipped the model to each region, when we want to predict the tide at a particular latitude and longitude we first figure out which region the point lies within, then we load the tide model we clipped to that region.

- `-R or --regions_file` the full path to the regions geojson file. You should find this file `tide_regions_map.geojson` in the `scripts`
- `-T or --tide_model` the full path to the directory containing the tide model downloaded
- Replace `C:\Users\Sample\coastseg` with the actual location of your CoastSeg directory.

```
python clip_and_write_new_nc_files_cmd_line.py -T C:\Users\Sample\coastseg\tide_model -R C:\Users\Sample\coastseg\scripts\tide_regions_map.geojson
```

3. **Validate:** Ensure each region directory under tide_model contains clipped tide model files.

- Each region will have the same format as region0 the full list of files is omitted for brevity.

```
Expand Down Expand Up @@ -123,7 +152,13 @@ python clip_and_write_new_nc_files_cmd_line.py -T C:\Users\Sample\coastseg\tide_
| |_ region10
```

4.**Downloaded Tide Model Contents**

![tide model contents](https://github.com/SatelliteShorelines/CoastSeg/assets/61564689/2a8f2425-993f-4184-90cf-01b6ff65af4a)

## Running into Problems?

---

1. Your account may not be verified yet, which means you can't download the model
Expand All @@ -138,88 +173,84 @@ If you are running coastseg on a secure network you may need to make the followi
2. You may also need to modify the `ssl_verify` to either True or False depending on your network security.
- Always switch `ssl_verify` to True if you ever set it it to False for debugging purposes.


# How to Perform Tide Correction
# How to Perform Tide Correction

⚠️ You must have run the script to download the FES2014 tide model before attempting to correct tides
This script provides utilities for modeling tides and correcting time series data based on tide predictions.

## ⚠️ Important: Read Before Using Tide Correction Button

If the tide model was NOT downloaded to `CoastSeg/tide_model` then the tide correction button will NOT work. The tide correction button will try to load the tide model from `<CoastSeg location>/tide_model` and an error will occur. Instead follow the instructions in at [Option 2: Tide Correction Script](#option-2-tide-correction-script)

If you downloaded the tide model to a different location follow the instructions at [Option 2: Tide Correction Script](#option-2-tide-correction-script)
to use the script `apply_tidal_correction.py`
to use the script `apply_tidal_correction.py`


## Option 1: Tide Correction Button Method
## Option 1: Tide Correction Button Method

Ever since coastseg 1.1.0 released you can now use the `correct tides` button in coastseg to automatically correct the timeseries. This button will automatically find which files need to be tidally corrected and apply the tidal correction for you.

## ⚠️ Important

If the tide model was NOT downloaded to `CoastSeg/tide_model` then the tide correction button will NOT work. The tide correction button will try to load the tide model from `<CoastSeg location>/tide_model` and an error will occur. Instead follow the instructions in at [Option 2: Tide Correction Script](#option-2-tide-correction-script)

### Steps

**WARNING**
You must have downloaded the tide model to the `tide_model` folder within coastseg for this button to work correctly.
You must have downloaded the tide model to the `tide_model` folder within coastseg for this button to work correctly.

1. **Enter the beach slope**

- This is the beach slope in meters for the ROI you have selected.
- This is the beach slope in meters for the ROI you have selected.

2. **Enter the beach elevation**

- This is the beach elevation in meters for the ROI you have selected.
- This is the beach elevation in meters for the ROI you have selected.

3. **Select the ROIs' ids to tidally correct**

4. **Click compute tides and wait a few minutes.**

If you encounter any issues or have any questions please submit an issue at [CoastSeg Issues](https://github.com/Doodleverse/CoastSeg/issues/new/choose)


![image](https://github.com/Doodleverse/CoastSeg/assets/61564689/c72ee626-86fd-46ae-98d0-0921b0082d8b)


## Option 2: Tide Correction Script

⚠️ If the tide model was NOT downloaded to `CoastSeg/tide_model`, then you must use the tide correction script.
⚠️ If the tide model was NOT downloaded to `CoastSeg/tide_model`, then you must use the tide correction script.

### Example 1: Apply Tide Correction to a session and provide tide model location

1. **Choose a session**
- In this example I will be using session `dnz3_extract_shorelines_10_yr` and using ROI `ID_dnz3_datetime12-22-23__09_10_44`
- Example: `C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44`
- In this example I will be using session `dnz3_extract_shorelines_10_yr` and using ROI `ID_dnz3_datetime12-22-23__09_10_44`
- Example: `C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44`
2. **Get the location of the config_gdf.geojson file**
- This parameter is used after the `-C `
- Example: `-C "C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44\config_gdf.geojson"`
- This parameter is used after the `-C `
- Example: `-C "C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44\config_gdf.geojson"`
3. **Get the location of the transect_time_series.csv file**
- This parameter is used after the `-T `
- Example: `-T "C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44\transect_time_series.csv"`
- This parameter is used after the `-T `
- Example: `-T "C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44\transect_time_series.csv"`
4. **Get the location of the tide_model**
- This parameter is used after the `-M`
- Example: `-M "C:\development\doodleverse\coastseg\CoastSeg\tide_model"`
- This parameter is used after the `-M`
- Example: `-M "C:\development\doodleverse\coastseg\CoastSeg\tide_model"`
5. Select a Beach Elevation
- This is the elevation of the beach in meters for the ROI you have selected
- Example: `-E 3.2`
- This is the elevation of the beach in meters for the ROI you have selected
- Example: `-E 3.2`
6. Select a Beach Slope
- This is the slope of the beach in meters for the ROI you have selected
- Example: `-S 2.1`
- This is the slope of the beach in meters for the ROI you have selected
- Example: `-S 2.1`
7. **Assemble the command**
- Assemble all commands into a single line. I recommended using notepad to combine all the commands into a single line
```
python apply_tidal_correction.py -E 3.2 -S 2.1 -C
"C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44\config_gdf.geojson" -T
"C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44\transect_time_series.csv"
-M "C:\development\doodleverse\coastseg\CoastSeg\tide_model"
```
- Assemble all commands into a single line. I recommended using notepad to combine all the commands into a single line
```
python apply_tidal_correction.py -E 3.2 -S 2.1 -C
"C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44\config_gdf.geojson" -T
"C:\development\doodleverse\coastseg\CoastSeg\sessions\dnz3_extract_shorelines_10_yr\ID_dnz3_datetime12-22-23__09_10_44\transect_time_series.csv"
-M "C:\development\doodleverse\coastseg\CoastSeg\tide_model"
```
8. **Run the command**
- It takes a few minutes to predict the tides
- It takes a few minutes to predict the tides

![image](https://github.com/Doodleverse/CoastSeg/assets/61564689/13582ba7-63c6-46d4-93c1-aa68db23626c)

### Parameters:

1. **-C (or -c) [CONFIG_FILE_PATH]**
Expand Down Expand Up @@ -300,7 +331,9 @@ python apply_tidal_correction.py -E 3 -S 2 -C "C:\development\doodleverse\coasts
```

## Results

The results will be located in the scripts directory where the `apply_tidal_correction.py` script is located.

- `tidal_predictions.csv`: Contains the tide predictions for each datetime in the timeseries csv file given by `RAW_TIMESERIES_FILE_PATH`.
- `"tidally_corrected_time_series.csv"`: Contains the tidally corrected time series data based on the timeseries csv file given by `RAW_TIMESERIES_FILE_PATH`.

Expand Down
2 changes: 2 additions & 0 deletions docs/how-to-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jupyter lab SDS_coastsat_classifier.ipynb

- Click the `Generate ROIs` button. This action creates a grid of ROIs along the shoreline within the bounding box.

- If you want to use your own custom ROIs follow the tutorial [How to Upload Features](https://satelliteshorelines.github.io/CoastSeg/how-to-upload-features/)

5.Select Desired ROIs:

- After the ROIs appear on the map, select those for which you want to download satellite imagery.
Expand Down
2 changes: 0 additions & 2 deletions docs/how-to-use-a-session-another-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ If you have a session from another user you want to load into CoastSeg follow th

![warning missing rois loaded from session](https://github.com/SatelliteShorelines/CoastSeg/assets/61564689/2c67676e-cf86-4493-884d-452bda356d26)


- As you can see in the screenshot below the first ROI downloads all the missing imagery, while the second ROI which we had the downloaded data for only downloads a single image because 5 images already exist.

![partial download 2 rois](https://github.com/SatelliteShorelines/CoastSeg/assets/61564689/86de7b4a-51de-47b8-9a00-b9d903aded39)

2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ nav:
- Extract Shorelines Settings Guide: extract_shoreline_settings.md
- How to Download the Tide Model: How-to-Download-Tide-Model.md
- How to Tidally Correct: How-to-Tidally-Correct.md
- How to Create Reference Shorelines & Transects: How-to-Create-Reference-Shorelines-&-Transects.md
- How to Create Reference Shorelines & Transects & ROIs: How-to-Create-Reference-Shorelines-&-Transects&ROIs.md
- How to Filter Bad Imagery: How-to-Filter-Out-Bad-Imagery.md
- How to Use the Config Files: config.md
- API Reference:
Expand Down

0 comments on commit ba6a261

Please sign in to comment.