pyresample
pyresample copied to clipboard
Add check or force Boundary lons/lats to be 1D
Code Sample, a minimal, complete, and verifiable piece of code
from pyresample.boundary import Boundary
b = Boundary(my_lons, my_lats)
print(b.contour_poly.area())
Problem description
The above code doesn't fail if the provided lons/lats are 2D (not sure on 3D+), but the class and all functions/utilities underneath it assume 1D arrays. The end results are incorrect because of this.
Expected Output
Either an exception or a .ravel() on the provided lons/lats so the rest of the calculations work fine.
Actual Result, Traceback if applicable
Incorrect area and other operations.
@pnuu @mraspaud Any preference on .ravel() or assert or something else?
Flatten?
I believe flatten forces a copy of the array every time. ravel() will only copy if it needs to.
ah true, I had them mixed up. ravel returns a view