# Tools¶

We have developed a variety of tools used for analysis and creation of storm surge simulations.

## The Surge¶

We are often interested in the behaviour of the surge component of the water level, that is, the anomaly after the tides have been removed. Further, we could like to compare the modelled surge to the observed surge. To determine the modelled surge, we perform two simulations: one with all of our forcing conditions, including the tides, atmospheric conditions, rivers, and sea surface height at the open boundaries and another with only the tidal forcing and rivers. We define the modelled surge as the difference between the sea surface height of these two simulations.

To calculate the observed surge, we need water level observations and tidal predictions.

## Observations¶

Water level observations for Canadian tide gauges are easily obtained from the Fisheries and Oceans Canada (DFO) website. We also use observations from NOAA tide gauges.

## Tidal predictions¶

Tidal predictions are generated using a MATLAB package called t_tide. The general procedure is as follows:

Perform a harmonic analysis on a year-long time series using

`t_tide`

.Use the tidal constituents produced by the harmonic analysis to generate a tidal prediction. Typically, 67 constituents are analyzed with

`t_tide`

for a year-long time series.

However, there are some subtleties that need to be considered before we generate the tidal predictions for use in residual calculations.

Note

In order to use these tools, you need to download t_tide and add the t_tide directory to you MATLAB path.

### Filtering¶

In a year with many storm surges, the harmonic analysis may result in over predicted constituents due to the large surges. As such, before the harmonic analysis is performed, we filter the time series by applying a Doodson tide filter (Parker, 2007) and we remove periods with large non-tidal energy. The harmonic analysis is then applied to the filtered time series.

### Long Period Constituents¶

In a harmonic analysis, long period constituents (Sa, Ssa, etc) in this region are often contaminated by non-tidal energy due to seasonal meteorological events. We would like to represent this seasonal variability in our residual forcing. As such, we do not include long period constituents in our tidal predictions.

### Constituents with low signal to noise ratio¶

Constituents with a low signal to noise ratio (less than 2) are not used in tidal predictions.

### Model Correction¶

Because our model is forced with only 8 tidal constituents, our water level predictions are missing some tidal energy. We have attempted to correct for the missing energy in the following way.

Generate a tidal prediction with constituents from the harmonic analysis (excluding long period constituents, constituents with low signal to noise ratio, and shallow water constituents).

Generate a tidal prediction with only the eight constituents used to force the model.

Calculate the difference between these two predictions and add to the model sea surface height as a correction.

The shallow water constituents are excluded from the tidal prediction because they will be generated by the model and we should avoid counting them twice.

### MATLAB Scripts¶

Several MATLAB scripts have been designed to calculate the tidal predictions as described above.
These scripts are found in the `analysis-storm-surges/tide_analysis_scripts/`

repository and are described below.

`generate_tidal_predictions.m`

This script does most of the work. The end result is a series of tidal predictions.

generate_tidal_predictions(filename, location, starts, ends, type, exclude_long, cut_off, ssh_units, time_zone)

Uses water level observations or harmonic constituents stored in

`filename`

to calculate tidal predictions over a time period defined by date strings`starts`

and`ends`

. Water level observations can either be from the DFO website or the NOAA website, as specified by the`type`

argument. Or a file with harmonic constituents from CHS can be used, in which case type is set to ‘CHS’. Also, a file with NOAA constituents can be used, in which case type is ‘NOAA_const’.If a harmonic analysis is necessary, the calculated harmonics are saved in

`location_harmonics_date1_date2_filter.csv`

where location is one of the arguments of`generate_tidal_predictions.m`

.`date1`

and`date2`

are string representations of the start and end date of the observation time series.The tidal predictions are stored in a file called

`location_tidal_prediction_starts_ends.csv`

where`starts`

and`ends`

are arguments of`generate_tidal_predictions.m`

. This file contains three types of tidal predictions:`pred_all`

- predictions with all constituents except shallow water and ones with low signal to noise`pred_8`

- predictions with only eight constituents`pred_noshallow`

- like pred_all but with no shallow water constituents.

`exclude_long`

is a flag that specifies whether or not long period constituents should be excluded from the tidal predictions.`exclude_long`

= 1 means exclude long period constituents like Sa, Ssa, etc from the tidal prediction.`exclude_long`

= 0 means include long period constituents in tidal predictions. Note that if`exclude_long`

= 0 then a lot of the variability between`pred_all`

and`pred_8`

because`pred_all`

uses long period constituents but`pred_8`

does not.`cut_off`

is the amplitude at which non-tidal energy is removed from the harmonic analysis. Time periods for which the filtered time series is greater than`cut_off`

are removed from the water level time series and then the harmonic analysis is performed. A reasonable value is 0.3. If filtering is not desired then set`cut_off`

very high (>1).`ssh_units`

is the units of the water level information in the harmonics or time series file (eg. ‘m’ or ‘feet’)`time_zone`

is the time zone of the time information stored in the harmonics or time series files. For example, if`time_zone`

is ‘PST’ then the phase in the harmonics files is relative to PST time or the time in the time series file is relative to PST.

Note

If a harmonic analysis is necessary, then the water level time series should be less than one year but long enough to separate the important constituents. Typically, one year is a reasonable length.

`calculate_harmonics.m`

and`calculate_harmonics_NOAA.m`

These files perform the harmonics analysis for DFO and NOAA data respectively.

`filter_tides.m`

and`filter_tides_NOAA.m`

These files do the filtering work.

`read_CHS_harmonics.m`

Read the CHS tidal harmonics from a file.

`read_NOAA_harmonics.m`

Read the NOAA tidal harmonics from a file.

Note

The NOAA observations csv files should have the station’s latitude in the second row, second column of the file.

Note

See `/ocean/nsoontie/MEOPAR/tides/NOAA_tidal_constituents/NeahBay_harmonics.csv`

for an example of how the NOAA harmonics files should be formatted.

Warning

Some of the constituents published on the NOAA website are not recognized by t_tide. We have attempted to match these constituents to once valid in ttide but this approach can lead to errors in the nodal corrections. It is best to use a time-series when producing tidal predictions for a NOAA station.

## Storm surge forcing files¶

Several notebooks have been developed for generating the anomaly forcing files used in simulation hindcasts.

## Analysis¶

Some analysis functions are stored in a module salishsea_tools/stormtools.

Examples include functions that calculate the observed residual, modelled residual, error statistics, and so on.

Note

A different module was used for analysis in the AO storm surge paper. It is in a private repository `storm-surge/stormtools_revisions.py`

.The functions are almost identical as `stormtools.py`

but with a few minor changes

## References¶

Pawlowicz, R., B. Beardsley, and S. Lentz (2002). Classical tidal harmonic analysis including error estimates in matlab using t tide. Computers & Geosciences 28 (8), 929-937.

Parker, B. B. (2007). Tidal Analysis and Prediction. NOAA Special Publication NOS CO-OPS 3.