-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More work on internal data structures #269
Conversation
…ames are not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good in general.
Do we need this logic in the Comparer
modelskill/modelskill/comparison/_comparison.py
Lines 752 to 777 in 9ed46fc
if not isinstance(other, (Comparer, ComparerCollection)): | |
raise TypeError(f"Cannot add {type(other)} to {type(self)}") | |
if isinstance(other, Comparer) and (self.name == other.name): | |
assert type(self) == type(other), "Must be same type!" | |
missing_models = set(self.mod_names) - set(other.mod_names) | |
if len(missing_models) == 0: | |
# same obs name and same model names | |
cmp = self.copy() | |
cmp.data = xr.concat([cmp.data, other.data], dim="time") | |
# cc.data = cc.data[ | |
# ~cc.data.time.to_index().duplicated(keep="last") | |
# ] # 'first' | |
_, index = np.unique(cmp.data["time"], return_index=True) | |
cmp.data = cmp.data.isel(time=index) | |
else: | |
raw_mod_data = self.raw_mod_data.copy() | |
raw_mod_data.update(other.raw_mod_data) | |
matched = match_time( | |
observation=self._to_observation(), raw_mod_data=raw_mod_data | |
) | |
cmp = self.__class__(matched_data=matched, raw_mod_data=raw_mod_data) | |
return cmp | |
else: |
Isn't this taken care of already by the ComparerCollection
?
If so, then we could also get rid of Comparer._to_observation()
…forgets which kind it is
and a lot of cleaning, restructuring etc