-
Notifications
You must be signed in to change notification settings - Fork 38
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
Rasters does not support constructing RasterSeries when rasters contain singleton time dimension #894
Comments
A MWE of the behaviour one wants is: m = Raster(rand(X(1:4), Y(1:4), Ti(1:100))
dataset = RasterSeries([m[Ti(i:i)] for i in axes(m, Ti)], Ti)
combine(dataset, Ti) == m which does not currently happen. |
this is something that |
You can drop the extra dim that gets formed and then rebuild the entire thing with the new dims you want...except the dropping doesn't work with diskarrays: m = Raster(rand(X(1:4), Y(1:4), Ti(1:100)))
dataset = RasterSeries([m[Ti(i:i)] for i in axes(m, Ti)], :time)
cm2 = combine(dataset, :time)
all_tis = only.(dims.(dataset.data.data, (Ti,)))
rebuild(
dropdims(
combine(dataset, Rasters.DD.Dim{:time});
dims = Ti
);
dims = (
dims(cm2)[1:2]..., Ti(Rasters.DD.Sampled(all_tis))
) |> Rasters.DD.format
) However, this does work (but adds an extra dim): rebuild(
cm2;
dims = (
dims(cm2)[1:2]..., Dim{:useless}([1]), Ti(Rasters.DD.Sampled(all_tis))
) |> Rasters.DD.format
)
|
The simple way to test this with DiskArrays is: dataset = RasterSeries([m[Ti(i:i)] |> Rasters.DiskArrays.cache for i in axes(m, Ti)], :time) (note that we're wrapping the dimarray in a cacheddiskarray here) This gives you a rasterseries full of diskarrays ┌ 100-element RasterSeries{Raster,1} ┐ |
@asinghvi17 Don't you want a view? That disk array will be materialised. But yeah, RasterSeries should just do that automatically if you pass an empty Ti() dim |
Yeah but that's just construction...here we're starting out with a vector of 3d arrays that are lazy |
Or even better, if RasterSeries isn't handed a dimension... and the files have a singleton dimension then they are automatically concatenated along that dimension |
Good idea we could totally detect singletons |
There are a lot of cases where raster data is provided with a singleton time dimension, e.g.:
I would be nice if RasterSeries could accept a list of files, using the granule
Ti
dimension as the RasterSeries dimension.See discussion here: https://julialang.slack.com/archives/C9XBLUCVB/p1739382396826909
The text was updated successfully, but these errors were encountered: