Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Oct 29, 2024
1 parent 7e3697e commit 007cca6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_io_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,16 @@ def test_xarray_reader_Y_axis():
img = dst.tile(1, 1, 2)
assert img.array[0, 0, 0] > img.array[0, -1, -1]

pt = dst.point(0, 0)
assert pt.count == 1
assert pt.coordinates
xys = [[0, 2.499], [0, 2.501], [-4.999, 0], [-5.001, 0], [-170, 80]]
for xy in xys:
x = xy[0]
y = xy[1]
pt = dst.point(x, y)
assert pt.data[0] == data.sel(x=x, y=y, method="nearest")

# Create a DataArray where the y coordinates are in decreasing order
# (this is typical for raster data)
# This array will have a negative y resolution in the affine transform
Expand Down Expand Up @@ -607,3 +617,13 @@ def test_xarray_reader_Y_axis():

img = dst.tile(1, 1, 2)
assert img.array[0, 0, 0] < img.array[0, -1, -1]

pt = dst.point(0, 0)
assert pt.count == 1
assert pt.coordinates
xys = [[0, 2.499], [0, 2.501], [-4.999, 0], [-5.001, 0], [-170, 80]]
for xy in xys:
x = xy[0]
y = xy[1]
pt = dst.point(x, y)
assert pt.data[0] == data.sel(x=x, y=y, method="nearest")

0 comments on commit 007cca6

Please sign in to comment.