-
Notifications
You must be signed in to change notification settings - Fork 30
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
views of variables don't use the DiskArrays interface #274
Comments
Just to demonstrate one possible fix: removing these view methods just totally fix the problem
The very same code as above gives
|
I'll just add an example with NCDatasets only, might be easier to see what is going on: using NCDatasets
NCDataset("test_file.nc","c") do ds
defVar(ds,"temp",rand(100,100),("lon","lat");
chunksizes = [10,10]
)
@time variable(ds, "temp") .+= 1
end; Before deleting the view methods: |
@Alexander-Barth, would you like to share your thoughts here? |
Personally, I do not make element-wise operations on types of NCDatasets. But a better integration with DiskArray would be very desirable but it is not that straightforward to implement.
All the code is in |
Needing a getproperties field is a real problem for shared APIs, and not really possible with DiskArrays.jl. But you can easily make an Otherwise this will be another ecosystem integration blocker. In Rasters we have to wrap your variables to prevent this from happening. (Also just realised a function based interface can get attribs after reshape or permutedims or whatever - a getproperty interface has the same problem with all of them) |
Calling
view
on aVariable
returns aSubVariable
fromCommonDataModel
, which doesn't implement the DiskArray interface.This unfortunately means that any chunked operation (such as lazy raster operations) are extremely slow, as discussed in rafaqz/Rasters.jl#889
For example:
The last operation here is slow because we are copying a DiskArray to a DiskArray, which happens chunk by chunk, so
view
is called internally. So clearly this is not great.Two possible way forward are to implement (parts of) the DiskArray interface for SubVariable, or to return a SubDiskArray from
view
onVariable
. Arguable NCDatasets violates the DiskArray interface here.The text was updated successfully, but these errors were encountered: