Skip to content
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

make 1D variable with an unlimited dimensions behave in the same way as 2D variables #124

Merged
merged 4 commits into from
Oct 6, 2023

Conversation

Alexander-Barth
Copy link
Contributor

@Alexander-Barth Alexander-Barth commented Oct 5, 2023

This solves issue #123 for NetCDF.jl and NCDatasets.jl

@Alexander-Barth Alexander-Barth changed the title issue #123 make 1D variable with an unlimited dimensions behave in the same way as 2D variables Oct 5, 2023
@rafaqz
Copy link
Collaborator

rafaqz commented Oct 6, 2023

Ok that makes sense, it was trying to handle linear indices on a vector. Maybe @meggart knows the background here.

Can you write a test so we dont break this again?

@Alexander-Barth
Copy link
Contributor Author

Good idea! Would it be ok to add NetCDF.jl as a test dependency? I am not sure how to create such array using only DiskArrays.

@rafaqz
Copy link
Collaborator

rafaqz commented Oct 6, 2023

There is a _DiskArray object defined in the tests that we use. It counts getindex so you cant test the read pattern (e.g. you want one single read here), see the tests for examples.

@Alexander-Barth Alexander-Barth changed the title make 1D variable with an unlimited dimensions behave in the same way as 2D variables [WIP] make 1D variable with an unlimited dimensions behave in the same way as 2D variables Oct 6, 2023
@Alexander-Barth
Copy link
Contributor Author

Alexander-Barth commented Oct 6, 2023

OK, I just added the test. Without commit 76152b8, I checked that the test reproduces the failure in the function interpret_indices_disk which is fixed by this PR.

@rafaqz
Copy link
Collaborator

rafaqz commented Oct 6, 2023

Looks good! Thanks for adding that.

Would it make sense to explicitly test 2d arrays there too?

@meggart
Copy link
Owner

meggart commented Oct 6, 2023

Thanks a lot. As you @rafaqz mentioned there was a special method for linear indexing into multidimensional arrays and in this case it was taking over linear indexing into 1D arrays as well. Looks good to me.

@Alexander-Barth Alexander-Barth changed the title [WIP] make 1D variable with an unlimited dimensions behave in the same way as 2D variables make 1D variable with an unlimited dimensions behave in the same way as 2D variables Oct 6, 2023
@Alexander-Barth
Copy link
Contributor Author

OK, I just added a 2d array.

@rafaqz rafaqz merged commit a6d0163 into meggart:main Oct 6, 2023
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