Skip to content

Commit

Permalink
feat: adding GOT5.5 to available tide models
Browse files Browse the repository at this point in the history
* refactor: renamed format for `ATLAS` to `ATLAS-compact`
* refactor: renamed format for `netcdf` to `ATLAS-netcdf`
* refactor: renamed format for `FES` to `FES-netcdf` and added `FES-ascii`
* refactor: renamed format for `GOT` to `GOT-ascii` and added `GOT-netcdf`
  • Loading branch information
tsutterley committed Jul 24, 2024
1 parent 53ed576 commit 7f76bf2
Show file tree
Hide file tree
Showing 16 changed files with 151 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ compute_tides_ICESat2_ATL03.py
- Calculates tidal elevations for correcting ICESat-2 photon height data
- Calculated at ATL03 segment level using reference photon geolocation and time
- Segment level corrections can be applied to the individual photon events (PEs)
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use OTIS format tidal solutions provided by Oregon State University and ESR
- Can use Global Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compute_tides_ICESat2_ATL06.py
==============================

- Calculates tidal elevations for correcting ICESat-2 land ice elevation data
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use OTIS format tidal solutions provided by Oregon State University and ESR
- Can use Global Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compute_tides_ICESat2_ATL07.py
==============================

- Calculates tidal elevations for correcting ICESat-2 sea ice height data
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use OTIS format tidal solutions provided by Oregon State University and ESR
- Can use Global Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compute_tides_ICESat2_ATL10.py
==============================

- Calculates tidal elevations for correcting ICESat-2 sea ice freeboard data
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use OTIS format tidal solutions provided by Oregon State University and ESR
- Can use Global Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ compute_tides_ICESat2_ATL11.py

- Calculates tidal elevations for correcting ICESat-2 annual land ice height data
- Calculates tidal elevations for both along-track and across-track locations
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use OTIS format tidal solutions provided by Oregon State University and ESR
- Can use Global Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compute_tides_ICESat2_ATL12.py
==============================

- Calculates tidal elevations for correcting ICESat-2 ocean surface height data
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use OTIS format tidal solutions provided by Oregon State University and ESR
- Can use Glgobal Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compute_tides_ICESat_GLA12.py
=============================

- Calculates tidal elevations for correcting ICESat/GLAS L2 GLA12 Antarctic and Greenland Ice Sheet elevation data
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use OTIS format tidal solutions provided by Oregon State University and ESR
- Can use Global Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compute_tides_icebridge_data.py
===============================

- Calculates tidal elevations for correcting Operation IceBridge elevation data
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use OTIS format tidal solutions provided by Oregon State University and ESR
- Can use Global Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO

Expand Down
31 changes: 18 additions & 13 deletions tides/compute_tides_ICESat2_ATL03.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Calculated at ATL03 segment level using reference photon geolocation and time
Segment level corrections can be applied to the individual photon events (PEs)
Uses OTIS format tidal solutions provided by Ohio State University and ESR
Uses OTIS format tidal solutions provided by Oregon State University and ESR
http://volkov.oce.orst.edu/tides/region.html
https://www.esr.org/research/polar-tide-models/list-of-polar-tide-models/
ftp://ftp.esr.org/pub/datasets/tmd/
Expand Down Expand Up @@ -68,6 +68,10 @@
UPDATE HISTORY:
Updated 07/2024: added option to crop to the domain of the input data
added option to use JSON format definition files
renamed format for ATLAS to ATLAS-compact
renamed format for netcdf to ATLAS-netcdf
renamed format for FES to FES-netcdf and added FES-ascii
renamed format for GOT to GOT-ascii and added GOT-netcdf
Updated 05/2024: use wrapper to importlib for optional dependencies
Updated 04/2024: use timescale for temporal operations
Updated 01/2024: made the inferrence of minor constituents an option
Expand Down Expand Up @@ -221,25 +225,26 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
BOUNDS[3] = np.maximum(BOUNDS[3], np.max(bounding_lat))

