Skip to content

Consistent Metadata with updated versions of MTH5 and MT-metadata#239

Merged
kkappler merged 55 commits intomainfrom
consistent_metadata
Jan 13, 2023
Merged

Consistent Metadata with updated versions of MTH5 and MT-metadata#239
kkappler merged 55 commits intomainfrom
consistent_metadata

Conversation

@kujaku11
Copy link
Collaborator

@kujaku11 kujaku11 commented Dec 15, 2022

Going through and trying to make sure metadata and methods are consistent with updated versions of MTH5 and mt-metadata before I merge them with master. The update was creating a single metadata object under the hood for mth5.timeseries.ChannelTS and mth5.timeseries.RunTS to allow for more self-consistent metadata. To do this an object was created for the list of metadata objects at the level below called mt_metadata.utils.list_dict.ListDict, which can be indexed as a list or keyed like a dictionary.

For example:

from mt_metadata.timeseries import Station, Run

s = Station(id="mt001")
s.add_run(Run(id="a"))
s.add_run(Run(id='"b"))

run_indexed = s.runs[0]
run_keyed = s.runs["a"]

# can be mixed slice as well
run_mixed = s.runs[0:"b"]
run_mixed = s.runs["a":]

Tasks Before Merging

  • Go through and update metadata and methods to be consistent
  • Make sure all tests run for all packages
    • MT-metadata
      • Merge or edit branch in MT-metadata PR#118
    • MTH5
    • Aurora

@codecov
Copy link

codecov bot commented Dec 15, 2022

Codecov Report

Merging #239 (1037175) into main (0f7c8f8) will decrease coverage by 0.08%.
The diff coverage is 69.84%.

@@            Coverage Diff             @@
##             main     #239      +/-   ##
==========================================
- Coverage   77.62%   77.53%   -0.09%     
==========================================
  Files         101       99       -2     
  Lines        5470     5493      +23     
==========================================
+ Hits         4246     4259      +13     
- Misses       1224     1234      +10     
Impacted Files Coverage Δ
aurora/pipelines/process_mth5.py 98.11% <ø> (ø)
aurora/pipelines/run_summary.py 88.88% <ø> (ø)
aurora/pipelines/time_series_helpers.py 75.57% <ø> (+2.38%) ⬆️
aurora/sandbox/butterworth_filters.py 0.00% <0.00%> (ø)
aurora/time_series/windowed_time_series.py 50.74% <28.57%> (-3.36%) ⬇️
tests/parkfield/test_process_parkfield_run_rr.py 78.26% <41.66%> (-16.19%) ⬇️
tests/parkfield/test_process_parkfield_run.py 82.25% <47.36%> (-13.58%) ⬇️
tests/parkfield/test_calibrate_parkfield.py 80.00% <61.11%> (-13.94%) ⬇️
aurora/sandbox/io_helpers/make_mth5_helpers.py 91.66% <75.00%> (-6.01%) ⬇️
aurora/test_utils/parkfield/make_parkfield_mth5.py 81.08% <81.08%> (ø)
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

kujaku11 and others added 26 commits December 15, 2022 15:29
This does not solve the larger issue, but it is intended to allow all
tests to pass on github when PKD and SAO are unavailable due to NCEDC
communications issues.

[Issue(s): #159]
… maybe causing github actions to execute them as tests when imported
Very weird message from github actions associated with  memory error
(pasted below)

However, 2 of 4 python versions passed, 3.6, 3.7, but 3.8, 3.9 failed.

iFAILED tests/parkfield/test_process_parkfield_run.py::test_processing - numpy.core._exceptions._ArrayMemoryError: Unable to allocate 14.2 GiB for an array with shape (1900490400,) and data type float64
FAILED tests/parkfield/test_process_parkfield_run.py::test - numpy.core._exceptions._ArrayMemoryError: Unable to allocate 14.2 GiB for an array with shape (1900490400,) and data type float64
FAILED tests/parkfield/test_process_parkfield_run_rr.py::test_processing - numpy.core._exceptions._ArrayMemoryError: Unable to allocate 12.9 GiB for an array with shape (1737962400,) and data type float64
FAILED tests/parkfield/test_process_parkfield_run_rr.py::test - numpy.core._exceptions._ArrayMemoryError: Unable to allocate 12.9 GiB for an array with shape (1737962400,) and data type float64

[Issue(s): #156]
-allow bare exception and add some assert and print statements
Multi-line description of commit,
feel free to be detailed.

[Issue(s): X]
Looks like an mth5 is being created in test_calibrte_parkfield ...
Reduce to bare except
[Issue(s): #156]
@kkappler
Copy link
Collaborator

kkappler commented Dec 30, 2022

The aurora tests are failing for several reasons, which all appear to be because NCEDC is down, but none actually are.

  • Python 3.6 failure is not fully debugged, but is likely due to a combination of issues that will be described in python 3.7, 3.8, 3.9
    • I suggest we deprecate support for 3.6 in aurora. The main reason for this is that a full python3 version of obspy are now available, (1.3, 1.3.1 and 1.4) but the 1.3 versions are python>=3.7 and the 1.4 version is python>=3.8.
  • The python 3.7 failure was triggered by two things:

So, the strategy for getting this PR across the line should probably be to review the Auxiliary channel issue. I created an issue#117 in mt_metadata to take a look at this.

A few other observations of things that can be improved when this PR is merged:

  • Add logic for NCEDC client so that if obspy Client does not initialize with base_url keyword "NCEDC", try agian with explicit address "https://service.ncedc.org/"
  • get_response_inventory_from_server could actually be moved out of xml_sandbox and into fdsn_dataset_config
  • Client can then be made an attribute or method of the FDSNDatasetConfig class, and then we don't need to reinitialize it when getting data
  • in mth5 the read_back_data method should close the mth5 object before returning

kkappler and others added 20 commits December 31, 2022 16:39
…o make_pkdsao_mth5 taking dataset_id as argument
- [x] simplify FDSNDatasetConfig so it doesn't need additional methods from xml_sandbox.
- [x] Drop methods from xml_sandbox now in FDSNDatasetConfig
- [x] rename FDSNDatasetConfig to FDSNDataset
- [x] Place client method in FDSNDataset
- [x] move describe_inventory_stages from xml_sandbox to inventory_review
- [x] tidy comments in make_mth5_helpers

Issues: [#159]
There are enough examples of these around, and
any further development of these tools belongs in mt_metadata.

Hopefully, removing this will make code-cov happier
@kkappler kkappler merged commit c6f67f1 into main Jan 13, 2023
@kkappler kkappler deleted the consistent_metadata branch January 13, 2023 23:37
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