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

refactor(convert): Full refactor for the usage of disk during memory expansion [all tests ci] #1185

Merged
merged 53 commits into from
Nov 7, 2023

Conversation

lsetiawan
Copy link
Member

@lsetiawan lsetiawan commented Oct 2, 2023

Overview

This PR does a full refactor for the "swap" functionality by largely removing the whole usage of Parsed2Zarr objects in favor of a simpler direct usage of zarr library features to create arrays.

Issues Resolved

leewujung and others added 7 commits September 27, 2023 10:01
@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2023

Codecov Report

Merging #1185 (bf895a1) into dev (f98e825) will increase coverage by 5.32%.
The diff coverage is 88.46%.

@@            Coverage Diff             @@
##              dev    #1185      +/-   ##
==========================================
+ Coverage   77.80%   83.13%   +5.32%     
==========================================
  Files          66       63       -3     
  Lines        6002     5710     -292     
==========================================
+ Hits         4670     4747      +77     
+ Misses       1332      963     -369     
Flag Coverage Δ
unittests 83.13% <88.46%> (+5.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
echopype/convert/api.py 88.70% <100.00%> (+2.69%) ⬆️
echopype/convert/parse_ek60.py 70.00% <100.00%> (ø)
echopype/convert/parse_ek80.py 50.00% <100.00%> (ø)
echopype/convert/set_groups_base.py 82.35% <100.00%> (-0.15%) ⬇️
echopype/convert/set_groups_ek60.py 100.00% <100.00%> (+6.45%) ⬆️
echopype/convert/set_groups_ek80.py 98.33% <100.00%> (+12.11%) ⬆️
echopype/convert/utils/ek_swap.py 100.00% <100.00%> (ø)
echopype/core.py 85.18% <ø> (-1.03%) ⬇️
echopype/testing.py 95.45% <95.29%> (-4.55%) ⬇️
echopype/echodata/echodata.py 77.49% <62.50%> (-0.40%) ⬇️
... and 2 more

... and 1 file with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

Added 'expanded_data_shapes' property to parse base
to compute the expansion shapes. Additionally, moved the determination
of 'use_swap' to during rectangularization. Re-activated 'auto'
keyword for destination_path.
By default when destination path is None, now the program
will use the built in tempfile module. This will ensure
that swap files can be cleaned up by the Operating System.

Introduced a new global variable in 'io' called 'ECHOPYPE_TEMP_DIR'
to specify the path to the temporary 'echopype' directory within the OS
temp directory. This is initialized on echopype import.

Additionally, moved I/O related functions with swap files now to the
higher level 'io' module in 'utils'.
@lsetiawan
Copy link
Member Author

lsetiawan commented Oct 4, 2023

Note to self: Look into the potential use of context manager for open_raw? https://realpython.com/python-with-statement/

Too complex at this moment... tabling this.

Add a check for ping_time dimension shape and
ensure that the written zarr array has the same
shape so that it doesn't fail at set_beam.
@lsetiawan lsetiawan changed the title refactor(convert): Full refactor for the usage of disk during memory expansion refactor(convert): Full refactor for the usage of disk during memory expansion [all tests ci] Nov 7, 2023
@lsetiawan lsetiawan closed this Nov 7, 2023
@lsetiawan lsetiawan reopened this Nov 7, 2023
Copy link
Member

@leewujung leewujung left a comment

Choose a reason for hiding this comment

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

Hey @lsetiawan : THANK YOU! This PR looks great! I see that you've resolved most of my comments yesterday. The remaining ones are pretty small. Also awesome to see the use of mocker in the tests -- it sets a couple great examples to add more tests to cover parser and set_groupers in the future.

My only significant comment is the one related to the reshaping of complex variables. It is a small change, but since this PR is already very large, and touching the parser usually takes extra care, I think it's better to take it in another PR. We have a couple tests that test for the actual parsed values that would be good for catching any errors.

@lsetiawan
Copy link
Member Author

@leewujung Thanks for this extensive review! I'm glad that the review went well and that you're satisfied with the changes 😄

Regarding your last comment:

My only significant comment is the one related to the reshaping of complex variables.

Would you be able to create a new issue for this so that it can be tracked? Thanks!

@lsetiawan lsetiawan merged commit 499866f into OSOceanAcoustics:dev Nov 7, 2023
3 checks passed
@lsetiawan lsetiawan deleted the refac_swap branch November 7, 2023 18:10
@lsetiawan
Copy link
Member Author

Would you be able to create a new issue for this so that it can be tracked? Thanks!

Nvm, just quickly did this. See #1213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants