-
Notifications
You must be signed in to change notification settings - Fork 76
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
Change output of open_raw to an EchoData object #282
Change output of open_raw to an EchoData object #282
Conversation
… work on ek80 beam/beam_power
@lsetiawan : Could you take a look at the use of |
Looks like you integrated PR #281 into here is that correct? |
echopype/echodata/echodata.py
Outdated
elif convert_type == "netcdf4": | ||
return out_f | ||
|
||
def _to_file( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... looks like you integrated a lot of the stuff from Convert Object ... Not sure if this is the best way to go because I can see EchoData ending up being convoluted ... I think it might be better if you keep all of these functions in the Convert Object and use that within EchoData.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, those transplanted functions are my biggest hesitation, as in whether to keep them in Convert or move them to EchoData. (I was thinking about getting rid of the Convert object!) But looking at this again maybe it'll be better that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I think it's okay to keep the Convert object. Since we know it already works and this would split up the functionalities, and we can just test individually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh now I remember why I did that: the main thing is that now the set groups functions return xr.Dataset and are linked directly to attributes of EchoData in open_raw. That's why I felt the Convert class can actually be removed and substituted by the same functionalities in EchoData. This does make EchoData more convoluted though I agree. Hmm... thoughts?
@@ -14,7 +14,7 @@ | |||
import xarray as xr | |||
import pytest | |||
from pathlib import Path | |||
from ..convert import open_raw | |||
from ..echodata import open_raw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For tests, it's better if you don't do relative paths since echodata
should be installed before you run pytest. So you can just do from echodata import ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, cool, thanks for explaining this!
Yes, wanted to make sure I got your changes in before starting this. |
Noting conversations in leewujung#3 for more changes on this PR. |
Update open_raw
@lsetiawan thanks for the changes! I just put updates the PR message to include next steps and will merge this now. |
This PR:
open_raw
from aConvert
object to anEchoData
objectopen_raw
to parse the raw data files and organize the parsed data into attributes of the outputEchoData
object. This requires user to useEchoData.to_zarr/to_netcdf
to save the parsed data to file. This addresses separate nc4/xarray dataset group creation from file saving functionality #228 and is related to save vs set in class redesign #225.Note:
open_raw
only works with parsing a single raw data file.open_raw
andopen_converted
are now underechodata/open_file.py
. I was debating ifopen_raw
should remain in theconvert
module but eventually moved it to underechodata
. Let me know if you think otherwise.Todo for later PRs:
open_mfraw
to parse multiple raw files and combine the parsed data into attributes of a singleEchoData
object.Convert
class since its function as an interface for usingParseXX
andSetGroupsXX
objects can now be substituted withEchodata
Updates
Convert
is now deprecated with all functionalities provided directly byParse
andSetGroup
objects