Skip to content

Commit

Permalink
fix: revert TPXO9-atlas currents changes to separate dicts for #258
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutterley committed Nov 17, 2023
1 parent 5105a42 commit e861bd1
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 23 deletions.
83 changes: 61 additions & 22 deletions pyTMD/io/model.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python
u"""
model.py
Written by Tyler Sutterley (09/2023)
Written by Tyler Sutterley (11/2023)
Retrieves tide model parameters for named tide models and
from model definition files
UPDATE HISTORY:
Updated 11/2023: revert TPXO9-atlas currents changes to separate dicts
Updated 09/2023: fix scale values for TPXO9-atlas currents
Updated 08/2023: changed ESR netCDF4 format to TMD3 format
updated filenames for CATS2008-v2023 to final version
Expand Down Expand Up @@ -718,14 +719,22 @@ def current(self, m: str):
elif (m == 'TPXO9-atlas'):
self.model_directory = self.directory.joinpath('TPXO9_atlas')
self.grid_file = self.pathfinder('grid_tpxo9_atlas')
model_files = ['u_q1_tpxo9_atlas_30','u_o1_tpxo9_atlas_30',
model_files = {}
model_files['u'] = ['u_q1_tpxo9_atlas_30','u_o1_tpxo9_atlas_30',
'u_p1_tpxo9_atlas_30','u_k1_tpxo9_atlas_30',
'u_n2_tpxo9_atlas_30','u_m2_tpxo9_atlas_30',
'u_s2_tpxo9_atlas_30','u_k2_tpxo9_atlas_30',
'u_m4_tpxo9_atlas_30','u_ms4_tpxo9_atlas_30',
'u_mn4_tpxo9_atlas_30','u_2n2_tpxo9_atlas_30']
self.model_file = dict(u=self.pathfinder(model_files),
v=self.pathfinder(model_files))
model_files['v'] = ['v_q1_tpxo9_atlas_30','v_o1_tpxo9_atlas_30',
'v_p1_tpxo9_atlas_30','v_k1_tpxo9_atlas_30',
'v_n2_tpxo9_atlas_30','v_m2_tpxo9_atlas_30',
'v_s2_tpxo9_atlas_30','v_k2_tpxo9_atlas_30',
'v_m4_tpxo9_atlas_30','v_ms4_tpxo9_atlas_30',
'v_mn4_tpxo9_atlas_30','v_2n2_tpxo9_atlas_30']
self.model_file = {}
for key,val in model_files.items():
self.model_file[key] = self.pathfinder(val)
self.projection = '4326'
self.scale = 1e-4
self.version = 'v1'
Expand All @@ -735,14 +744,22 @@ def current(self, m: str):
elif (m == 'TPXO9-atlas-v2'):
self.model_directory = self.directory.joinpath('TPXO9_atlas_v2')
self.grid_file = self.pathfinder('grid_tpxo9_atlas_30_v2')
model_files = ['u_q1_tpxo9_atlas_30_v2','u_o1_tpxo9_atlas_30_v2',
model_files = {}
model_files['u'] = ['u_q1_tpxo9_atlas_30_v2','u_o1_tpxo9_atlas_30_v2',
'u_p1_tpxo9_atlas_30_v2','u_k1_tpxo9_atlas_30_v2',
'u_n2_tpxo9_atlas_30_v2','u_m2_tpxo9_atlas_30_v2',
'u_s2_tpxo9_atlas_30_v2','u_k2_tpxo9_atlas_30_v2',
'u_m4_tpxo9_atlas_30_v2','u_ms4_tpxo9_atlas_30_v2',
'u_mn4_tpxo9_atlas_30_v2','u_2n2_tpxo9_atlas_30_v2']
self.model_file = dict(u=self.pathfinder(model_files),
v=self.pathfinder(model_files))
model_files['v'] = ['v_q1_tpxo9_atlas_30_v2','v_o1_tpxo9_atlas_30_v2',
'v_p1_tpxo9_atlas_30_v2','v_k1_tpxo9_atlas_30_v2',
'v_n2_tpxo9_atlas_30_v2','v_m2_tpxo9_atlas_30_v2',
'v_s2_tpxo9_atlas_30_v2','v_k2_tpxo9_atlas_30_v2',
'v_m4_tpxo9_atlas_30_v2','v_ms4_tpxo9_atlas_30_v2',
'v_mn4_tpxo9_atlas_30_v2','v_2n2_tpxo9_atlas_30_v2']
self.model_file = {}
for key,val in model_files.items():
self.model_file[key] = self.pathfinder(val)
self.projection = '4326'
self.scale = 1e-4
self.version = 'v2'
Expand All @@ -751,15 +768,22 @@ def current(self, m: str):
elif (m == 'TPXO9-atlas-v3'):
self.model_directory = self.directory.joinpath('TPXO9_atlas_v3')
self.grid_file = self.pathfinder('grid_tpxo9_atlas_30_v3')
model_files = ['u_q1_tpxo9_atlas_30_v3','u_o1_tpxo9_atlas_30_v3',
model_files = {}
model_files['u'] = ['u_q1_tpxo9_atlas_30_v3','u_o1_tpxo9_atlas_30_v3',
'u_p1_tpxo9_atlas_30_v3','u_k1_tpxo9_atlas_30_v3',
'u_n2_tpxo9_atlas_30_v3','u_m2_tpxo9_atlas_30_v3',
'u_s2_tpxo9_atlas_30_v3','u_k2_tpxo9_atlas_30_v3',
'u_m4_tpxo9_atlas_30_v3','u_ms4_tpxo9_atlas_30_v3',
'u_mn4_tpxo9_atlas_30_v3','u_2n2_tpxo9_atlas_30_v3',
'u_mf_tpxo9_atlas_30_v3','u_mm_tpxo9_atlas_30_v3']
self.model_file = dict(u=self.pathfinder(model_files),
v=self.pathfinder(model_files))
'u_mn4_tpxo9_atlas_30_v3','u_2n2_tpxo9_atlas_30_v3']
model_files['v'] = ['v_q1_tpxo9_atlas_30_v3','v_o1_tpxo9_atlas_30_v3',
'v_p1_tpxo9_atlas_30_v3','v_k1_tpxo9_atlas_30_v3',
'v_n2_tpxo9_atlas_30_v3','v_m2_tpxo9_atlas_30_v3',
'v_s2_tpxo9_atlas_30_v3','v_k2_tpxo9_atlas_30_v3',
'v_m4_tpxo9_atlas_30_v3','v_ms4_tpxo9_atlas_30_v3',
'v_mn4_tpxo9_atlas_30_v3','v_2n2_tpxo9_atlas_30_v3']
self.model_file = {}
for key,val in model_files.items():
self.model_file[key] = self.pathfinder(val)
self.projection = '4326'
self.scale = 1e-4
self.version = 'v3'
Expand All @@ -768,15 +792,22 @@ def current(self, m: str):
elif (m == 'TPXO9-atlas-v4'):
self.model_directory = self.directory.joinpath('TPXO9_atlas_v4')
self.grid_file = self.pathfinder('grid_tpxo9_atlas_30_v4')
model_files = ['u_q1_tpxo9_atlas_30_v4','u_o1_tpxo9_atlas_30_v4',
model_files = {}
model_files['u'] = ['u_q1_tpxo9_atlas_30_v4','u_o1_tpxo9_atlas_30_v4',
'u_p1_tpxo9_atlas_30_v4','u_k1_tpxo9_atlas_30_v4',
'u_n2_tpxo9_atlas_30_v4','u_m2_tpxo9_atlas_30_v4',
'u_s2_tpxo9_atlas_30_v4','u_k2_tpxo9_atlas_30_v4',
'u_m4_tpxo9_atlas_30_v4','u_ms4_tpxo9_atlas_30_v4',
'u_mn4_tpxo9_atlas_30_v4','u_2n2_tpxo9_atlas_30_v4',
'u_mf_tpxo9_atlas_30_v4','u_mm_tpxo9_atlas_30_v4']
self.model_file = dict(u=self.pathfinder(model_files),
v=self.pathfinder(model_files))
'u_mn4_tpxo9_atlas_30_v4','u_2n2_tpxo9_atlas_30_v4']
model_files['v'] = ['v_q1_tpxo9_atlas_30_v4','v_o1_tpxo9_atlas_30_v4',
'v_p1_tpxo9_atlas_30_v4','v_k1_tpxo9_atlas_30_v4',
'v_n2_tpxo9_atlas_30_v4','v_m2_tpxo9_atlas_30_v4',
'v_s2_tpxo9_atlas_30_v4','v_k2_tpxo9_atlas_30_v4',
'v_m4_tpxo9_atlas_30_v4','v_ms4_tpxo9_atlas_30_v4',
'v_mn4_tpxo9_atlas_30_v4','v_2n2_tpxo9_atlas_30_v4']
self.model_file = {}
for key,val in model_files.items():
self.model_file[key] = self.pathfinder(val)
self.projection = '4326'
self.scale = 1e-4
self.version = 'v4'
Expand All @@ -785,16 +816,24 @@ def current(self, m: str):
elif (m == 'TPXO9-atlas-v5'):
self.model_directory = self.directory.joinpath('TPXO9_atlas_v5')
self.grid_file = self.pathfinder('grid_tpxo9_atlas_30_v5')
model_files = ['u_q1_tpxo9_atlas_30_v5','u_o1_tpxo9_atlas_30_v5',
model_files = {}
model_files['u'] = ['u_q1_tpxo9_atlas_30_v5','u_o1_tpxo9_atlas_30_v5',
'u_p1_tpxo9_atlas_30_v5','u_k1_tpxo9_atlas_30_v5',
'u_n2_tpxo9_atlas_30_v5','u_m2_tpxo9_atlas_30_v5',
'u_s1_tpxo9_atlas_30_v5','u_s2_tpxo9_atlas_30_v5',
'u_k2_tpxo9_atlas_30_v5','u_m4_tpxo9_atlas_30_v5',
'u_ms4_tpxo9_atlas_30_v5','u_mn4_tpxo9_atlas_30_v5',
'u_2n2_tpxo9_atlas_30_v5','u_mf_tpxo9_atlas_30_v5',
'u_mm_tpxo9_atlas_30_v5']
self.model_file = dict(u=self.pathfinder(model_files),
v=self.pathfinder(model_files))
'u_2n2_tpxo9_atlas_30_v5']
model_files['v'] = ['v_q1_tpxo9_atlas_30_v5','v_o1_tpxo9_atlas_30_v5',
'v_p1_tpxo9_atlas_30_v5','v_k1_tpxo9_atlas_30_v5',
'v_n2_tpxo9_atlas_30_v5','v_m2_tpxo9_atlas_30_v5',
'u_s1_tpxo9_atlas_30_v5','u_s2_tpxo9_atlas_30_v5',
'u_k2_tpxo9_atlas_30_v5','u_m4_tpxo9_atlas_30_v5',
'u_ms4_tpxo9_atlas_30_v5','u_mn4_tpxo9_atlas_30_v5',
'u_2n2_tpxo9_atlas_30_v5']
self.model_file = {}
for key,val in model_files.items():
self.model_file[key] = self.pathfinder(val)
self.projection = '4326'
self.scale = 1e-4
self.version = 'v5'
Expand Down
2 changes: 1 addition & 1 deletion pyTMD/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
# get version
version = metadata["version"]
# append "v" before the version
full_version = "v{0}".format(version)
full_version = f"v{version}"
# get project name
project_name = metadata["Name"]

0 comments on commit e861bd1

Please sign in to comment.