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

Fixed specifying source file type manually in RasterStack #359

Closed
wants to merge 4 commits into from

Conversation

yvikhlya
Copy link
Contributor

This PR is supposed to fix #356

@codecov-commenter
Copy link

codecov-commenter commented Dec 29, 2022

Codecov Report

Merging #359 (845498e) into main (4a09859) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #359      +/-   ##
==========================================
- Coverage   79.20%   79.17%   -0.04%     
==========================================
  Files          38       38              
  Lines        3121     3121              
==========================================
- Hits         2472     2471       -1     
- Misses        649      650       +1     
Impacted Files Coverage Δ
src/convenience.jl 75.00% <100.00%> (ø)
src/create.jl 94.44% <100.00%> (ø)
src/stack.jl 80.13% <100.00%> (ø)
src/write.jl 89.47% <100.00%> (-0.53%) ⬇️
src/sources/gdal.jl 83.56% <0.00%> (-0.80%) ⬇️
src/methods/mask.jl 89.65% <0.00%> (ø)
src/methods/trim.jl 95.65% <0.00%> (ø)
src/methods/warp.jl 89.65% <0.00%> (ø)
src/methods/extract.jl 78.94% <0.00%> (ø)
src/methods/rasterize.jl 91.81% <0.00%> (ø)
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Owner

@rafaqz rafaqz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking all of those down!

The main change is how you are using get on kw - we can just add the source keyword instead directly in the function keyword arguments.

This PR will also need some tests that specify the source type manually.

src/convenience.jl Outdated Show resolved Hide resolved
src/create.jl Outdated Show resolved Hide resolved
src/stack.jl Show resolved Hide resolved
src/stack.jl Outdated Show resolved Hide resolved
src/write.jl Outdated Show resolved Hide resolved
src/write.jl Outdated Show resolved Hide resolved
@yvikhlya yvikhlya requested a review from rafaqz January 3, 2023 19:49
@rafaqz
Copy link
Owner

rafaqz commented Jan 3, 2023

Tests?

@yvikhlya
Copy link
Contributor Author

yvikhlya commented Jan 3, 2023

Tests?

I have no idea how to write tests, but I I'll look into it.

@rafaqz
Copy link
Owner

rafaqz commented Jan 3, 2023

Tests are crucial, more important than the code in the long term. Otherwise I or someone else might break this functionality again by accident.

You can see some other tests in the tes/gdal.jl and test/ncdatasets.jl - that might be a good place to add tests where you rename a file to something custom and then force it to the right file type.

Do your best anyway! If not I can add them.

@yvikhlya
Copy link
Contributor Author

yvikhlya commented Jan 3, 2023

Can you recommend some good tutorial on writing tests in julia? I feel that I need to make myself more familiar with this anyway.

@yvikhlya
Copy link
Contributor Author

Ok, making tests turned out to be not so difficult, but I think that they reveal some more bugs. I copy test/data/*.nc files to *.nc4 files and try to create Raster and RasterStack objects from them. First, Raster() works without source=Rasters.NCDfile keyword, and with this keyword throws

ERROR: MethodError: no method matching _open(::Type{Array}, ::Type{Rasters.NCDfile}, ::ArchGDAL.RasterDataset{Float32, ArchGDAL.Dataset}; key=nothing)

This is inconsistent with RasterStack interface. Second, both Raster and RasterStack created from *.nc files are not equal to Raster and RasterStack created from *.nc4 files, they do not pass isequal test. Is such behavior expected?

@rafaqz
Copy link
Owner

rafaqz commented Jan 18, 2023

but I think that they reveal some more bugs

Thats great. Can you push the tests so I can try to find your problems?

@yvikhlya
Copy link
Contributor Author

Not sure if I am doing the right thing, but here is my attempt.

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.

Problem detecting a source file type
3 participants