From 6ace154653588b280ec34674f84a5b3636008189 Mon Sep 17 00:00:00 2001 From: gparrish Date: Thu, 23 May 2024 14:26:07 -0500 Subject: [PATCH 1/5] coarse_transform in tcorr_FANO() lazy property changed from 5000 meter resolution to 1000 meter resolution --- openet/ssebop/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openet/ssebop/image.py b/openet/ssebop/image.py index f80ac43..7789a8d 100644 --- a/openet/ssebop/image.py +++ b/openet/ssebop/image.py @@ -814,7 +814,7 @@ 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 ndwi_threshold = -0.15 From 6705d0f906e8f67d438ea26c7a10a1903b0e81fb Mon Sep 17 00:00:00 2001 From: gparrish Date: Thu, 23 May 2024 14:27:05 -0500 Subject: [PATCH 2/5] water_pct = 10 in tcorr_FANO() insinde image.py changed to water_pct = 50 --- openet/ssebop/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openet/ssebop/image.py b/openet/ssebop/image.py index 7789a8d..b18e67b 100644 --- a/openet/ssebop/image.py +++ b/openet/ssebop/image.py @@ -819,7 +819,7 @@ def tcorr_FANO(self): dt_coeff = 0.125 ndwi_threshold = -0.15 high_ndvi_threshold = 0.9 - water_pct = 10 + water_pct = 50 # max pixels argument for .reduceResolution() m_pixels = 65535 From e9807f104b5e6666e7d55e9d8bd5db25d8844ef9 Mon Sep 17 00:00:00 2001 From: gparrish Date: Thu, 23 May 2024 14:28:57 -0500 Subject: [PATCH 3/5] big version bump to 0.5.0 changing c factor and water % tolerance --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2f9678f..90a6357 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openet-ssebop" -version = "0.4.4" +version = "0.5.0" authors = [ { name = "Gabe Parrish", email = "gparrish@contractor.usgs.gov" }, { name = "Mac Friedrichs", email = "mfriedrichs@contractor.usgs.gov" }, From 43fbbcd0a907898ecac9d2d9ee452a2e088eec5c Mon Sep 17 00:00:00 2001 From: Charles Morton Date: Fri, 25 Oct 2024 10:11:13 -0700 Subject: [PATCH 4/5] Removed old test file --- test.py | 60 --------------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 test.py diff --git a/test.py b/test.py deleted file mode 100644 index a0cd151..0000000 --- a/test.py +++ /dev/null @@ -1,60 +0,0 @@ -"""This script provides a quick way to test issues that are going wrong in a ipynb in the examples folder -without having to throw 'pip install . --no-deps' every time you want to print something or troubleshoot.""" -import openet.ssebop as model -# Import the Earth Engine package -import ee - - -try: - ee.Initialize() - print('worked') -except ee.EEException: - print('trying a second time') - ee.Authenticate() - ee.Initialize() - -ndvi_palette = ['#EFE7E1', '#003300'] -et_palette = [ - 'DEC29B', 'E6CDA1', 'EDD9A6', 'F5E4A9', 'FFF4AD', 'C3E683', '6BCC5C', - '3BB369', '20998F', '1C8691', '16678A', '114982', '0B2C7A'] -viridis_palette = ['440154', '433982', '30678D', '218F8B', '36B677', '8ED542', 'FDE725'] - -image_size = 768 - -# Salinas -# landsat_img = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_043035_20160722') -# Wilcox -# landsat_img = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_035037_20160714') -# Viginia -# landsat_img = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_016033_20160725') -# x = 'LC08_035037_20160714' -x = 'LC08_043035_20160722' -landsat_img = ee.Image(f'LANDSAT/LC08/C02/T1_L2/{x}') -landsat_crs = landsat_img.select('SR_B3').projection().getInfo()['crs'] -landsat_region = landsat_img.geometry().bounds(1, 'EPSG:4326') -landsat_dt = ee.Date(landsat_img.get('system:time_start')) - -# # Build the SSEBop object from the Landsat image -# model_obj = model.Image.from_landsat_c2_sr( -# landsat_img, -# tcorr_source='SCENE_GRIDDED', -# et_reference_source='IDAHO_EPSCOR/GRIDMET', -# et_reference_band='etr', -# et_reference_factor=0.85, -# et_reference_resample='nearest', -# tmax_source='projects/usgs-ssebop/tmax/daymet_v4_mean_1981_2010_elr' -# ) - -## ============== NON-Lapse Rate Adjusted ================= -# Build the SSEBop object from the Landsat image -model_obj = model.Image.from_landsat_c2_sr( - landsat_img, - tcorr_source='SCENE_GRIDDED', - et_reference_source='IDAHO_EPSCOR/GRIDMET', - et_reference_band='etr', - et_reference_factor=0.85, - et_reference_resample='nearest', - tmax_source='projects/usgs-ssebop/tmax/daymet_v4_mean_1981_2010' -) - -et_property = model_obj.et_fraction \ No newline at end of file From 4d864eef217cec84b23781eaee4ccd28b48c5962 Mon Sep 17 00:00:00 2001 From: Charles Morton Date: Fri, 25 Oct 2024 10:33:27 -0700 Subject: [PATCH 5/5] Updated test values for FANO change 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. --- openet/ssebop/collection.py | 2 +- openet/ssebop/tests/test_c_image.py | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/openet/ssebop/collection.py b/openet/ssebop/collection.py index 99cec79..d4c6965 100644 --- a/openet/ssebop/collection.py +++ b/openet/ssebop/collection.py @@ -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) diff --git a/openet/ssebop/tests/test_c_image.py b/openet/ssebop/tests/test_c_image.py index 18ac91a..1dc4faf 100644 --- a/openet/ssebop/tests/test_c_image.py +++ b/openet/ssebop/tests/test_c_image.py @@ -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' @@ -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): @@ -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?