Skip to content

Check if parent variable is an array in readblock! #43

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

Merged
merged 1 commit into from
May 9, 2025

Conversation

tiemvanderdeure
Copy link
Contributor

Implement a check to determine if the parent variable is an array in readblock!

readblock! normally isn't called for variables with array parent, but in rafaqz/Rasters.jl#966 we found a case where it is and this immediately errors.

This is a bit of a temporary fix to avoid that error. In the long term 1) CDM changes will affect this a little bit, 2) maybe we want to change DA.@implement_diskarray Variable to `DA.@implement_diskarray Variable{<:Any,<:Any,DiskValues}?, 3) maybe we could avoid eagerly reading some values.

@tcarion
Copy link
Member

tcarion commented May 9, 2025

Thanks for the PR!

I need to catch up a little bit with this issue and investigate a little bit what could be done better in GRIBDatasets, but let's stick to this fix for now

@tcarion tcarion merged commit efb8d42 into JuliaGeo:main May 9, 2025
5 of 6 checks passed
@tcarion
Copy link
Member

tcarion commented May 9, 2025

I'm realizing that these lines were already dispatching properly between normal Array and DiskArray

And this doesn't seem to fix the Rasters issue

@tiemvanderdeure
Copy link
Contributor Author

I'm realizing that these lines were already dispatching properly between normal Array and DiskArray

The problem occurs only when a Variable is wrapped in something else (in the case of Rasters, a ModifiedDiskArray), then you index into the wrapper, which forwards to readblock! on the wrapper, which forwards to readblock! on the Variable, which then errors. And those getindex dispatches never get called.

There are a few other Rasters bugs but this should help

@tcarion
Copy link
Member

tcarion commented May 12, 2025

Ok I understand better now, thank you for the clarification!

I don't know what would be the cleanest long-term solution here. Given the design of GRIB files (as shortly described here), I don't see how non-horizontal dimensions lookups could be something else than memory arrays. But the choice of loading horizontal dimension lookups into memory was pretty arbitrary, and if it's causing issues, I can try to modify the GRIBDatasets design to keep them on disk.

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

Successfully merging this pull request may close these issues.

2 participants