-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
DiskArrays for CFVariable #9
base: main
Are you sure you want to change the base?
Conversation
Why is it hard to extend |
This |
@Alexander-Barth did you try at this after our last discussion? (I'm realising GRIBDatasets.jl is a bit broken without this, and the hacks I've done to make it work in Rasters are not holding up well. SO I can work on this PR a bit to get it done, if that would be helpful, and if the plan is to merge it) |
Yes, the plan is to merge it :-) vv = defVar(ds,"foo",Float64,())
vv[] = 12
Ideally, it should work like this: a = Array{Float64,0}(undef,())
# 0-dimensional Array{Float64, 0}:
# 6.90859146202467e-310
a[] = 123 I will need to investigate what the problem is. Maybe I need a special case for 0-dimensional arrays and empty indices, similar to this: |
That looks like your But we will want to skip around DiskArrays indexing completely for the memory backed arrays so this won't be hit anyway. That just means adding the same getindex/setindex etc that DiskArrays adds, but on the specific variable type. But it could also be done with a simple trait if we want to add it to DiskArrays. But good to know the intention is to merge the PR! I think we will need to delete a lot of code here for it to work consistently. The SubArray implementation especially. As shown in the NCDatasets.jl issue deleting those methods is whats needed to make broadcasts work. CatArrays.jl can also be deleted for the same reason. I started on that but I'm just not sure what degree of changes will be accepted, so it's hard for me to be motivated to put in the time needed to do it. My current thinking is its easier for me to insulate Rasters from the bugs in CommonDataModel variables by always wrapping variables in a proper DiskArray that we can be sure works. But long term for the ecosystem we should fix CDM/DiskArrays interop |
As discussed in issue #8.
It currently requires the implementing modules to extend the
Base.parent
method for the Variables, that should return the reference to the underlying array. That makes sense for GRIBDatasets, but I don't think it will be that easy for NCDatasets... This PR is needed for GRIBDataset in Raster to work, but simultaneously, it breaks NCDatasets. So consider this PR has a shared experimentation for now :-)