# read tidal constants
if model.format in ('OTIS','ATLAS','TMD3'):
corrections, _, grid = model.format.partition('-')
if model.format in ('OTIS','ATLAS-compact','TMD3'):
constituents = pyTMD.io.OTIS.read_constants(model.grid_file,
model.model_file, model.projection, type=model.type,
grid=model.format, crop=CROP, bounds=BOUNDS,
grid=corrections, crop=CROP, bounds=BOUNDS,
apply_flexure=APPLY_FLEXURE)
# available model constituents
c = constituents.fields
elif (model.format == 'netcdf'):
elif model.format in ('ATLAS-netcdf',):
constituents = pyTMD.io.ATLAS.read_constants(model.grid_file,
model.model_file, type=model.type, compressed=model.compressed,
crop=CROP, bounds=BOUNDS)
# available model constituents
c = constituents.fields
elif (model.format == 'GOT'):
elif model.format in ('GOT-ascii','GOT-netcdf'):
constituents = pyTMD.io.GOT.read_constants(model.model_file,
compressed=model.compressed, crop=CROP, bounds=BOUNDS)
compressed=model.compressed, grid=grid, crop=CROP, bounds=BOUNDS)
# available model constituents
c = constituents.fields
elif (model.format == 'FES'):
elif model.format in ('FES-ascii','FES-netcdf'):
constituents = pyTMD.io.FES.read_constants(model.model_file,
type=model.type, version=model.version, compressed=model.compressed,
crop=CROP, bounds=BOUNDS)
Expand Down Expand Up @@ -291,25 +296,25 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
epoch=timescale.time._atlas_sdp_epoch, standard='GPS')

# interpolate tidal constants to grid points
if model.format in ('OTIS','ATLAS','TMD3'):
if model.format in ('OTIS','ATLAS-compact','TMD3'):
amp,ph,D = pyTMD.io.OTIS.interpolate_constants(lon, lat,
constituents, model.projection, type=model.type,
method=METHOD, extrapolate=EXTRAPOLATE, cutoff=CUTOFF)
# use delta time at 2000.0 to match TMD outputs
deltat = np.zeros((n_seg))
elif (model.format == 'netcdf'):
elif model.format in ('ATLAS-netcdf',):
amp,ph,D = pyTMD.io.ATLAS.interpolate_constants(lon, lat,
constituents, type=model.type, method=METHOD,
extrapolate=EXTRAPOLATE, cutoff=CUTOFF, scale=model.scale)
# use delta time at 2000.0 to match TMD outputs
deltat = np.zeros((n_seg))
elif (model.format == 'GOT'):
elif model.format in ('GOT-ascii','GOT-netcdf'):
amp,ph = pyTMD.io.GOT.interpolate_constants(lon, lat,
constituents, method=METHOD, extrapolate=EXTRAPOLATE,
cutoff=CUTOFF, scale=model.scale)
# delta time (TT - UT1)
deltat = ts.tt_ut1
elif (model.format == 'FES'):
elif model.format in ('FES-ascii','FES-netcdf'):
amp,ph = pyTMD.io.FES.interpolate_constants(lon, lat,
constituents, method=METHOD, extrapolate=EXTRAPOLATE,
cutoff=CUTOFF, scale=model.scale)
Expand All @@ -325,11 +330,11 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
tide = np.ma.empty((n_seg),fill_value=fv)
tide.mask = np.any(hc.mask,axis=1)
tide.data[:] = pyTMD.predict.drift(ts.tide, hc, c,
deltat=deltat, corrections=model.format)
deltat=deltat, corrections=corrections)
# calculate values for minor constituents by inferrence
if INFER_MINOR:
minor = pyTMD.predict.infer_minor(ts.tide, hc, c,
deltat=deltat, corrections=model.format)
deltat=deltat, corrections=corrections)
tide.data[:] += minor.data[:]
# replace masked and nan values with fill value
invalid, = np.nonzero(np.isnan(tide.data) | tide.mask)
Expand Down
31 changes: 18 additions & 13 deletions tides/compute_tides_ICESat2_ATL06.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Written by Tyler Sutterley (07/2024)
Calculates tidal elevations for correcting ICESat-2 land ice elevation data
Uses OTIS format tidal solutions provided by Ohio State University and ESR
Uses OTIS format tidal solutions provided by Oregon State University and ESR
http://volkov.oce.orst.edu/tides/region.html
https://www.esr.org/research/polar-tide-models/list-of-polar-tide-models/
ftp://ftp.esr.org/pub/datasets/tmd/
Expand Down Expand Up @@ -63,6 +63,10 @@
UPDATE HISTORY:
Updated 07/2024: added option to crop to the domain of the input data
added option to use JSON format definition files
renamed format for ATLAS to ATLAS-compact
renamed format for netcdf to ATLAS-netcdf
renamed format for FES to FES-netcdf and added FES-ascii
renamed format for GOT to GOT-ascii and added GOT-netcdf
Updated 05/2024: use wrapper to importlib for optional dependencies
Updated 04/2024: use timescale for temporal operations
Updated 01/2024: made the inferrence of minor constituents an option
Expand Down Expand Up @@ -211,25 +215,26 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
BOUNDS[3] = np.maximum(BOUNDS[3], np.max(lat))

