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

Better error message if using e.g. min in zonal #742

Open
asinghvi17 opened this issue Sep 19, 2024 · 3 comments
Open

Better error message if using e.g. min in zonal #742

asinghvi17 opened this issue Sep 19, 2024 · 3 comments
Labels

Comments

@asinghvi17
Copy link
Collaborator

Currently it's a bit inscrutable:

julia> rmin = Rasters.zonal(min, src_srtm; of = zion)
ERROR: MethodError: no method matching min(::Base.SkipMissing{Raster{…}})

Closest candidates are:
  min(::Any, ::Missing)
   @ Base missing.jl:134
  min(::Any, ::Any)
   @ Base operators.jl:490
  min(::Any, ::Any, ::Any, ::Any...)
   @ Base operators.jl:587
  ...

Stacktrace:
  [1] _zonal(f::typeof(min), x::Raster{…}, ::GeoInterface.PolygonTrait, geom::GeoInterface.Wrappers.Polygon{…}; kw::@Kwargs{})
    @ Rasters ~/.julia/dev/Rasters/src/methods/zonal.jl:96
  [2] _zonal(f::Function, x::Raster{…}, ::GeoInterface.PolygonTrait, geom::GeoInterface.Wrappers.Polygon{…})
    @ Rasters ~/.julia/dev/Rasters/src/methods/zonal.jl:92

but maybe we can add a hint in a try-catch block? Not sure if that makes sense to do.

@rafaqz
Copy link
Owner

rafaqz commented Sep 23, 2024

Personally that makes total sense to me as an error 😅

Would rather avoid try-catch too

@asinghvi17
Copy link
Collaborator Author

If you don't know what Base.SkipMissing is then it doesn't really make sense I think, but will try and see if there's a nice way to add some info to the error 🤷

@rafaqz rafaqz added the errors label Nov 5, 2024
@felixcremer
Copy link
Contributor

felixcremer commented Nov 8, 2024

This is fixed by the error hint in Julia on min and max JuliaLang/julia#52716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants