You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
Unless there's something I don't see, our current overload for getindex(layer1, layer2) (used when calling layer1[layer2]) can only return exactly the same layer as layer1, which makes it a bit useless.
Calling _layers_are_compatible(layer1, layer2) means the overload only works when the two layers have the same size AND bounding coordinates. But then we return layer1 with the bounding coordinates of layer2, which are necessarily the same as layer[1].
I think this overload would be more useful if it allowed to subset a layer based on another layer if both have the same stride and the 2nd one is entirely contained in the first one, as in the example below.
l1, l2 =SimpleSDMPredictor(WorldClim, BioClim, 1:2)
l3 =SimpleSDMPredictor(WorldClim, BioClim, 1; left =-145.0, right =-50.0, bottom =20.0, top =75.0)
stride(l1) ==stride(l3) # same stride
l4 = l1[l2] # works
l4 == l1 # but it's exactly the same
l5 = l1[l3] # doesn't work as layers have different sizes, but should work
l5 == l3 # should return true
The text was updated successfully, but these errors were encountered:
gabrieldansereau
changed the title
layer1[layer2] can only return exactly the same layerlayer1[layer2] can only return exactly the same layer
Jun 4, 2021
Unless there's something I don't see, our current overload for
getindex(layer1, layer2
) (used when callinglayer1[layer2]
) can only return exactly the same layer aslayer1
, which makes it a bit useless.Calling
_layers_are_compatible(layer1, layer2)
means the overload only works when the two layers have the same size AND bounding coordinates. But then we returnlayer1
with the bounding coordinates oflayer2
, which are necessarily the same aslayer[1]
.I think this overload would be more useful if it allowed to subset a layer based on another layer if both have the same stride and the 2nd one is entirely contained in the first one, as in the example below.
The text was updated successfully, but these errors were encountered: