Skip to content

Commit

Permalink
remove min_max
Browse files Browse the repository at this point in the history
  • Loading branch information
ericgitonga authored Oct 12, 2023
1 parent 128d3b2 commit ee3a230
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ecoscope/analysis/seasons.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,28 @@ def _min_max_scaler(x):

def std_ndvi_vals(
aoi=None,
image_coll=None,
img_coll=None,
band=None,
scale=1,
img_scale=1,
start=None,
end=None
):

coll = ee.ImageCollection(image_coll).select(band).filterDate(start, end)#.map(lambda x: x.multiply(ee.Image(scale)))
coll = ee.ImageCollection(img_coll).select(band).filterDate(start, end).map(lambda x: x.multiply(
ee.Image(img_scale)).set("system:time_start", x.get("system:time_start")))

if aoi:
geo = ee.Feature(shapely.geometry.mapping(aoi)).geometry()
else:
geo = None

ndvi_vals = (
coll.toBands()
.reduceRegion("mean", ee.Feature(shapely.geometry.mapping(aoi)).geometry(), bestEffort=True)
.reduceRegion("mean", geo, bestEffort=True)
.values()
.getInfo()
)
ndvi_vals_std = _min_max_scaler(ndvi_vals)

return pd.DataFrame(
{
"img_date": pd.to_datetime(coll.aggregate_array("system:time_start").getInfo(), unit="ms", utc=True),
Expand Down

0 comments on commit ee3a230

Please sign in to comment.