TUFLOW FV Get Tide

From TUFLOW FV Wiki
Jump to navigation Jump to search

Introduction

This tutorial demonstrates how to run the Get Tide python command line tool using conda. The Get Tide tool can be used to extract FES2014 astronomical tide boundary conditions ready to use in TUFLOW FV.

Example – Creating Tidal Boundaries For The Gulf Of Carpentaria

To use Get Tide, follow the steps outlined below:

Download Global Tide Data

Download the FES2014 tidal constituent files from the Aviso+ website using the following steps:

1. To access the FES2014 data, you will need to have an Aviso+ account. To create an account, register via completing this registration form. When you complete this form, please ensure you have ticked the box labelled FES2014 / FES2012 (Oceanic Tides Heights).

GetTide fes2014 licence agreement.png

2. Once your account has successfully been created, log in and navigate to

MY AVISO+ -> My products. Please note that it may take overnight for your account to be setup.

GetTide aviso my products.png

3. Verify that FES2014 / FES2012 (Oceanic Tides Heights) is listed under your current subscriptions. If it is not listed, select it from the product list below, submit your access request, ensuring you have read and accept the terms of the licence agreement.

GetTide aviso subscriptions.png

4. To download the data, copy the following ftp link into your Windows Explorer (not an internet browser such as Edge, Chrome etc): ftp://ftp-access.aviso.altimetry.fr/

5. Enter your Aviso+ credentials into the pop-up window.

GetTide aviso log on.png

6. Navigate to auxiliary -> tide_model -> fes2014_elevations_and_load -> fes2014b_elevations_extrapolated.

GetTide ocean tide extrapolated.png

7. Download the file ocean_tide_extrapolated.tar.xz by copying it your desired location. Once successfully copied, right click on the file and select Extract files….

GetTide ocean tide extract files.png

8. Right click on the file ocean_tide_extrapolated.tar and select Extract files…. You should now see the folder ocean_tide_extracted. This folder contains the NetCDF files of each tidal constituent within FES2014 dataset that will be used by Get Tide. Save this database somewhere central on your computer as you are likely to use it for multiple different projects and purposes.

GetTide extrapolated files.png

Define Boundary Locations

For the purposes of this demonstration we've prepared a TUFLOW FV nodestring shapefile containing polyline features where tidal water-levels are required for the Gulf of Carpentaria.

Please download and save the shape file 2d_ns_Open_Boundary_001_L.shp which can be obtained via the following download link: https://downloads.tuflow.com/TUFLOWFV/Example_Models/TUFLOWFV_GetTide_Example_Nodestrings.zip

The nodestrings within 2d_ns_Open_Boundary_001_L.shp are shown below:

GetTide nodestrings.png

Building Nodestrings For Your Own Project

For your own project you will need to generate your own TUFLOW FV external GIS nodestring files using the procedure outlined within our Introduction To GIS Integration Tutorial and Set Nodestrings In QGIS section.

TIP: The program will extract tidal boundaries for EVERY line feature in the shapefile. Only supply a shape file with open ocean boundary locations. Don't provide a shapefile with inland nodestrings (e.g., inflow boundary nodestrings). The program will try (and fail) to extract tidal water-levels for these features.

Using Get Tide

1. Setup a Python Environment that includes the Get Tide tools by following the instructions within TUFLOW FV Python Environment - TUFLOW FV Wiki.

2. Open Anaconda prompt, and activate your TUFLOW FV Python environment with the command:

  conda activate tfv-workspace

Activate tfv-workspace.png

3. In this example, we have chosen to work in the “C:\TUFLOW\Get_Tools\my_tide” directory, however you can select any location you like. Navigate to the directory you wish to work in through the command:

  cd <directory>  

GetTide cd my tide.png


Please note: To successfully change your directory location, you must be working out of the same drive that you wish to access. To change drives, enter the command:

  <drive>

GetTide change drive.png

4. To see the optional and required arguments for Get Tide, enter the command:

  GetTide

GetTide.png

