Astronomical Tide Validation#

# hide warnings
import warnings
warnings.filterwarnings('ignore')

# common
import os
import os.path as op
import sys

# pip
import numpy as np
import xarray as xr

# DEV: bluemath
sys.path.insert(0, op.join(op.abspath(''), '..', '..', '..', '..'))
from bluemath.astronomical_tide import calculate_AT_TPXO9v4, plot_AT_TG_D3D_validation_timeseries
/home/administrador/anaconda3/envs/samoatonga/lib/python3.7/site-packages/pyTMD/spatial.py:57: UserWarning: GDAL not available
  warnings.warn("GDAL not available")

## Methodology

TPX09

Astronomical Tide has been extracted from TPX09
TPX09 has a global 1/30 degree resolution, obtained by combining 1/6 degree base global solution TPXO9.v1 and thirty 1/30 degree resolution local solutions for all coastal areas, including Arctic and Antarctic.

Validation

In this section the validation of TPX09 against the numerical modeling using DELFT3D, and against the Tidal Gauge is presented.

Database and site parameters#

# database
p_data = r'/media/administrador/HD2/SamoaTonga/data'
site = 'Samoa'
p_site = op.join(p_data, site)

p_db = r'/media/administrador/HD1/DATABASES'


# deliverable folder
p_deliv = op.join(p_site, 'd06_tc_inundation_forecast')

# model
p_model = op.join(p_db, 'TPX09_atlas_v4')

# greensurge library
p_greensurge = op.join(p_db, 'greensurge')

# tidal Gauge
p_TC_TG = op.join(p_greensurge, 'data', 'Tidal_Gauge')
p_tg = op.join(p_TC_TG, 'TG_012019_Samoa.nc')

# numerical simulation
p_AT_D3Dsimulation = op.join(p_greensurge, 'data', 'Astronomical_Tide')
p_sim = op.join(p_AT_D3Dsimulation, 'Samoa_ATDelft_2019.nc')

# output files
p_ds_tide = op.join(p_greensurge, 'data', 'ds_tide.nc')

Historic Analysis#

Astronomical Tide#

# domain coordinates
lon_tide_domain = [185.5, 190.5]
lat_tide_domain = [-15, -12.5]

# time period
tini = np.datetime64('2019-01-07T00:00')
tend = np.datetime64('2019-01-10T00:00')
# AT TPXO info --> TODO: include TPXO references --> https://www.tpxo.net/otis
ds_tide = calculate_AT_TPXO9v4(p_model, lon_tide_domain, lat_tide_domain, tini, tend)

ds_tide.to_netcdf(p_ds_tide)

#ds_tide = xr.open_dataset(p_ds_tide)

DELFT3D Numerical Simulation#

# AT D3D simulation info
ds_D3D_simulation = xr.open_dataset(p_sim)

TG Data#

# Load TG data
TG = xr.open_dataset(p_tg)
# Plot comparison/validation AT TPXO vs D3DSimulation vs TG
plot_AT_TG_D3D_validation_timeseries(ds_tide, ds_D3D_simulation, TG, figsize=[30,7]);
/media/administrador/HD2/SamoaTonga/deliverables/D06_TC_Inundation_Forecast/Samoa/notebooks/../../../../bluemath/astronomical_tide.py:366: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
  gs1.tight_layout(fig, rect=[0.3, 0, 1, 0.75])
_images/02_Atronomical_Tide_Validation_15_1.png