Skip to content

Commit

Permalink
Fix renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Oct 19, 2024
1 parent 76135a5 commit 97242b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions polaris/ocean/model/ocean_io_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def map_to_native_model_vars(self, ds):
model = config.get('ocean', 'model')
if model == 'omega':
assert self.mpaso_to_omega_var_map is not None
ds = ds.rename(self.mpaso_to_omega_var_map)
rename = {k: v for k, v in self.mpaso_to_omega_var_map.items()
if k in ds}
ds = ds.rename(rename)
return ds

def write_model_dataset(self, ds, filename):
Expand Down Expand Up @@ -115,7 +117,9 @@ def map_from_native_model_vars(self, ds):
model = config.get('ocean', 'model')
if model == 'omega':
assert self.omega_to_mpaso_var_map is not None
ds = ds.rename(self.omega_to_mpaso_var_map)
rename = {k: v for k, v in self.omega_to_mpaso_var_map.items()
if k in ds}
ds = ds.rename(rename)
return ds

def open_model_dataset(self, filename, **kwargs):
Expand Down

0 comments on commit 97242b4

Please sign in to comment.