# read tidal constants
if model.format in ('OTIS','ATLAS','TMD3'):
corrections, _, grid = model.format.partition('-')
if model.format in ('OTIS','ATLAS-compact','TMD3'):
constituents = pyTMD.io.OTIS.read_constants(model.grid_file,
model.model_file, model.projection, type=model.type,
grid=model.format, crop=CROP, bounds=BOUNDS,
grid=corrections, crop=CROP, bounds=BOUNDS,
apply_flexure=APPLY_FLEXURE)
# available model constituents
c = constituents.fields
elif (model.format == 'netcdf'):
elif model.format in ('ATLAS-netcdf',):
constituents = pyTMD.io.ATLAS.read_constants(model.grid_file,
model.model_file, type=model.type, compressed=model.compressed,
crop=CROP, bounds=BOUNDS)
# available model constituents
c = constituents.fields
elif (model.format == 'GOT'):
elif model.format in ('GOT-ascii','GOT-netcdf'):
constituents = pyTMD.io.GOT.read_constants(model.model_file,
compressed=model.compressed, crop=CROP, bounds=BOUNDS)
compressed=model.compressed, grid=grid, crop=CROP, bounds=BOUNDS)
# available model constituents
c = constituents.fields
elif (model.format == 'FES'):
elif model.format in ('FES-ascii','FES-netcdf'):
constituents = pyTMD.io.FES.read_constants(model.model_file,
type=model.type, version=model.version, compressed=model.compressed,
crop=CROP, bounds=BOUNDS)
Expand Down Expand Up @@ -274,25 +279,25 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
epoch=timescale.time._atlas_sdp_epoch, standard='GPS')

# interpolate tidal constants to grid points
if model.format in ('OTIS','ATLAS','TMD3'):
if model.format in ('OTIS','ATLAS-compact','TMD3'):
amp,ph,D = pyTMD.io.OTIS.interpolate_constants(val['longitude'],
val['latitude'], constituents, model.projection, type=model.type,
method=METHOD, extrapolate=EXTRAPOLATE, cutoff=CUTOFF)
# use delta time at 2000.0 to match TMD outputs
deltat = np.zeros((n_seg))
elif (model.format == 'netcdf'):
elif model.format in ('ATLAS-netcdf',):
amp,ph,D = pyTMD.io.ATLAS.interpolate_constants(val['longitude'],
val['latitude'], constituents, type=model.type, method=METHOD,
extrapolate=EXTRAPOLATE, cutoff=CUTOFF, scale=model.scale)
# use delta time at 2000.0 to match TMD outputs
deltat = np.zeros((n_seg))
elif (model.format == 'GOT'):
elif model.format in ('GOT-ascii','GOT-netcdf'):
amp,ph = pyTMD.io.GOT.interpolate_constants(val['longitude'],
val['latitude'], constituents, method=METHOD,
extrapolate=EXTRAPOLATE, cutoff=CUTOFF, scale=model.scale)
# delta time (TT - UT1)
deltat = ts.tt_ut1
elif (model.format == 'FES'):
elif model.format in ('FES-ascii','FES-netcdf'):
amp,ph = pyTMD.io.FES.interpolate_constants(val['longitude'],
val['latitude'], constituents, method=METHOD,
extrapolate=EXTRAPOLATE, cutoff=CUTOFF, scale=model.scale)
Expand All @@ -308,11 +313,11 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
tide = np.ma.empty((n_seg),fill_value=fv)
tide.mask = np.any(hc.mask,axis=1)
tide.data[:] = pyTMD.predict.drift(ts.tide, hc, c,
deltat=deltat, corrections=model.format)
deltat=deltat, corrections=corrections)
# calculate values for minor constituents by inferrence
if INFER_MINOR:
minor = pyTMD.predict.infer_minor(ts.tide, hc, c,
deltat=deltat, corrections=model.format)
deltat=deltat, corrections=corrections)
tide.data[:] += minor.data[:]
# replace masked and nan values with fill value
invalid, = np.nonzero(np.isnan(tide.data) | tide.mask)
Expand Down
31 changes: 18 additions & 13 deletions tides/compute_tides_ICESat2_ATL07.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Written by Tyler Sutterley (07/2024)
Calculates tidal elevations for correcting ICESat-2 sea ice height data
Uses OTIS format tidal solutions provided by Ohio State University and ESR
Uses OTIS format tidal solutions provided by Oregon State University and ESR
http://volkov.oce.orst.edu/tides/region.html
https://www.esr.org/research/polar-tide-models/list-of-polar-tide-models/
ftp://ftp.esr.org/pub/datasets/tmd/
Expand Down Expand Up @@ -61,6 +61,10 @@
UPDATE HISTORY:
Updated 07/2024: added option to crop to the domain of the input data
added option to use JSON format definition files
renamed format for ATLAS to ATLAS-compact
renamed format for netcdf to ATLAS-netcdf
renamed format for FES to FES-netcdf and added FES-ascii
renamed format for GOT to GOT-ascii and added GOT-netcdf
Updated 05/2024: use wrapper to importlib for optional dependencies
Updated 04/2024: use timescale for temporal operations
Updated 01/2024: made the inferrence of minor constituents an option
Expand Down Expand Up @@ -204,24 +208,25 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
BOUNDS[3] = np.maximum(BOUNDS[3], np.max(lat))

