meggart / DiskArrays.jl

Other
73 stars 13 forks source link

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

Closed Alexander-Barth closed 11 months ago

Alexander-Barth commented 11 months ago

This solves issue https://github.com/meggart/DiskArrays.jl/issues/123 for NetCDF.jl and NCDatasets.jl

rafaqz commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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

rafaqz commented 11 months ago

Looks good! Thanks for adding that.

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

meggart commented 11 months ago

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 commented 11 months ago

OK, I just added a 2d array.