Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions xrspatial/tests/test_perlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,17 @@ def test_perlin_preserves_dims_and_attrs():
assert out.attrs == src.attrs


def test_perlin_drops_input_coords():
# Pins current behavior: perlin() rebuilds the output from dims + attrs but
# not coords, so input coordinate variables are dropped. This is a known
# bug -- see the perlin "drops input coordinates from output" issue. Flip
# this to assert the coords ARE preserved once that is fixed.
def test_perlin_preserves_input_coords():
# perlin() now carries the input coordinate variables through to the output
# (see #3470). The output keeps the same lat/lon coords as the input.
src = xr.DataArray(np.zeros((10, 12), dtype=np.float32), dims=['lat', 'lon'])
src['lat'] = np.arange(10)
src['lon'] = np.arange(12)
out = perlin(src)
assert 'lat' not in out.coords
assert 'lon' not in out.coords
assert 'lat' in out.coords
assert 'lon' in out.coords
np.testing.assert_array_equal(out['lat'].values, src['lat'].values)
np.testing.assert_array_equal(out['lon'].values, src['lon'].values)


def test_perlin_docstring_documents_name():
Expand Down
Loading