# read tidal constants
if model.format in ('OTIS','ATLAS','TMD3'):
corrections, _, grid = model.format.partition('-')
if model.format in ('OTIS','ATLAS-compact','TMD3'):
constituents = pyTMD.io.OTIS.read_constants(model.grid_file,
model.model_file, model.projection, type=model.type,
grid=model.format, crop=CROP, bounds=BOUNDS)
grid=corrections, crop=CROP, bounds=BOUNDS)
# available model constituents
c = constituents.fields
elif (model.format == 'netcdf'):
elif model.format in ('ATLAS-netcdf',):
constituents = pyTMD.io.ATLAS.read_constants(model.grid_file,
model.model_file, type=model.type, compressed=model.compressed,
crop=CROP, bounds=BOUNDS)
# available model constituents
c = constituents.fields
elif (model.format == 'GOT'):
elif model.format in ('GOT-ascii','GOT-netcdf'):
constituents = pyTMD.io.GOT.read_constants(model.model_file,
compressed=model.compressed, crop=CROP, bounds=BOUNDS)
compressed=model.compressed, grid=grid, crop=CROP, bounds=BOUNDS)
# available model constituents
c = constituents.fields
elif (model.format == 'FES'):
elif model.format in ('FES-ascii','FES-netcdf'):
constituents = pyTMD.io.FES.read_constants(model.model_file,
type=model.type, version=model.version, compressed=model.compressed,
crop=CROP, bounds=BOUNDS)
Expand Down Expand Up @@ -264,25 +269,25 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
epoch=timescale.time._atlas_sdp_epoch, standard='GPS')

# interpolate tidal constants to grid points
if model.format in ('OTIS','ATLAS','TMD3'):
if model.format in ('OTIS','ATLAS-compact','TMD3'):
amp,ph,D = pyTMD.io.OTIS.interpolate_constants(val['longitude'],
val['latitude'], constituents, model.projection, type=model.type,
method=METHOD, extrapolate=EXTRAPOLATE, cutoff=CUTOFF)
# use delta time at 2000.0 to match TMD outputs
deltat = np.zeros((n_seg))
elif (model.format == 'netcdf'):
elif model.format in ('ATLAS-netcdf',):
amp,ph,D = pyTMD.io.ATLAS.interpolate_constants(val['longitude'],
val['latitude'], constituents, type=model.type, method=METHOD,
extrapolate=EXTRAPOLATE, cutoff=CUTOFF, scale=model.scale)
# use delta time at 2000.0 to match TMD outputs
deltat = np.zeros((n_seg))
elif (model.format == 'GOT'):
elif model.format in ('GOT-ascii','GOT-netcdf'):
amp,ph = pyTMD.io.GOT.interpolate_constants(val['longitude'],
val['latitude'], constituents, method=METHOD,
extrapolate=EXTRAPOLATE, cutoff=CUTOFF, scale=model.scale)
# delta time (TT - UT1)
deltat = ts.tt_ut1
elif (model.format == 'FES'):
elif model.format in ('FES-ascii','FES-netcdf'):
amp,ph = pyTMD.io.FES.interpolate_constants(val['longitude'],
val['latitude'], constituents, method=METHOD,
extrapolate=EXTRAPOLATE, cutoff=CUTOFF, scale=model.scale)
Expand All @@ -298,11 +303,11 @@ def compute_tides_ICESat2(tide_dir, INPUT_FILE,
tide = np.ma.empty((n_seg))
tide.mask = np.any(hc.mask,axis=1)
tide.data[:] = pyTMD.predict.drift(ts.tide, hc, c,
deltat=deltat, corrections=model.format)
deltat=deltat, corrections=corrections)
# calculate values for minor constituents by inferrence
if INFER_MINOR:
minor = pyTMD.predict.infer_minor(ts.tide, hc, c,
deltat=deltat, corrections=model.format)
deltat=deltat, corrections=corrections)
tide.data[:] += minor.data[:]
# replace masked and nan values with fill value
invalid, = np.nonzero(np.isnan(tide.data) | tide.mask)
Expand Down
Loading

0 comments on commit 7f76bf2

Please sign in to comment.