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

Where errors on Projected #864

Open
tiemvanderdeure opened this issue Jan 21, 2025 · 3 comments
Open

Where errors on Projected #864

tiemvanderdeure opened this issue Jan 21, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@tiemvanderdeure
Copy link
Collaborator

tiemvanderdeure commented Jan 21, 2025

MWE:

using Rasters
A = rand(X(Projected(1:10; crs = nothing)))
A[X(Where(<(4)))]

Stacktrace:

ERROR: ArgumentError: Failed to assign fields (:val,) to object with fields (:f,).
Stacktrace:
  [1] macro expansion
    @ ~/.julia/packages/ConstructionBase/lUKuV/src/ConstructionBase.jl:140 [inlined]
  [2] check_patch_fields_exist(obj::Where{Base.Fix2{typeof(<), Int64}}, patch::@NamedTuple{val::Base.Fix2{typeof(<), Int64}})
    @ ConstructionBase ~/.julia/packages/ConstructionBase/lUKuV/src/ConstructionBase.jl:140
  [3] setproperties_object(obj::Where{Base.Fix2{typeof(<), Int64}}, patch::@NamedTuple{val::Base.Fix2{typeof(<), Int64}})
    @ ConstructionBase ~/.julia/packages/ConstructionBase/lUKuV/src/ConstructionBase.jl:207
  [4] setproperties(obj::Where{Base.Fix2{typeof(<), Int64}}, patch::@NamedTuple{val::Base.Fix2{typeof(<), Int64}})
    @ ConstructionBase ~/.julia/packages/ConstructionBase/lUKuV/src/ConstructionBase.jl:136
  [5] rebuild(x::Where{Base.Fix2{typeof(<), Int64}}; kw::@Kwargs{val::Base.Fix2{typeof(<), Int64}})
    @ DimensionalData.Dimensions.Lookups ~/.julia/packages/DimensionalData/oXUIT/src/Lookups/Lookups.jl:65
  [6] #selectindices#3
    @ ~/.julia/dev/Rasters/src/lookup.jl:94 [inlined]
  [7] selectindices
    @ ~/.julia/dev/Rasters/src/lookup.jl:92 [inlined]
  [8] _dims2indices
    @ ~/.julia/packages/DimensionalData/oXUIT/src/Dimensions/indexing.jl:117 [inlined]
  [9] _dims2indices
    @ ~/.julia/packages/DimensionalData/oXUIT/src/Dimensions/indexing.jl:109 [inlined]
 [10] macro expansion
    @ ~/.julia/packages/DimensionalData/oXUIT/src/Dimensions/indexing.jl:55 [inlined]
 [11] _dims2indices(lookups::Tuple{Projected{…}}, dims::Tuple{X{…}}, I::Tuple{X{…}})
    @ DimensionalData.Dimensions ~/.julia/packages/DimensionalData/oXUIT/src/Dimensions/indexing.jl:55
 [12] dims2indices
    @ ~/.julia/packages/DimensionalData/oXUIT/src/Dimensions/indexing.jl:50 [inlined]
 [13] dims2indices
    @ ~/.julia/packages/DimensionalData/oXUIT/src/Dimensions/indexing.jl:32 [inlined]
 [14] _dim_getindex
    @ ~/.julia/packages/DimensionalData/oXUIT/src/array/indexing.jl:110 [inlined]
 [15] getindex(A::Raster{…}, i::X{…})
    @ DimensionalData ~/.julia/packages/DimensionalData/oXUIT/src/array/indexing.jl:91
 [16] top-level scope
    @ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.

This bug got introduced in #821, but I'm not quite sure what the proper fix is

@tiemvanderdeure tiemvanderdeure added the bug Something isn't working label Jan 21, 2025
@tiemvanderdeure
Copy link
Collaborator Author

tiemvanderdeure commented Jan 21, 2025

Something like this is also broken A[X = At([1,2])]

Due to this ugly bug

_selectvec(l, rebuild(sel; val=selval)sel; kw...)

Should rebuild(val=selval)sel just be sel?

@rafaqz
Copy link
Owner

rafaqz commented Jan 21, 2025

I think its fixed on breaking?

@tiemvanderdeure
Copy link
Collaborator Author

Just checked and the one with At([1,2]) is, but the original one with Where throws the same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants