Skip to content
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

Changes to store interfaces and implementations #230

Merged
merged 7 commits into from
Oct 5, 2023
Merged

Conversation

carlosgjs
Copy link
Collaborator

@carlosgjs carlosgjs commented Sep 28, 2023

See discussion: #229

Summary of changes:

  • Redefined CrossCorrelationStore and StackStore to be more consistent
    • read_correlations and read_stacks are now both read
    • changes the order of parameters in the contains() methods
  • Changed the implementations of the numpy and zarr stores to use the hierarchy described in the discussion. These now share the bulk of the implementation for both CC and Stack.
  • Implemented an efficient caching of the cc/stack store directory

@carlosgjs carlosgjs temporarily deployed to github-pages October 4, 2023 00:04 — with GitHub Actions Inactive
@carlosgjs carlosgjs marked this pull request as ready for review October 4, 2023 00:04
@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (e80326c) 68.31% compared to head (36fdfc8) 69.29%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     noisepy/NoisePy#230      +/-   ##
==========================================
+ Coverage   68.31%   69.29%   +0.97%     
==========================================
  Files          34       36       +2     
  Lines        3955     4074     +119     
  Branches      542      565      +23     
==========================================
+ Hits         2702     2823     +121     
+ Misses       1120     1118       -2     
  Partials      133      133              
Files Coverage Δ
src/noisepy/seis/stack.py 88.32% <100.00%> (-0.97%) ⬇️
src/noisepy/seis/stores.py 77.96% <100.00%> (+4.99%) ⬆️
src/noisepy/seis/zarrstore.py 100.00% <100.00%> (ø)
tests/test_ccstores.py 100.00% <100.00%> (ø)
tests/test_hierarchicalstores.py 100.00% <100.00%> (ø)
tests/test_stack.py 100.00% <100.00%> (ø)
tests/test_stackstores.py 100.00% <100.00%> (ø)
tests/utils.py 100.00% <100.00%> (ø)
src/noisepy/seis/asdfstore.py 92.26% <93.54%> (+2.19%) ⬆️
src/noisepy/seis/datatypes.py 94.19% <81.81%> (-0.69%) ⬇️
... and 3 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@mdenolle mdenolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a major body of work!


class ASDFStackStore(StackStore):
def __init__(self, directory: str, mode: str = "a"):
super().__init__()
self.datasets = ASDFDirectory(directory, mode, _filename_from_stations, _parse_station_pair_h5file)

def append(self, src: Station, rec: Station, stacks: List[Stack]):
# TODO: Do we want to support storing stacks from different timespans in the same store?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably

for stack in stacks:
self.datasets.add_aux_data((src, rec), stack.parameters, stack.name, stack.component, stack.data)

def get_station_pairs(self) -> List[Tuple[Station, Station]]:
return self.datasets.get_keys()

def read_stacks(self, src: Station, rec: Station) -> List[Stack]:
def get_timespans(self, src: Station, rec: Station) -> List[DateTimeRange]:
# TODO: Do we want to support storing stacks from different timespans in the same store?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes eventually, we might want to store all timestamp from a given channel pair into the same store. this would be especially true for the "monitoring" application of this package.

Copy link
Collaborator Author

@carlosgjs carlosgjs Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, added issue https://github.com/noisepy/NoisePy/issues/232 to track this

@carlosgjs carlosgjs temporarily deployed to github-pages October 4, 2023 00:33 — with GitHub Actions Inactive
@carlosgjs carlosgjs changed the title RFC: Changes to store interfaces Changes to store interfaces and implementations Oct 4, 2023
@carlosgjs carlosgjs temporarily deployed to github-pages October 4, 2023 23:36 — with GitHub Actions Inactive
@carlosgjs carlosgjs merged commit 88dc14e into main Oct 5, 2023
@carlosgjs carlosgjs deleted the carlosg/storeint branch October 5, 2023 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants