Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions python/grass/pygrass/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ def get_raster_for_points(poi_vector, raster, column=None, region=None):

>>> l = get_raster_for_points(vect, ele, region=region)
>>> l[0] # doctest: +ELLIPSIS
(1, 10.0, 6.0, 1)
(1, 10.0, 6.0, ...1...)
>>> l[1] # doctest: +ELLIPSIS
(2, 12.0, 6.0, 1)
(2, 12.0, 6.0, ...1...)

Add a new column and sample again

Expand Down
6 changes: 5 additions & 1 deletion scripts/i.oif/i.oif.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ def main():
oif = []
for p in perms(bands):
oif.append((oifcalc(stddev, correlation, *p), p))
oif.sort(reverse=True)
# NaN does not compare, so sorting the raw tuples gives an order which
# depends on the sort algorithm. Place NaN last, in input order.
oif.sort(
key=lambda item: (item[0] != item[0], -item[0] if item[0] == item[0] else 0)
)

grass.verbose(
_("The Optimum Index Factor analysis result (best combination shown first):")
Expand Down
4 changes: 2 additions & 2 deletions scripts/i.oif/testsuite/test_i_oif.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ def test_constant_raster_yields_nan(self):
expected_output = (
f"{self.band1}, {self.band2}, {self.band4}: 3.5301\n"
f"{self.band1}, {self.band2}, {self.band3}: 2.6992\n"
f"{self.band1}, {self.band2}, {self.const_band}: nan\n"
f"{self.band2}, {self.band3}, {self.band4}: 2.4723\n"
f"{self.band1}, {self.band3}, {self.band4}: 2.0387\n"
f"{self.band1}, {self.band2}, {self.const_band}: nan\n"
f"{self.band1}, {self.band3}, {self.const_band}: nan\n"
f"{self.band1}, {self.band4}, {self.const_band}: nan\n"
f"{self.band2}, {self.band3}, {self.band4}: 2.4723\n"
f"{self.band2}, {self.band3}, {self.const_band}: nan\n"
f"{self.band2}, {self.band4}, {self.const_band}: nan\n"
f"{self.band3}, {self.band4}, {self.const_band}: nan\n"
Expand Down
Loading