NOAA-OWP / hydrotools

Suite of tools for retrieving USGS NWIS observations and evaluating National Water Model (NWM) data.
Other
53 stars 12 forks source link

Event Detection methods are raising `FutureWarning` #246

Closed jarq6c closed 4 months ago

jarq6c commented 4 months ago

Running hydrotools.events.event_detection.decomposition.list_events results in several FutureWarning from pandas.

from hydrotools.events.event_detection.decomposition import list_events

events = list_events(
    df['value'],
    halflife='6H', 
    window='7D',
    minimum_event_duration='6H',
    start_radius='7H'
)
miniconda3/lib/python3.10/site-packages/hydrotools/events/event_detection/decomposition.py:117: FutureWarning: 'H' is deprecated and will be removed in a future version. Please use 'h' instead of 'H'.
  smooth = series.ewm(halflife=halflife, times=series.index,
miniconda3/lib/python3.10/site-packages/hydrotools/events/event_detection/decomposition.py:261: FutureWarning: 'H' is deprecated and will be removed in a future version. Please use 'h' instead of 'H'.
  minimum_event_duration = pd.Timedelta(minimum_event_duration)
miniconda3/lib/python3.10/site-packages/hydrotools/events/event_detection/decomposition.py:262: FutureWarning: 'H' is deprecated and will be removed in a future version. Please use 'h' instead of 'H'.
  start_radius = pd.Timedelta(start_radius)
miniconda3/lib/python3.10/site-packages/hydrotools/events/event_detection/decomposition.py:156: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`
  forward_shift = event_points.shift(1).fillna(False)
miniconda3/lib/python3.10/site-packages/hydrotools/events/event_detection/decomposition.py:161: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`
  backward_shift = event_points.shift(-1).fillna(False)
miniconda3/lib/python3.10/site-packages/hydrotools/events/event_detection/decomposition.py:156: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`
  forward_shift = event_points.shift(1).fillna(False)
miniconda3/lib/python3.10/site-packages/hydrotools/events/event_detection/decomposition.py:161: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`
  backward_shift = event_points.shift(-1).fillna(False)
jarq6c commented 4 months ago

@aaraney @hellkite500 @christophertubbs FYI: Ran into this warning while fixing this issue.

DeprecationWarning: 
  Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0)
aaraney commented 4 months ago

Hmmm, thanks for bringing this to our attention. I don't know if this will effect us or not? This might be hard to track, but my suggestion would be that we test against pandas release candidates once they release >=3.x. Thoughts?

jarq6c commented 4 months ago

Hmmm, thanks for bringing this to our attention. I don't know if this will effect us or not? This might be hard to track, but my suggestion would be that we test against pandas release candidates once they release >=3.x. Thoughts?

Maybe a good idea for reasons other than the PyArrow dependency.