DASDAE / dascore

A python library for distributed fiber optic sensing
Other
71 stars 16 forks source link

Better control of merging from spool.chunk #360

Open d-chambers opened 5 months ago

d-chambers commented 5 months ago

Description

Currently, Spool.Chunk(time=None) is used to merge patches together. However, sometimes patches are incompatible and shouldn't be merged, for example, if the experiment/station id is different. Currently, patches with different histories are not merged together. We should provide more control from Spool.chunk for merging patches.

Example

import dascore as dc

patch_1, patch_2 = dc.get_example_spool("random_das", length=2)

new_patches = [patch_1.resample(time=0.1), patch_2.resample(time=0.1)]

spool = dc.spool(new_patches).chunk(time=None) 
# The line above doesn't work because the history is slightly different for each patch
# it probably shouldn't be, so this could be a different issue.

Expected behavior

It would be nice to be able to ignore certain attributes.

e.g.,

spool.chunk(time=None, ignore_attrs=("history"))

but this will require a bit of plumbing to get the info to the right place. It may also be a chance to refactor some of the chunking code...

Versions

ahmadtourei commented 3 months ago
spool = dc.spool(new_patches).chunk(time=None) 

This line works for me. Isn't it expected to work? I can't see how the history is different for each patch.