Skip to content

Commit

Permalink
Updated test values for FANO change
Browse files Browse the repository at this point in the history
Also fixed failing tests caused by old CIMIS collections being moved from legacy to cloud project.

Fixed the failing LST source is none test.  The image the test was assuming was missing got built.  Instead created an empty collection that can be used to check for missing.
  • Loading branch information
cgmorton committed Oct 25, 2024
1 parent 43fbbcd commit 4d864ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion openet/ssebop/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def aggregate_image(agg_start_date, agg_end_date, date_format):
if 'count' in variables:
count_img = (
aggregate_coll.filterDate(agg_start_date, agg_end_date)
.select(['mask']).count().rename('count').uint8()
.select(['mask']).reduce(ee.Reducer.count()).rename('count').uint8()
)
image_list.append(count_img)

Expand Down
23 changes: 14 additions & 9 deletions openet/ssebop/tests/test_c_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,13 @@ def test_Image_from_landsat_c2_sr_lst_source_values():

def test_Image_from_landsat_c2_sr_lst_source_missing():
"""Test that the LST is masked if the scene is not present in lst_source"""
# This image does not currently exist in the source collection,
# but if this test stops working check to see if this image was added
# LST source collection is empty so that join will work but not join to anything
image_id = 'LANDSAT/LC08/C02/T1_L2/LC08_031034_20160702'
xy = (-102.08284, 37.81728)
lst_source = 'projects/openet/assets/lst/landsat/c02'
lst_source = 'projects/openet/assets/lst/landsat/empty'
output_img = ssebop.Image.from_landsat_c2_sr(image_id, lst_source=lst_source).lst
output = utils.point_image_value(output_img, xy)
assert output['lst'] == None
assert output['lst'] is None
assert output_img.get('lst_source_id').getInfo() == 'None'


Expand Down Expand Up @@ -644,10 +643,16 @@ def test_Image_tcorr_stats_landsat(image_id, tmax_source, expected, tol=0.000001
'tcorr_src, tmax_src, image_id, xy, expected',
[
['FANO', 'projects/usgs-ssebop/tmax/daymet_v4_mean_1981_2010',
'LANDSAT/LC08/C02/T1_L2/LC08_042035_20150713', SCENE_POINT, 0.9803095962281566],
'LANDSAT/LC08/C02/T1_L2/LC08_042035_20150713', SCENE_POINT, 0.9820676302928456],
['FANO',
'projects/earthengine-legacy/assets/projects/usgs-ssebop/tmax/daymet_v4_mean_1981_2010',
'LANDSAT/LC08/C02/T1_L2/LC08_042035_20150713', SCENE_POINT, 0.9803095962281566],
'LANDSAT/LC08/C02/T1_L2/LC08_042035_20150713', SCENE_POINT, 0.9820676302928456],
# # Old test values for pre 0.5.0 implementation with 5 Km FANO cells and 10%
# ['FANO', 'projects/usgs-ssebop/tmax/daymet_v4_mean_1981_2010',
# 'LANDSAT/LC08/C02/T1_L2/LC08_042035_20150713', SCENE_POINT, 0.9803095962281566],
# ['FANO',
# 'projects/earthengine-legacy/assets/projects/usgs-ssebop/tmax/daymet_v4_mean_1981_2010',
# 'LANDSAT/LC08/C02/T1_L2/LC08_042035_20150713', SCENE_POINT, 0.9803095962281566],
]
)
def test_Image_tcorr_fano_source(tcorr_src, tmax_src, image_id, xy, expected, tol=0.000001):
Expand Down Expand Up @@ -794,9 +799,9 @@ def test_Image_et_reference_properties():
['IDAHO_EPSCOR/GRIDMET', 'etr', 0.85, TEST_POINT, 9.5730 * 0.85],
['projects/openet/assets/reference_et/california/cimis/daily/v1',
'etr', 1, TEST_POINT, 10.0760],
['projects/openet/reference_et/california/cimis/daily/v1',
'etr', 1, TEST_POINT, 10.0760],
# DEADBEEF
# DEADBEEF - Legacy collections have been removed and/or moved to cloud project
# ['projects/openet/reference_et/california/cimis/daily/v1',
# 'etr', 1, TEST_POINT, 10.0760],
# ['projects/earthengine-legacy/assets/projects/climate-engine/cimis/daily',
# 'ETr_ASCE', 1, TEST_POINT, 10.0220],
# CGM - Why are these not the same?
Expand Down

0 comments on commit 4d864ee

Please sign in to comment.