-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Not a super important issue, but we get a NotImplementedError when applying units (which are not necessary for the chunk function).
Example
import dascore as dc
from dascore.units import s
spool = dc.get_example_spool()
sub_spool = spool.chunk(time=1*s)raises:
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
Cell In[18], [line 5](vscode-notebook-cell:?execution_count=18&line=5)
[2](vscode-notebook-cell:?execution_count=18&line=2) from dascore.units import s
[4](vscode-notebook-cell:?execution_count=18&line=4) spool = dc.get_example_spool()
----> [5](vscode-notebook-cell:?execution_count=18&line=5) sub_spool = spool.chunk(time=1*s)
File c:\Users\tourei\dasmasw\dasmsw_testing\.venv\lib\site-packages\dascore\core\spool.py:492, in DataFrameSpool.chunk(self, overlap, keep_partial, snap_coords, tolerance, conflict, **kwargs)
[482](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:482) df = self._df.drop(columns=list(self._drop_columns), errors="ignore")
[483](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:483) chunker = ChunkManager(
[484](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:484) overlap=overlap,
[485](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:485) keep_partial=keep_partial,
(...)
[490](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:490) **kwargs,
[491](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:491) )
--> [492](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:492) in_df, out_df = chunker.chunk(df)
[493](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:493) if df.empty:
[494](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/core/spool.py:494) instructions = None
File c:\Users\tourei\dasmasw\dasmsw_testing\.venv\lib\site-packages\dascore\utils\chunk.py:449, in ChunkManager.chunk(self, df)
[447](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/utils/chunk.py:447) group_maxs = stop.groupby(group).max()
[448](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/utils/chunk.py:448) # split/group dataframe into new chunks by iterating over each group.
--> [449](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/utils/chunk.py:449) out = self._get_group_dfs(group, dur, overlap, group_mins, group_maxs, df, step)
[450](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/utils/chunk.py:450) if not len(out):
[451](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/utils/chunk.py:451) msg = "Could not chunk. No segments with sufficient length found."
...
[171](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/utils/time.py:171) return np.timedelta64("NaT")
[172](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/utils/time.py:172) msg = f"type {type(obj)} is not supported"
--> [173](file:///C:/Users/tourei/dasmasw/dasmsw_testing/.venv/lib/site-packages/dascore/utils/time.py:173) raise NotImplementedError(msg)
NotImplementedError: type <class 'pint.Quantity'> is not supportedExpected behavior
Versions
- OS [e.g. Ubuntu 20.04]:
- DasCore Version [e.g. 0.0.5]:
- Python Version [e.g. 3.10]:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working