Skip to content

Commit

Permalink
Fixed bug in Tcorr image return
Browse files Browse the repository at this point in the history
The other parts of the Tcorr function were returning two objects, the Tcorr value and the Index value.  To mimic this, the Tcorr image section was changed to return two images.
  • Loading branch information
cgmorton committed Dec 19, 2018
1 parent 1299657 commit 19804a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openet/ssebop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .model import Image
from .model import collection

__version__ = "0.0.10"
__version__ = "0.0.11"
3 changes: 2 additions & 1 deletion openet/ssebop/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ def _tcorr(self):
Returns
-------
Raises
------
ValueError
Expand Down Expand Up @@ -479,7 +480,7 @@ def _tcorr(self):
'Invalid tcorr_source: {} / {}\n'.format(
self._tcorr_source, self._tmax_source))

return tcorr_img.rename(['tcorr', 'index'])
return tcorr_img.select([0], ['tcorr']), tcorr_img.select([1], ['index'])

else:
raise ValueError('Unsupported tcorr_source: {}\n'.format(
Expand Down
6 changes: 3 additions & 3 deletions openet/ssebop/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ def test_Image_tcorr_image_source(tcorr_source, tmax_source, scene_id, month,
pnt = ee.Image('LANDSAT/LC08/C01/T1_TOA/{}'.format(SCENE_ID)) \
.geometry().centroid().getInfo()['coordinates']

tcorr_img = s._tcorr
tcorr_img, index_img = s._tcorr

# Tcorr images are constant images and need to be queried at a point
tcorr = utils.point_image_value(ee.Image(tcorr_img.select(['tcorr'])), pnt)
index = utils.point_image_value(ee.Image(tcorr_img.select(['index'])), pnt)
tcorr = utils.point_image_value(ee.Image(tcorr_img), pnt)
index = utils.point_image_value(ee.Image(index_img), pnt)
assert abs(tcorr - expected[0]) <= tol
assert index == expected[1]

Expand Down

0 comments on commit 19804a6

Please sign in to comment.