Skip to content

add abstract types for views and permuted arrays #255

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 8 commits into from
May 31, 2025

Conversation

tiemvanderdeure
Copy link
Contributor

@tiemvanderdeure tiemvanderdeure commented Apr 10, 2025

Per @lupemba 's excellent suggesion in JuliaGeo/NCDatasets.jl#274 (comment), this PR implements an AbstractPermutedDiskArray and AbstractSubDiskArray

@rafaqz
Copy link
Collaborator

rafaqz commented Apr 10, 2025

Maybe ReshapedDiskArray as well for completeness? Not sure if Padded/Rechunked etc also need abstrac types

Copy link

@lupemba lupemba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using it to implement to solve JuliaGeo/CommonDataModel.jl#32 (comment) and here are my comments

src/permute.jl Outdated
Base.parent(a::AbstractPermutedDiskArray) = a.a.parent
permuteddimsarray(a) = a.a
Base.size(a::AbstractPermutedDiskArray) = size(permuteddimsarray(a))
Base.parent(a::AbstractPermutedDiskArray) = parent(permuteddimsarray(a))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should merge my other PR first, it actually changes this so there is no separate array. Maybe thats a problem?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think that's a problem at all! The permuteddimsarray was only necessary to get the perm and iperm anyway.

@rafaqz
Copy link
Collaborator

rafaqz commented May 6, 2025

@tiemvanderdeure I fixed the merge with #249, it definately makes the abstract type less useful

@lupemba I'm not sure if this will affect you, or if you are subtyping AbstractPermutedDiskArray

@lupemba
Copy link

lupemba commented May 6, 2025

@lupemba I'm not sure if this will affect you, or if you are subtyping AbstractPermutedDiskArray

I have left out permuted arrays from my PR since CommonDataModel doesn't have specific methods for that yet. So it is not needed right now.

I still think we should consider adding a support for permuted arrays in CommonDataModel before we make a breaking release.

@lupemba
Copy link

lupemba commented May 28, 2025

@tiemvanderdeure
Do you have time to look at this PR. It would be great to get it finished so I can continue with JuliaGeo/CommonDataModel.jl#35

@tiemvanderdeure
Copy link
Contributor Author

I think it's basically good to go. Let's see if tests pass now.

@@ -41,15 +48,15 @@ function eachchunk(a::PermutedDiskArray)
# Return permuted GridChunks
return GridChunks(genperm(gridchunks.chunks, perm)...)
end
function DiskArrays.readblock!(a::PermutedDiskArray, aout, i::OrdinalRange...)
function DiskArrays.readblock!(a::AbstractPermutedDiskArray, aout, i::OrdinalRange...)
iperm = _getiperm(a)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now an internal method in an Abstract typed function... Should we remove the underscore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove which underscore? You mean in _getiperm and _getperm

@rafaqz rafaqz merged commit 6522ba3 into JuliaIO:main May 31, 2025
12 checks passed
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.

3 participants