This document shows how to setup the FES2022 global tide model to get modelled tides at a given location for a given time period.
If you have already installed coastsat
before, create a new environment with a new name, as you will need to install pyfes
first otherwise there are conflicts with the python version.
- Download Anaconda for your operating system https://docs.anaconda.com/anaconda/install/windows/
- Open the Anaconda Prompt as Administrator and type the following commands:
conda clean --all -y
conda update -n base -c conda-forge conda -y
conda create -n coastsat
conda activate coastsat
conda install fbriol::pyfes -y
conda install -c conda-forge geopandas -y
conda install -c conda-forge earthengine-api scikit-image matplotlib astropy notebook -y
pip install pyqt5 imageio-ffmpeg
Now you have setup the coastsat
python environment, which can be activated with conda activate coastsat
.
Either clone the Github repository https://github.com/kvos/CoastSat or download the zip folder and unzip in a local folder.
-
Go to this location and download the all the files and put them in a folder. These are the netcdf file containing the tidal constituents for the whole world.
- If you can't access this link, you will need to download the files yourself from the AVISO website and follow the steps below.
- If you can access the link, skip to step 7.
-
Go to https://www.aviso.altimetry.fr/ and create an account, then login. Then go to https://www.aviso.altimetry.fr/en/data/data-access/registration-form.html and fill the form, ticking FES (Finite Element Solution - Oceanic Tides Heights).
-
Navigate to My Products (https://www.aviso.altimetry.fr/en/my-aviso-plus/my-products.html) and the FES product should be there as shown here:
-
Download WinSCP or your favourite SFTP software and click use SFTP link (sftp://ftp-access.aviso.altimetry.fr:2221/auxiliary/tide_model) to create a connection.
-
Then download under /fes2022b the folders /load_tide and /ocean_tide (not /ocean_tide_extrapolate). Download all the components (34 NETCDF files) and unzip them.
-
Finally download the
fes2022.yaml
from https://github.com/CNES/aviso-fes/tree/main/data/fes2022b and save it in the same folder as /load_tide and /ocean_tide. -
Open the
fes2022.yaml
file in a text editor and change the path to each of the tidal constituents (individual netcdf files). Add the absolute path to each .nc file, an example is shown below. You can use find and replace to do this in one go. It should look like below:radial: cartesian: amplitude: amplitude latitude: lat longitude: lon paths: 2N2: C:\Users\kilia\Documents\GitHub\CoastSat\fes2022b\load_tide\2n2_fes2022.nc Eps2: C:\Users\kilia\Documents\GitHub\CoastSat\fes2022b\load_tide\eps2_fes2022.nc J1: C:\Users\kilia\Documents\GitHub\CoastSat\fes2022b\load_tide\j1_fes2022.nc K1: C:\Users\kilia\Documents\GitHub\CoastSat\fes2022b\load_tide\k1_fes2022.nc K2: C:\Users\kilia\Documents\GitHub\CoastSat\fes2022b\load_tide\k2_fes2022.nc L2: C:\Users\kilia\Documents\GitHub\CoastSat\fes2022b\load_tide\l2_fes2022.nc Lambda2: C:\Users\kilia\Documents\GitHub\CoastSat\fes2022b\load_tide\lambda2_fes2022.nc etc...
Make sure to do this for both
radial
andtide
parts of the file.Your Python environment can map shorelines and predict tides anywhere in the world.
To test your installation, open the Anaconda Prompt. Activate the coastsat environment and open Python:
conda activate coastsat
python
Locate the path to yourfes2022.yaml
file and copy it. Then type:import pyfes
filepath = PATH_TO_fes2022.yaml
handlers = pyfes.load_config(config)
This last command may take 5 minutes to run but if it doesn't return an error you are all good to go.
You can now generate tide time-series using FES2022 for any location and any dates.
# load pyfes and the global tide model (may take one minute)
import pyfes
filepath = os.path.join(os.pardir,'CoastSat.webgis','aviso-fes-main','data','fes2022b')
config = os.path.join(filepath, 'fes2022.yaml')
handlers = pyfes.load_config(config)
ocean_tide = handlers['tide']
load_tide = handlers['radial']
# load coastsat module to estimate slopes
from coastsat import SDS_slopes
# get centroid, date range and timestep
centroid = [151.3023463 -33.7239154]
date_range = [pytz.utc.localize(datetime(2024,1,1)),
pytz.utc.localize(datetime(2025,1,1))]
timestep = 900 # in seconds
# predict tides
dates_ts, tides_ts = SDS_slopes.compute_tide(centroid, date_range, timestep, ocean_tide, load_tide)