-
Notifications
You must be signed in to change notification settings - Fork 29
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
deduplicate timestamps with check #96
deduplicate timestamps with check #96
Conversation
This is failing the tests as xarray compatible with Python 3.7 doesn't have |
It appears to work on Python 3.8 and more recent versions. We could skip the call to drop_duplicates if the function does not exist and raise a warning that it's been skipped? |
I think we could pin to 3.8. That's almost 3 years old. |
I added a check for drop_duplicates that works around the problem. Or would you prefer to drop 3.8 now? |
pyglider/seaexplorer.py
Outdated
raise ValueError(f"{loss_str} Check input data for duplicate timestamps") | ||
elif proportion_kept < 0.999: | ||
_log.warning(loss_str) | ||
if "drop_duplicates" in ds.__dir__(): |
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.
I think:
if "drop_duplicates" in ds.__dir__(): | |
if hasattr(ds, "drop_duplicates"): |
pyglider/seaexplorer.py
Outdated
else: | ||
_log.info(loss_str) |
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.
Can we just write our own drop_duplicates
? Its basically good = (ds.time.diff() > 1e-6) ds = ds.isel(time=good), plus or minus one on the index, and maybe keeping the first index.
Feel free to self-merge if you are done.... |
This resolves #95
Varying response depending on how many samples are removed by this deduplication:
more than half lost - error
more than 0.1 % lost - warning
otherwise log
order by time and drop_duplicates moved before
oxygen_concentration_correction
so the reindex in this function does not breeak.