Skip to content

Commit

Permalink
Have to use with xr.set_options(keep_attrs=True) otherwise DataArray …
Browse files Browse the repository at this point in the history
…forgets which kind it is
  • Loading branch information
jsmariegaard committed Oct 14, 2023
1 parent 3637c76 commit be54548
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modelskill/comparison/_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,10 +1140,12 @@ def remove_bias(self, correct="Model"):
mod_name = self.mod_names[j]
mod_df = self.raw_mod_data[mod_name]
mod_df[mod_name] = mod_df.values - bias[j]
self.data[mod_name] = self.data[mod_name] - bias[j]
with xr.set_options(keep_attrs=True):
self.data[mod_name] = self.data[mod_name] - bias[j]
elif correct == "Observation":
# what if multiple models?
self.data[self._obs_name] = self.obs + bias
with xr.set_options(keep_attrs=True):
self.data[self._obs_name] = self.obs + bias
else:
raise ValueError(
f"Unknown correct={correct}. Only know 'Model' and 'Observation'"
Expand Down

0 comments on commit be54548

Please sign in to comment.