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

Write test for calling RasterSeries(x; duplicate_first=true) #474

Closed
maxfreu opened this issue Jul 5, 2023 · 2 comments
Closed

Write test for calling RasterSeries(x; duplicate_first=true) #474

maxfreu opened this issue Jul 5, 2023 · 2 comments

Comments

@maxfreu
Copy link
Contributor

maxfreu commented Jul 5, 2023

We should write a test for calling RasterSeries(x; duplicate_first=true) and check that it a) works and b) correctly sets the properties, especially the filenames. I think this requires some usable sample data uploaded somewhere. I could provide the sample data if needed; where could it be uploaded?

@rafaqz
Copy link
Owner

rafaqz commented Jul 5, 2023

We can also just generate the data in the tests.

@maxfreu
Copy link
Contributor Author

maxfreu commented Jul 6, 2023

# create `N` random rasters with eltype `type` and x,y,band size `size`
function temporary_random_rasters(f, N, size, type=UInt8)
    filenames = [tempname() * ".tif" for _ in 1:N]
    try
        for f in filenames
            write(f, Raster(rand(type, size); dims=(X(1:size[1]), Y(1:size[2]), Band(1:size[3]))))
        end
        f(filenames)
    finally
        rm.(filenames; force=true)
    end
end


temporary_random_rasters(3, (10,10,3), UInt8) do filenames
    times = Ti(DateTime.(rand(UInt16, length(filenames))))
    series = RasterSeries(filenames, times; duplicate_first=true)
    ...
end

@maxfreu maxfreu closed this as completed Sep 22, 2023
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

No branches or pull requests

2 participants