aodn / imos-toolbox

Graphical tool for QC'ing and NetCDF'ing oceanographic datasets
GNU General Public License v3.0
45 stars 30 forks source link

IMOS Feature Request : Provide tidal analysis #203

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
A tidal analysis might help to infer timing / compass / pressure errors / 
drifts. The toolbox could run such a tidal analysis per deployment.

Original issue reported on code.google.com by guillaum...@gmail.com on 27 May 2014 at 6:39

GoogleCodeExporter commented 9 years ago

Original comment by guillaum...@gmail.com on 29 May 2014 at 7:25

richardsc commented 8 years ago

Hi! I only recently discovered this toolbox, but am looking forward to trying it out and potentially contributing.

As for tidal analysis, I would look at Rich Pawlowicz's t_tide package for Matlab:

http://www.eos.ubc.ca/~rich/#T_Tide

ggalibert commented 8 years ago

Thanks, I had already noticed UTide too (mentioned on your link).

ggalibert commented 8 years ago

Testing branch

I have just pushed a new branch https://github.com/aodn/imos-toolbox/tree/tidal_analysis with auto 1D tidal analysis from UTide and plot of residuals.

When loading a deployment, the tidal analysis can be called from the menu for the selected instrument (which has to have pressure data): 1dtidalanalysismenu

By default the tidal analysis is ran with iteratively reweighted least squares IRLS method (requires Statistics toolbox though) in auto mode (constituents are selected following the automated decision tree method with Rmin = 1). The IRLS, as opposed to the ordinary least squares OLS method, can minimize the influence of outliers, which is of a great benefit when dealing with instruments on an anchored mooring subject to current knock downs.

Purpose

On top of being able to detect outliers and other interesting phenomenon like mooring knock downs, I'm hoping the residuals would help to detect or correct time and/or pressure drifts.

Example analysis

The following 1D tidal analysis have been performed in auto mode. For all of them, the 35 first main constituents have been automatically selected.

OLS vs IRLS

Tidal analysis of a pressure sensor @20m for a 120m deep site, that is subject to important knock downs, using OLS method: 1dtidalanalysistopwithols

Using OLS method, the residuals follow a sinusoidal pattern which shows important mismatch between observations and model. Manually selecting only relevant constituents based on diagnostic parameters may help to obtain a better reconstructed fit.

Tidal analysis of the same sensor using IRLS method: 1dtidalanalysistopwithirls

Using IRLS method, there is a much better reconstructed fit with a lot higher SNR on all constituents than with using OLS method.

Drift impact

Tidal analysis with IRLS of a pressure sensor @120m for a 120m deep site: 1dtidalanalysisbottom

Good reconstructed fit with no Pearson residual higher than 1 in absolute value.

Clock drift

Tidal analysis of the same sensor with introduced linear drift on clock of 5min over the deployment: 1dtidalanalysisbottomwithlineartimedrift5min

Tidal analysis of the same sensor with introduced quadratic drift on clock of 5min over the deployment: 1dtidalanalysisbottomwithquadratictimedrift5min

In both cases the RMS of the residuals is slightly higher and the SNR for all constituents slightly lower than in the original data. So if we attempt to correct linear or non-linear clock drift, the tidal analysis should enable us to assess the improvement on the corrected data.

Pressure drift

Tidal analysis of the same sensor with introduced linear drift on pressure of 3dBar over the deployment: 1dtidalanalysisbottomwithlinearpressuredrift3dbar

Diagnostics and residuals don't help to testify the linear pressure drift. Fortunately this might be a rare case in reality.

Tidal analysis of the same sensor with introduced quadratic drift on pressure of 3dBar over the deployment: 1dtidalanalysisbottomwithquadraticpressuredrift3dbar

A U shape in the residuals clearly shows the lack of agreement between observations and model. If we attempt to correct such a drift, the U shape should disappear and we should see a more evenly distributed residuals vertically around 0.

Potential improvements