Skip to content

⚠️ Before you begin ⚠️

Make sure you have downloaded the FES2014 tide model following the guide 'How to Download the Tide Model'

Apply 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

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"

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"

4.Get the location of the 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 relative to MSL(Mean Sea Level) 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

7.Assemble the command

  • Assemble all commands into a single line. I recommended using notepad to combine all the commands into a single line
1
2
3
4
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

image

Parameters:

1.-C (or -c) [CONFIG_FILE_PATH]

  • Description: Path to the configuration file.
  • Example: -C "path_to_config_file"
  • CONFIG_FILE_PATH: Path to the configuration file. This is the config_gdf.geojson in the session directory generated when shorelines were extracted

2.-T (or -t) [RAW_TIMESERIES_FILE_PATH]

  • Description: Path to the raw timeseries file.
  • Example: -T "path_to_timeseries_file"
  • RAW_TIMESERIES_FILE_PATH: Path to a csv file containing the time series created by extracting shorelines with coastseg. This timeseries represents the intersection of each transect with the shoreline extracted for a particular date and time. It is not tidally corrected.

3.-E (or -e) [REFERENCE_ELEVATION]

  • Description: Set the reference elevation value. This is a float number.
  • Example: -E 3

4.-S (or -s) [BEACH_SLOPE]

  • Description: Set the beach slope value. This is a float number.
  • Example: -S 2

Optional Configuration Options

If you didn't install the tide model in the default location you will need to modify the following variables

5.-P (or -p) [TIDE_PREDICTIONS_FILE_NAME]

  • Description: File name for saving a csv file containing the tide predictions for each date time in the timeseries provided.
  • By Default this file is named "tidal_predictions.csv"
  • Example: -P "tidal_predictions.csv"

6.-O (or -o) [TIDALLY_CORRECTED_FILE_NAME]

  • Description: File name for saving the tidally corrected time series csv file.
  • By Default this file is named "tidally_corrected_time_series.csv"
  • Example: -O "tidally_corrected_time_series.csv"

7.-R (or -r) [MODEL_REGIONS_GEOJSON_PATH]

  • Description: Path to the model regions GeoJSON file.
  • By default the program looks for tide_regions_map.geojson in the scripts directory
  • Example: -R "c:\coastseg\scripts\tide_regions_map.geojson"
  • MODEL_REGIONS_GEOJSON_PATH: Path to the location of the geojson file containing the regions used to create the clipped tide model in the previous steps. This file is typically located in the scripts directory within coastseg. "c:\coastseg\scripts\tide_regions_map.geojson"`

8.-M (or -m) [FES_2014_MODEL_PATH]

  • Description: Path to the FES 2014 tide model directory.
  • Example: -M "c:\coastseg\tide_model"
  • FES_2014_MODEL_PATH: Path to the FES 2014 tide model, by default attempts to load from coastseg\tide_model if you installed the tide_model from in a different location then CoastSeg/tide_model then modify this variable to have the full location to the directory containing the clipped 2014 fes tide model.

Running the script:

Use the parameters as described while executing the script. Here's an example usage: Example 1: Only Required Parameter

1
2
cd scripts
python apply_tidal_correction.py -C "path_to_config" -T "path_to_timeseries" -E 3 -S 2
1
python apply_tidal_correction.py -E 3 -S 2 -C "C:\development\doodleverse\coastseg\CoastSeg\sessions\fire_island\ID_ham1_datetime08-03-23__10_58_34\config_gdf.geojson" -T "C:\development\doodleverse\coastseg\CoastSeg\sessions\fire_island\ID_ham1_datetime08-03-23__10_58_34\transect_time_series.csv"

Example 2: All Available Parameters

1
2
cd scripts
python apply_tidal_correction.py -C "path_to_config" -T "path_to_timeseries" -E 3 -S 2 -P "predictions.csv" -O "corrected.csv" -R "regions.geojson" -M "model_directory"
1
2
cd scripts
python apply_tidal_correction.py -E 3 -S 2 -C "C:\development\doodleverse\coastseg\CoastSeg\sessions\fire_island\ID_ham1_datetime08-03-23__10_58_34\config_gdf.geojson" -T "C:\development\doodleverse\coastseg\CoastSeg\sessions\fire_island\ID_ham1_datetime08-03-23__10_58_34\transect_time_series.csv" -P "tidal_predictions.csv" -O "tidally_corrected_time_series.csv" -R "C:\development\doodleverse\coastseg\CoastSeg\scripts\tide_regions_map.geojson" -M "C:\development\doodleverse\coastseg\CoastSeg\tide_model"

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.

Credits

Thank you DEA-Coastlines for making a guide on how to use pyTMD and pyTMD for making a easy to use script to download the AVISO FES 2014 Model. The model_tides in this code has been modified and the original function was originally written by Robbi Bishop-Taylor for the dea-tools package https://github.com/GeoscienceAustralia/dea-notebooks/blob/develop/Tools/dea_tools/coastal.py#L466-L473