-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Arctic AOTIM-5-2018 matlab-python test
add download utilties for CATS and Arctic models update documentation for setting up model directories update documentation for new and updated programs
- Loading branch information
1 parent
06f999c
commit 54c17a6
Showing
17 changed files
with
473 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Getting Started | ||
=============== | ||
|
||
#### Tide Model Formats | ||
OTIS and ATLAS formatted data use a single binary file to store all the constituents for either heights (`z`) or transports (`u`, `v`). | ||
Arctic Ocean models can be downloaded from the NSF ArcticData server using the [`arcticdata_tides.py`](https://github.com/tsutterley/pyTMD/blob/master/scripts/arcticdata_tides.py) program. | ||
CATS2008 can be downloaded from the US Antarctic Program (USAP) using the [`usap_cats_tides.py`](https://github.com/tsutterley/pyTMD/blob/master/scripts/usap_cats_tides.py) program. | ||
ATLAS netCDF formatted data use netCDF4 files for each constituent and variable type (`z`, `u`, `v`). | ||
GOT formatted data use ascii files for each height constituent (`z`). | ||
FES formatted data use either ascii (1999, 2004) or netCDF4 (2012, 2014) files for each constituent and variable type (`z`, `u`, `v`). | ||
The FES models can be downloaded using the [`aviso_fes_tides.py`](https://github.com/tsutterley/pyTMD/blob/master/scripts/aviso_fes_tides.py) program for users registered with AVISO. | ||
|
||
#### Directories | ||
pyTMD uses a tree structure for storing the tidal constituent data. | ||
This structure was chosen based on the different formats of each tide model. | ||
|
||
- Circum-Antarctic Tidal Simulations | ||
* CATS0201: `<path_to_tide_models>/cats0201_tmd/` | ||
* [CATS2008](https://www.usap-dc.org/view/dataset/601235): `<path_to_tide_models>/CATS2008/` | ||
* CATS2008_load: `<path_to_tide_models>/CATS2008a_SPOTL_Load/` | ||
|
||
- Arctic Ocean Tidal Simulations | ||
* [AODTM-5](https://arcticdata.io/catalog/view/doi:10.18739/A2901ZG3N): `<path_to_tide_models>/aodtm5_tmd/` | ||
* [AOTIM-5](https://arcticdata.io/catalog/view/doi:10.18739/A2S17SS80): `<path_to_tide_models>/aotim5_tmd/` | ||
* [AOTIM-5-2018](https://arcticdata.io/catalog/view/doi:10.18739/A21R6N14K): `<path_to_tide_models>/Arc5km2018/` | ||
|
||
- TOPEX/POSEIDON global tide models | ||
* [TPXO9-atlas](https://www.tpxo.net/tpxo-products-and-registration): `<path_to_tide_models>/TPXO9_atlas/` | ||
* [TPXO9-atlas-v2](https://www.tpxo.net/tpxo-products-and-registration): `<path_to_tide_models>/TPXO9_atlas_v2/` | ||
* [TPXO9.1](https://www.tpxo.net/tpxo-products-and-registration): `<path_to_tide_models>/TPXO9.1/DATA/` | ||
* [TPXO8-atlas](https://www.tpxo.net/tpxo-products-and-registration): `<path_to_tide_models>/tpxo8_atlas/` | ||
* TPXO7.2: `<path_to_tide_models>/TPXO7.2_tmd/` | ||
* TPXO7.2_load: `<path_to_tide_models>/TPXO7.2_load/` | ||
|
||
- Global Ocean Tide models | ||
* GOT4.7: `<path_to_tide_models>/GOT4.7/grids_oceantide/` | ||
* GOT4.7_load: `<path_to_tide_models>/GOT4.7/grids_loadtide/` | ||
* GOT4.8: `<path_to_tide_models>/got4.8/grids_oceantide/` | ||
* GOT4.8_load: `<path_to_tide_models>/got4.8/grids_loadtide/` | ||
* GOT4.10: `<path_to_tide_models>/GOT4.10c/grids_oceantide/` | ||
* GOT4.10_load: `<path_to_tide_models>/GOT4.10c/grids_loadtide/` | ||
|
||
- Finite Element Solution tide models | ||
* [FES2014](https://www.aviso.altimetry.fr/data/products/auxiliary-products/global-tide-fes.html): `<path_to_tide_models>/fes2014/ocean_tide/` | ||
* [FES2014_load](https://www.aviso.altimetry.fr/data/products/auxiliary-products/global-tide-fes.html): `<path_to_tide_models>/fes2014/load_tide/` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
arcticdata_tides.py | ||
=================== | ||
|
||
- Download Arctic Ocean Tide Models from the [NSF ArcticData](https://arcticdata.io) archive | ||
- [AODTM-5](https://arcticdata.io/catalog/view/doi:10.18739/A2901ZG3N) | ||
- [AOTIM-5](https://arcticdata.io/catalog/view/doi:10.18739/A2S17SS80) | ||
- [AOTIM-5-2018](https://arcticdata.io/catalog/view/doi:10.18739/A21R6N14K) | ||
|
||
#### Calling Sequence | ||
```bash | ||
python arcticdata_tides.py --directory=<path_to_tide_directory> --tide=AOTIM-5-2018 | ||
``` | ||
[Source code](https://github.com/tsutterley/pyTMD/blob/master/scripts/arcticdata_tides.py) | ||
|
||
#### Command Line Options | ||
- `-D X`, `--directory=X`: Working Data Directory | ||
- `--tide=X`: Arctic Ocean tide model to download | ||
* AODTM-5 | ||
* AOTIM-5 | ||
* AOTIM-5-2018 | ||
- `-M X`, `--mode=X`: Permission mode of files downloaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
usap_cats_tides.py | ||
================== | ||
|
||
- Download Circum-Antarctic Tidal Simulations from the [US Antarctic Program](https://www.usap-dc.org) | ||
- [CATS2008](https://www.usap-dc.org/view/dataset/601235) | ||
|
||
#### Calling Sequence | ||
```bash | ||
python usap_cats_tides.py --directory=<path_to_tide_directory> --tide=CATS2008 | ||
``` | ||
[Source code](https://github.com/tsutterley/pyTMD/blob/master/scripts/usap_cats_tides.py) | ||
|
||
#### Command Line Options | ||
- `-D X`, `--directory=X`: Working Data Directory | ||
- `--tide=X`: Circum-Antarctic Tidal Simulation to download | ||
* CATS2008 | ||
- `-M X`, `--mode=X`: Permission mode of files downloaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#!/usr/bin/env python | ||
u""" | ||
arcticdata_tides.py | ||
Written by Tyler Sutterley (07/2020) | ||
Download Arctic Ocean Tide Models from the NSF ArcticData archive | ||
AODTM-5: https://arcticdata.io/catalog/view/doi:10.18739/A2901ZG3N | ||
AOTIM-5: https://arcticdata.io/catalog/view/doi:10.18739/A2S17SS80 | ||
AOTIM-5-2018: https://arcticdata.io/catalog/view/doi:10.18739/A21R6N14K | ||
CALLING SEQUENCE: | ||
python arcticdata_tides.py --tide=AOTIM-5-2018 | ||
COMMAND LINE OPTIONS: | ||
--help: list the command line options | ||
--directory=X: working data directory | ||
--tide=X: tide model to download | ||
AODTM-5 | ||
AOTIM-5 | ||
AOTIM-5-2018 | ||
-M X, --mode=X: Local permissions mode of the files downloaded | ||
PYTHON DEPENDENCIES: | ||
future: Compatibility layer between Python 2 and Python 3 | ||
https://python-future.org/ | ||
PROGRAM DEPENDENCIES: | ||
utilities: download and management utilities for syncing files | ||
UPDATE HISTORY: | ||
Written 08/2020 | ||
""" | ||
from __future__ import print_function | ||
|
||
import sys | ||
import os | ||
import re | ||
import time | ||
import getopt | ||
import zipfile | ||
import posixpath | ||
import pyTMD.utilities | ||
|
||
#-- PURPOSE: Download Arctic Ocean Tide Models from the NSF ArcticData archive | ||
def arcticdata_tides(MODEL,DIRECTORY=None,MODE=0o775): | ||
#-- doi for each model | ||
DOI = {} | ||
DOI['AODTM-5'] = '10.18739/A2901ZG3N' | ||
DOI['AOTIM-5'] = '10.18739/A2S17SS80' | ||
DOI['AOTIM-5-2018'] = '10.18739/A21R6N14K' | ||
#-- local subdirectory for each model | ||
LOCAL = {} | ||
LOCAL['AODTM-5'] = 'aodtm5_tmd' | ||
LOCAL['AOTIM-5'] = 'aotim5_tmd' | ||
LOCAL['AOTIM-5-2018'] = 'Arc5km2018' | ||
#-- recursively create directories if non-existent | ||
if not os.access(os.path.join(DIRECTORY,LOCAL[MODEL]), os.F_OK): | ||
os.makedirs(os.path.join(DIRECTORY,LOCAL[MODEL]), MODE) | ||
|
||
#-- build host url for model | ||
resource_map_doi = 'resource_map_doi:{0}'.format(DOI[MODEL]) | ||
HOST = ['https://arcticdata.io','metacat','d1','mn','v2','packages', | ||
pyTMD.utilities.quote_plus(posixpath.join('application','bagit-097')), | ||
pyTMD.utilities.quote_plus(resource_map_doi)] | ||
#-- download zipfile from host | ||
zfile = zipfile.ZipFile(pyTMD.utilities.from_http(HOST)) | ||
print('{0} -->\n'.format(posixpath.join(*HOST))) | ||
#-- find model files within zip file | ||
rx = re.compile('(grid|h[0]?|UV[0]?|Model|xy)_(.*?)',re.VERBOSE) | ||
members = [m for m in zfile.filelist if rx.search(m.filename)] | ||
#-- extract each member | ||
for m in members: | ||
#-- strip directories from member filename | ||
m.filename = posixpath.basename(m.filename) | ||
print('\t{0}\n'.format(os.path.join(DIRECTORY,LOCAL[MODEL],m.filename))) | ||
#-- extract file | ||
zfile.extract(m, path=os.path.join(DIRECTORY,LOCAL[MODEL])) | ||
#-- change permissions mode | ||
os.chmod(os.path.join(DIRECTORY,LOCAL[MODEL],m.filename), MODE) | ||
#-- close the zipfile object | ||
zfile.close() | ||
|
||
#-- PURPOSE: help module to describe the optional input parameters | ||
def usage(): | ||
print('\nHelp: {}'.format(os.path.basename(sys.argv[0]))) | ||
print(' -D X, --directory=X\tWorking data directory') | ||
print(' --tide=X\t\tArctic Ocean tide model to download') | ||
print('\tAODTM-5\n\tAOTIM-5\n\tAOTIM-5-2018') | ||
print(' -M X, --mode=X\t\tPermission mode of files downloaded\n') | ||
|
||
#-- Main program that calls arcticdata_tides() | ||
def main(): | ||
#-- Read the system arguments listed after the program | ||
long_options = ['help','directory=','tide=','mode='] | ||
optlist,arglist = getopt.getopt(sys.argv[1:],'hD:M:',long_options) | ||
|
||
#-- command line parameters | ||
DIRECTORY = os.getcwd() | ||
MODELS = ['AOTIM-5-2018'] | ||
#-- permissions mode of the local directories and files (number in octal) | ||
MODE = 0o775 | ||
for opt, arg in optlist: | ||
if opt in ('-h','--help'): | ||
usage() | ||
sys.exit() | ||
elif opt in ("-D","--directory"): | ||
DIRECTORY = os.path.expanduser(arg) | ||
elif opt in ("--tide",): | ||
MODELS = arg.upper().split(',') | ||
elif opt in ("-M","--mode"): | ||
MODE = int(arg, 8) | ||
|
||
#-- check internet connection before attempting to run program | ||
if pyTMD.utilities.check_connection('https://arcticdata.io'): | ||
for m in MODELS: | ||
arcticdata_tides(m,DIRECTORY=DIRECTORY,MODE=MODE) | ||
|
||
#-- run main program | ||
if __name__ == '__main__': | ||
main() |
Oops, something went wrong.