Thats expected for two reasons, I’ll expain.
First, Between(a, b) and Between(b, c) should always be disjoint sets if a < b < c, otherwise scripting with Between is janky. That means the range selected is values x >= a and x < b.
Second, by default cells are treated as Intervals for file loading. It’s the standard with GDAL, but point data will be detected if the flag is set for that. Netcdf is a little more complicated so it just always returns Intervals for now, which may have some issues.
Between selects whole intervals when the sampling mode is Intervals.
This means that if the data is intervals the sum of the returned intervals is guaranteed to not be larger than the difference between a and b, which is a nice property to have.
So to select all 12 months you need to use Between(a, b) where:
a <= Date(1951, 1, 16) && b >= Date(1952,1,16)))
You can also see the mode in your array output:
val: DateTime[...
mode: Sampled: Ordered Irregular Intervals
Your index is Irregular (as we can’t yet detect the step size from the netcdf, and its a vector) so the intervals are based on the next value in the index.
But your month index appears to be centered, which is very hard to work with as a month has no fixed time out of context , so there is no way of working with them as intervals. So maybe best to convert them to Points? You can do that with setdims, then they will behave as you expect.
A = setdims(A, rebuild(dims(A, Ti); mode=rebuild(mode(A, Ti); sampling=Points())))
Although I should make setmode(A, Ti, mode), setsampling(A, Ti, sampling) etc methods to simplify this. It’s all immutable so you cant just change the state, it has to be rebuilt.
Edit: I’m writing a simple set syntax to make it easy to do this https://github.com/rafaqz/DimensionalData.jl/pull/157
This might also be detectable from the netcdf if they are actually marked as points in the metadata somewhere, a PR doing that would be great.