diff --git a/pyTMD/io/model.py b/pyTMD/io/model.py index d53e441e..c10468b1 100644 --- a/pyTMD/io/model.py +++ b/pyTMD/io/model.py @@ -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 @@ -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' @@ -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' @@ -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' @@ -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' @@ -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' diff --git a/pyTMD/version.py b/pyTMD/version.py index 26e046eb..d12ade6c 100644 --- a/pyTMD/version.py +++ b/pyTMD/version.py @@ -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"]