5. To run the program, call Get Tide with the required arguments. These are:

  • “out”: Output name (and location). e.g., GoC_Tide_20100301_20100402_UTC.nc
  • “tstart”: The start time for the tide extraction, yyyy-mm-dd. e.g., 2010-03-01
  • “tend”: The end time for the tide extraction, yyyy-mm-dd. e.g., 2010-04-02
  • “nodestring”: The path to the nodestring shapefile. e.g., “.\nodestrings\2d_ns_Open_Boundary_001_L.shp
  • “fes2014_dir”: The path where you saved the pre-downloaded FES2014 Tidal Constituent files, e.g., “FES2014\ocean_tide_extrapolated\ocean_tide_extrapolated” . This folder should contain a set of *.nc files for the FES2014 tidal constituent grids. Please note in this example a relative path from the my_tide directory is used, however absolute file paths are also accepted.

The command entered in this example is:

  GetTide GoC_Tide_20100301_20100402_UTC.nc 2010-03-26 2010-04-02 .\nodestrings\2d_ns_Open_Boundary_001_L.shp FES2014\ocean_tide_extrapolated\ocean_tide_extrapolated

GetTide download data.png

To add on a timezone offset, and timezone name tag metadata attribute, the optional extra commands “tz” and “ltz” can be added. If the "tz" command is entered an additional time variable local_time will be added to out the output NetCDF. The variable time will still be included in UTC. If using a time offset, it’s good practice to also include a name through the "ltz" command to avoid later confusion.

  GetTide -tz 10 -ltz AEST GoC_Tide_20100301_20100501_AEST.nc 2010-03-01 2010-05-01 .\nodestrings\2d_ns_Open_Boundary_001_L.shp FES2014\ocean_tide_extrapolated\ocean_tide_extrapolated

GetTide download data rev.png


Please note: It is highly recommended to add the start, end, and timezone to your output file name. For example MyArea_20220201_20220401_UTC.nc, indicates that the data in this file is available from the 1st of February, 2022 to 1st of April, 2022 and is in the UTC timezone. If this convention is adhered to, it can save time and reduce errors and confusion when dealing with boundary conditions.

Review Get Tide Outputs

Get Tide produces a single NetCDF file which contains the merged downloaded data. Using xarray to inspect this NetCDF, we see it has the structure and properties shown below.

GetTide xarray netcdf.png

Utilising Python’s xarray module enables visualisation of the data this NetCDF contains. This helps us better understand our data, and ensure it is behaving as we would expect.

The figure below depicts the water level timeseries at a specified location (7503.209 m) along the western boundary (Western_Boundary). We can see water level fluctuations across the time period that are consistent with the influence of tidal constituents.

GetTide results timeseries.png

We can also take a look at the water level along our western boundary at a particular time point. Below is a figure that displays the water level along the full eastern boundary (Western_Boundary) chainage at midnight on the 1st of April 2010 (2010-04-01 00:00).

GetTide results ns water level.png

When Get Tide merges the downloaded data into a single NetCDF file, it also creates an fvc file in the same location.

GetTide outputs.png

Within this fvc file, you will find that Get Tide has written your tidal boundary conditions for you.

GetTide fvc.png

These tidal boundary conditions can then be incorporated into your TUFLOW FV model through an include statement, as shown below. This include statement will reference GoC_Tide_20100301_20100501_AEST.fvc, so that the commands it contains will be read by TUFLOW FV.

GetTide include command.png

Conclusion

For further information on Get Tide, please visit our GitLab page.

To learn how to use our other Python utilities, please visit our TUFLOW FV Python Toolbox, TUFLOW FV Get Atmos and TUFLOW FV Get Ocean pages.

To see how to implement the most common TUFLOW FV model design features, please access our TUFLOW FV Example Models page.

To complete tutorials or learn more tips and tricks, please return to the TUFLOW FV Wiki Mainpage.

If you have any further queries, feedback or requests for new functionality, please feel free to get in contact with support@tuflow.com