Skip to content

Commit

Permalink
Merge branch 'main' into water-mask
Browse files Browse the repository at this point in the history
  • Loading branch information
cgmorton committed Oct 25, 2024
2 parents 9a9c363 + 5eddcfa commit 3c73ddc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 82 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
4 changes: 2 additions & 2 deletions openet/ssebop/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,11 +837,11 @@ def tcorr_FANO(self):
ee.Image of Tcorr values
"""
coarse_transform = [5000, 0, 15, 0, -5000, 15]
coarse_transform = [1000, 0, 15, 0, -1000, 15]
coarse_transform100 = [100000, 0, 15, 0, -100000, 15]
dt_coeff = 0.125
high_ndvi_threshold = 0.9
water_pct = 10
water_pct = 50
# max pixels argument for .reduceResolution()
m_pixels = 65535

Expand Down
40 changes: 22 additions & 18 deletions openet/ssebop/tests/test_c_image.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime
import pprint
# import pprint

import ee
import pytest
Expand Down Expand Up @@ -607,18 +607,16 @@ def test_Image_from_landsat_c2_sr_lst_source_values():
assert output_img.get('lst_source_id').getInfo().startswith(lst_source)


# # TODO: Find a new missing LST source image
# 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
# image_id = 'LANDSAT/LC08/C02/T1_L2/LC08_031034_20160702'
# xy = (-102.08284, 37.81728)
# lst_source = 'projects/openet/assets/lst/landsat/c02'
# 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_img.get('lst_source_id').getInfo() == 'None'
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"""
# 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/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'] is None
assert output_img.get('lst_source_id').getInfo() == 'None'


# # DEADBEEF - Keep for now in case approach changes for handling missing scenes in LST source
Expand Down Expand Up @@ -746,10 +744,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 @@ -896,9 +900,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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openet-ssebop"
version = "0.4.5"
version = "0.5.0"
authors = [
{ name = "Gabe Parrish", email = "[email protected]" },
{ name = "Mac Friedrichs", email = "[email protected]" },
Expand Down
60 changes: 0 additions & 60 deletions test.py

This file was deleted.

0 comments on commit 3c73ddc

Please sign in to comment.