Closed oejwing closed 1 month ago
(potentially we also just have different definitions of how x,y
map to row,col
!)
Hi @oejwing
well spotted ;-). I agree that the naming of the variables in getextent is confusing, and x
and should be renamed to row
and y
should be col
. I will change this because otherwise, this really makes reading the code difficult. In the end, it doesn't produce an error.
In the end, it is the order to which we are used to and which is confusing: lat lon, x y, row col...
Cheers, Wolfgang
In
getmask
,getextent
is called with the order of the arguments being row/lat/y first and col/lon/x second. https://github.com/wschwanghart/topotoolbox/blob/21c93eb000e2bae559ba5669e92b609d3cef2018/%40GRIDobj/polygon2GRIDobj.m#L240However,
getextent
requires the order to the opposite. https://github.com/wschwanghart/topotoolbox/blob/21c93eb000e2bae559ba5669e92b609d3cef2018/%40GRIDobj/polygon2GRIDobj.m#L272-L275This means
getmask
has swapped X and Y dimensions. Fortunately, theext(1:2)
refers to Y andext(3:4)
refers to X, so the error corrects itself. But I suggest returningext = [min(y) max(y) min(x) max(x)];
ingetextent
and callgetextent(c,r)
ingetmask
.