-
Notifications
You must be signed in to change notification settings - Fork 152
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
(feat): xarray
with experimental backed
reading
#1247
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1247 +/- ##
==========================================
- Coverage 86.87% 84.57% -2.31%
==========================================
Files 39 44 +5
Lines 6036 6308 +272
==========================================
+ Hits 5244 5335 +91
- Misses 792 973 +181
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Co-authored-by: Philipp A. <[email protected]>
for more information, see https://pre-commit.ci
Co-authored-by: Philipp A. <[email protected]>
…erator_from_elems`
4947295
to
1540d27
Compare
/azp run |
Pull request contains merge conflicts. |
f = h5py.File(store, mode="r") | ||
|
||
def callback(func, elem_name: str, elem, iospec): | ||
if iospec.encoding_type == "anndata" or elem_name.endswith("/"): |
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.
What's the elem_name.endswith("/")
case?
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.
Presumably root store, we use this in all the other read methods...
try: | ||
import xarray as xr | ||
except ImportError: | ||
xr = None | ||
|
||
|
||
try: | ||
from xarray.backends.zarr import ZarrArrayWrapper | ||
except ImportError: | ||
|
||
class ZarrArrayWrapper: | ||
def __repr__(self) -> str: | ||
return "mock ZarrArrayWrapper" |
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.
This code means that you get a really confusing error if you run read_backed
without xarray
being installed
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.
Yes but unfortunately I think this compat layer is needed so that core is compatible. Maybe we can add a check within read_backed
?
Issue: if you run
|
@@ -757,6 +757,7 @@ def np_bool_to_pd_bool_array(df: pd.DataFrame): | |||
return df | |||
|
|||
|
|||
# TODO: concat for xarray |
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.
This would be nice to have with this PR. What are your thoughts on this @ilan-gold?
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.
Yea......I agree......
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.
Ok, sorry, I remember now. I looked into this...it's a lot of work...but maybe I'll try my hand at it....sometimes you get fatigue just from how daunting something seems
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 can try to help if you open a PR showing where you need input
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.
Ah @dcherian I am actually almost 100% sure this is already implemented in xarray
, but we need to get the functionality here! I think it's all good on your end but I will let you know if we need anything!
@ivirshup @ebezzi filed pydata/xarray#9519 but it should not block if it does not come out before this does IMO. And now: pydata/xarray#9520 |
This PR is a lighter weight version of #947 that involves using the original
AnnData
object as the class to holdobs
andvar
xr.Dataset
..obs
and.var
withbacked="r"
mode #981