Comments (3)
I do think missing values ought to be handled in a preprocessing step and the README/docs recommend tips to run event detection, including filling missing data. However, this burden is on the caller. There are too many types of signals and data to account for all the possible ways a given time series could be filled. In some cases, it comes down to personal preference.
I would certainly question the events returned, so a warning may be justified, but I don't think event detection should fill values on the behalf of the user.
from hydrotools.
The filters seem robust again NaN values. The algorithm completes and returns data if NaNs are present. I ran the example below using a 7-day (larger than the gap) and a 30-minute (smaller than the gap) window. The NaNs will definitely influence the deviation from the median signal and effect where the start and end event time land. It's still not recommended to run event detection on time series with missing data, but it won't shut down the process and at least in this case return consistent (if not sensible) "events."
# Import tools to retrieve data and detect events
from hydrotools.nwis_client.iv import IVDataService
from hydrotools.events.event_detection import decomposition as ev
import matplotlib.pyplot as plt
# Retrieve streamflow observations for two sites
service = IVDataService(
value_time_label="value_time"
)
observations = service.get(
sites='01360640',
startDT='2021-07-01',
endDT='2021-08-01'
)
# Drop extra columns to be more efficient
observations = observations[[
'value_time',
'value'
]]
# Check for duplicate time series, keep first by default
observations = observations.drop_duplicates(
subset=['value_time']
)
# Resample to hourly, keep first measurement in each 1-hour bin
observations = observations.set_index("value_time")
observations = observations.resample("15min").nearest(limit=1)
# Detect events
events = ev.list_events(
observations['value'],
halflife='6H',
window='7D',
start_radius="24H"
)
# Print event list
print(events)
# Plot
observations.plot(logy=True)
observations.loc[events.start, "value"].plot(style="o", ax=plt.gca())
observations.loc[events.end, "value"].plot(style="o", ax=plt.gca())
plt.show()
from hydrotools.
I agree with your decision here (not that it matters). You should be able to use the tool improperly. I think there is sufficient documentation and citations to feel comfortable about this issue.
from hydrotools.
Related Issues (20)
- Link to AGU Poster HOT 1
- As ROE user, I am getting a file that cache nwis data in my working folder that is collapsing the system. HOT 13
- NWIS Client: Expose cache filename as option HOT 8
- As a User, I would like HydroTools to expose public api tooling at the subpackage level HOT 5
- Incorrect import in nwm client example HOT 1
- Nwm client IndexError: invalid index to scalar variable. HOT 6
- Consider a different documentation generation engine HOT 5
- contingency_table computed from compute_contingency_table doesnโt contain both True and False for the observed or the simulated series HOT 1
- Nwis Client fails trying to iterate a datetime.datetime object HOT 6
- Add note about cache version incompatibility to NWIS Client docs HOT 2
- `nwm_client` does not work in FIPS environments HOT 1
- Complications with HDF5 dependency on mac silicon HOT 7
- submitted hydrotools.nwm-client to conda-forge
- National Water Center Visualization Client Tools
- Add "confidence" parameter to `metrics.probability_of_false_alarm`
- NOTICE: Incorrect NWM RouteLink Assignment - Channel Feature 3624261 HOT 6
- Modules missing stubs or py.typed markers
- Build errors with latest hydrotools HOT 7
- NWIS IV Client `FutureWarning` HOT 3
- NWM Client New Test Failure: AttributeError: 'EntryPoints' object has no attribute 'get' HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hydrotools.