Skip to content

Commit 7213540

Browse files
committed
removed certain redundant self. properties and let tc_layered call most of them. Redundant renaming is reduced.
1 parent 6165177 commit 7213540

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

openet/ssebop/image.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def mixed_landscape_tcold_smooth(self):
629629
@lazy_property
630630
def tc_ag(self):
631631
"""Mosaic the 'veg mosaic' and the 'smooth 5km mosaic'"""
632-
return self.vegetated_tcorr.unmask(self.smooth_mixed_landscape_tcold_ag)
632+
return self.vegetated_tcorr.unmask(self.mixed_landscape_tcold_smooth)
633633

634634
@lazy_property
635635
def gsw_max_mask(self):
@@ -640,7 +640,7 @@ def gsw_max_mask(self):
640640
def tc_layered(self):
641641
"""TODO: Write description for this function"""
642642
return (
643-
self.mixed_landscape_tcold_ag_plus_veg
643+
self.tc_ag
644644
.updateMask(self.ag_landcover_mask)
645645
.unmask(self.hot_dry_tcorr)
646646
.updateMask(1)
@@ -892,7 +892,7 @@ def tcold_FANO(self):
892892
high_ndvi_threshold = 0.9
893893

894894
# max pixels argument for .reduceResolution()
895-
m_pixels_fine = 48 # This is the new one for 120 # OLD 240 48 # This would be too aggressive for 240 -> (8**2)/2 # 8**2
895+
m_pixels_fine = 48 # We use 48 because for 240m-> (8**2) 64 pixels is not necessary and EECU is saved.
896896
m_pixels_coarse = (20**2)/2 # Doing every pixel would be (20**2) but half is probably fine.
897897

898898
lst = ee.Image(self.lst)
@@ -915,10 +915,7 @@ def tcold_FANO(self):
915915
# Mask LST in the same way
916916
lst_masked = lst.updateMask(not_water_mask)
917917

918-
# ================= LANDCOVER LAZY Property creates ag_lc ==================
919918

920-
# Agricultural lands and grasslands and wetlands are 1, all others are 0
921-
ag_lc = self.ag_landcover_mask
922919

923920
# -------- Fine NDVI and LST (watermasked always)-------------
924921
# Fine resolution Tcorr for areas that are natively high NDVI and hot-dry landcovers (not ag)
@@ -937,18 +934,22 @@ def tcold_FANO(self):
937934

938935
# ***** subsection creating NDVI at coarse resolution from only high NDVI pixels. *************
939936

937+
# ================= LANDCOVER LAZY Property creates ag_lc ==================
938+
939+
# Agricultural lands and grasslands and wetlands are 1, all others are 0
940+
940941
# Create the masked ndvi for NDVI > 0.4
941942
coarse_masked_ndvi = (
942943
ndvi_fine_wmasked
943-
.updateMask(ndvi_masked.gte(0.4).And(ag_lc))
944+
.updateMask(ndvi_masked.gte(0.4).And(self.ag_landcover_mask))
944945
.reduceResolution(ee.Reducer.mean(), True, m_pixels_coarse)
945946
.reproject(self.crs, self.coarse_transform)
946947
)
947948

948949
# Same process for LST
949950
lst_coarse_wmasked_high_ndvi = (
950951
lst_fine_wmasked
951-
.updateMask(ndvi_masked.gte(0.4).And(ag_lc))
952+
.updateMask(ndvi_masked.gte(0.4).And(self.ag_landcover_mask))
952953
.reduceResolution(ee.Reducer.mean(), True, m_pixels_coarse)
953954
.reproject(self.crs, self.coarse_transform)
954955
)
@@ -986,25 +987,23 @@ def tcold_FANO(self):
986987
.get('lst')
987988
)
988989

989-
# take the scalar and place it into a well-functioning ee.Image()
990+
# take the scalar and place it into a well-functioning ee.Image(). This gives a scene-wide Tcold fallback.
990991
self.Tc_scene = ndvi.multiply(ee.Number(0)).add(ee.Number(Tc_supercoarse_high_ndvi_scalar))
991992

992993
# /////////////////////////// LANDCOVER MASKS /////////////////////////////////
993994
# Vegetated and High NDVI areas.
994-
vegetated_mask = ndvi_fine_wmasked.gte(0.4).And(ag_lc)
995+
vegetated_mask = ndvi_fine_wmasked.gte(0.4).And(self.ag_landcover_mask)
995996

996-
# For 120m Ag areas with enough NDVI to run FANO
997+
# For 120m Ag areas with enough NDVI, we run FANO at high res.
997998
self.vegetated_tcorr = Tc_fine.updateMask(vegetated_mask)
998999

9991000
# For all non-ag areas we run hot dry tcorr at 120m
1001+
# this renaming doesn't DO anything, but is explanatory:
1002+
# For hot dry envs, we use FANO at high resolution as-is.
10001003
self.hot_dry_tcorr = Tc_fine
10011004

10021005
## ---------- Smoothing the FANO for Ag together starting with mixed landscape -------
10031006

1004-
self.smooth_mixed_landscape_tcold_ag = self.mixed_landscape_tcold_smooth
1005-
1006-
self.mixed_landscape_tcold_ag_plus_veg = self.tc_ag
1007-
10081007
# 1 pixel of smoothing to the main Tc where we make use of landcovers
10091008
self.smooth_Tc_Layered = (
10101009
self.tc_layered

0 commit comments

Comments
 (0)