import ee
import geemap
import geopandas as gpd
c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\geopandas\_compat.py:124: UserWarning: The Shapely GEOS version (3.11.2-CAPI-1.17.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.4-CAPI-1.16.2). Conversions between both will be slow. warnings.warn( C:\Users\jtrum\AppData\Local\Temp\ipykernel_38656\3826985800.py:3: DeprecationWarning: Shapely 2.0 is installed, but because PyGEOS is also installed, GeoPandas still uses PyGEOS by default. However, starting with version 0.14, the default will switch to Shapely. To force to use Shapely 2.0 now, you can either uninstall PyGEOS or set the environment variable USE_PYGEOS=0. You can do this before starting the Python process, or in your code before importing geopandas: import os os.environ['USE_PYGEOS'] = '0' import geopandas In the next release, GeoPandas will switch to using Shapely by default, even if PyGEOS is installed. If you only have PyGEOS installed to get speed-ups, this switch should be smooth. However, if you are using PyGEOS directly (calling PyGEOS functions on geometries from GeoPandas), this will then stop working and you are encouraged to migrate from PyGEOS to Shapely 2.0 (https://shapely.readthedocs.io/en/latest/migration_pygeos.html). import geopandas as gpd
ee.Authenticate()
ee.Initialize()
aoi = gpd.read_file('C:/Users/jtrum/Wash scan/data/aoiLuanda.geojson')
# Define the extent (AOI) for Luanda
luanda_geometry = ee.Geometry.Point([13.2344, -8.8115])
luanda_extent = ee.Geometry.Rectangle([12.8, -9.1, 13.6, -8.5]) # Replace with the actual bounding box coordinates
# Set the location, AOI, and ID
pt = luanda_geometry
AOI = luanda_extent
id = "L1a"
# Create Water Mask
water_mask_id = 'JRC/GSW1_0/GlobalSurfaceWater'
WaterMask = ee.Image(water_mask_id)
water_mask = WaterMask.select('transition')
blank = ee.Image(0)
non_water = blank.addBands(water_mask).unmask().select('transition').eq(0).rename('non_water')
# Create Slope Mask
srtm_id = 'NASA/NASADEM_HGT/001'
srtm = ee.Image(srtm_id)
slope = ee.Terrain.slope(srtm)
grade_15 = slope.gt(15)
gt_grade_15 = grade_15.updateMask(grade_15.neq(0))
slope_mask = gt_grade_15.clip(AOI).unmask(0).subtract(1).multiply(-1)
# Load Sentinel-1 C-band SAR Ground Range collection (log scaling, VV co-polar)
collection = (ee.ImageCollection('COPERNICUS/S1_GRD')
.filterBounds(pt)
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
.filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))
.select('VV'))
# Filter by date
# Flood date: 03/13/2017 03/28/2017
during_flood_collection = (collection
.filterDate('2017-03-14', '2017-03-29'))
during_flood = (during_flood_collection
.first()
.clip(AOI)
.updateMask(non_water)
.updateMask(slope_mask))
print('During Flood Image Collection: ', during_flood_collection)
# Before Flood & in Dry Season: May - Sept
before_flood_collection = (collection
.filterDate('2016-08-01', '2016-09-30'))
before_flood = (before_flood_collection
.median()
.clip(AOI)
.updateMask(non_water)
.updateMask(slope_mask))
print('Before Flood Image Collection: ', before_flood_collection)
def ymd_list(image_collection):
# Define a function to iterate over the image collection
def iter_func(image, new_list):
date = ee.Number.parse(ee.Date(image.date()).format("YYYYMMdd"))
new_list = ee.List(new_list)
return ee.List(new_list.add(date).sort())
# Use list comprehension to iterate over the image collection
return ee.List(image_collection.iterate(iter_func, ee.List([])))
# Print the image dates for Before Flood and During Flood collections
print('Before Flood Image Dates: ', ymd_list(before_flood_collection))
print('During Flood Image Dates: ', ymd_list(during_flood_collection))
# Set smoothing box (30m is 3x size of S1 pixel)
smoothing_box = 30
During Flood Image Collection: ee.ImageCollection({ "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.map", "arguments": { "baseAlgorithm": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0" ], "body": { "functionInvocationValue": { "functionName": "Image.select", "arguments": { "bandSelectors": { "constantValue": [ "VV" ] }, "input": { "argumentReference": "_MAPPING_VAR_0_0" } } } } } }, "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "ImageCollection.load", "arguments": { "id": { "constantValue": "COPERNICUS/S1_GRD" } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.intersects", "arguments": { "leftField": { "constantValue": ".all" }, "rightValue": { "functionInvocationValue": { "functionName": "Feature", "arguments": { "geometry": { "functionInvocationValue": { "functionName": "GeometryConstructors.Point", "arguments": { "coordinates": { "constantValue": [ 13.2344, -8.8115 ] } } } } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.listContains", "arguments": { "leftField": { "constantValue": "transmitterReceiverPolarisation" }, "rightValue": { "constantValue": "VV" } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.equals", "arguments": { "leftField": { "constantValue": "orbitProperties_pass" }, "rightValue": { "constantValue": "DESCENDING" } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.dateRangeContains", "arguments": { "leftValue": { "functionInvocationValue": { "functionName": "DateRange", "arguments": { "end": { "constantValue": "2017-03-29" }, "start": { "constantValue": "2017-03-14" } } } }, "rightField": { "constantValue": "system:time_start" } } } } } } }) Before Flood Image Collection: ee.ImageCollection({ "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.map", "arguments": { "baseAlgorithm": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0" ], "body": { "functionInvocationValue": { "functionName": "Image.select", "arguments": { "bandSelectors": { "constantValue": [ "VV" ] }, "input": { "argumentReference": "_MAPPING_VAR_0_0" } } } } } }, "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "ImageCollection.load", "arguments": { "id": { "constantValue": "COPERNICUS/S1_GRD" } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.intersects", "arguments": { "leftField": { "constantValue": ".all" }, "rightValue": { "functionInvocationValue": { "functionName": "Feature", "arguments": { "geometry": { "functionInvocationValue": { "functionName": "GeometryConstructors.Point", "arguments": { "coordinates": { "constantValue": [ 13.2344, -8.8115 ] } } } } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.listContains", "arguments": { "leftField": { "constantValue": "transmitterReceiverPolarisation" }, "rightValue": { "constantValue": "VV" } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.equals", "arguments": { "leftField": { "constantValue": "orbitProperties_pass" }, "rightValue": { "constantValue": "DESCENDING" } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.dateRangeContains", "arguments": { "leftValue": { "functionInvocationValue": { "functionName": "DateRange", "arguments": { "end": { "constantValue": "2016-09-30" }, "start": { "constantValue": "2016-08-01" } } } }, "rightField": { "constantValue": "system:time_start" } } } } } } }) Before Flood Image Dates: ee.List({ "functionInvocationValue": { "functionName": "Collection.iterate", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.map", "arguments": { "baseAlgorithm": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0" ], "body": { "functionInvocationValue": { "functionName": "Image.select", "arguments": { "bandSelectors": { "constantValue": [ "VV" ] }, "input": { "argumentReference": "_MAPPING_VAR_0_0" } } } } } }, "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "ImageCollection.load", "arguments": { "id": { "constantValue": "COPERNICUS/S1_GRD" } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.intersects", "arguments": { "leftField": { "constantValue": ".all" }, "rightValue": { "functionInvocationValue": { "functionName": "Feature", "arguments": { "geometry": { "functionInvocationValue": { "functionName": "GeometryConstructors.Point", "arguments": { "coordinates": { "constantValue": [ 13.2344, -8.8115 ] } } } } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.listContains", "arguments": { "leftField": { "constantValue": "transmitterReceiverPolarisation" }, "rightValue": { "constantValue": "VV" } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.equals", "arguments": { "leftField": { "constantValue": "orbitProperties_pass" }, "rightValue": { "constantValue": "DESCENDING" } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.dateRangeContains", "arguments": { "leftValue": { "functionInvocationValue": { "functionName": "DateRange", "arguments": { "end": { "constantValue": "2016-09-30" }, "start": { "constantValue": "2016-08-01" } } } }, "rightField": { "constantValue": "system:time_start" } } } } } } }, "first": { "constantValue": [] }, "function": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0", "_MAPPING_VAR_0_1" ], "body": { "functionInvocationValue": { "functionName": "List.sort", "arguments": { "list": { "functionInvocationValue": { "functionName": "List.add", "arguments": { "element": { "functionInvocationValue": { "functionName": "Number.parse", "arguments": { "input": { "functionInvocationValue": { "functionName": "Date.format", "arguments": { "date": { "functionInvocationValue": { "functionName": "Image.date", "arguments": { "image": { "argumentReference": "_MAPPING_VAR_0_0" } } } }, "format": { "constantValue": "YYYYMMdd" } } } } } } }, "list": { "argumentReference": "_MAPPING_VAR_0_1" } } } } } } } } } } } }) During Flood Image Dates: ee.List({ "functionInvocationValue": { "functionName": "Collection.iterate", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.map", "arguments": { "baseAlgorithm": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0" ], "body": { "functionInvocationValue": { "functionName": "Image.select", "arguments": { "bandSelectors": { "constantValue": [ "VV" ] }, "input": { "argumentReference": "_MAPPING_VAR_0_0" } } } } } }, "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "ImageCollection.load", "arguments": { "id": { "constantValue": "COPERNICUS/S1_GRD" } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.intersects", "arguments": { "leftField": { "constantValue": ".all" }, "rightValue": { "functionInvocationValue": { "functionName": "Feature", "arguments": { "geometry": { "functionInvocationValue": { "functionName": "GeometryConstructors.Point", "arguments": { "coordinates": { "constantValue": [ 13.2344, -8.8115 ] } } } } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.listContains", "arguments": { "leftField": { "constantValue": "transmitterReceiverPolarisation" }, "rightValue": { "constantValue": "VV" } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.equals", "arguments": { "leftField": { "constantValue": "orbitProperties_pass" }, "rightValue": { "constantValue": "DESCENDING" } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.dateRangeContains", "arguments": { "leftValue": { "functionInvocationValue": { "functionName": "DateRange", "arguments": { "end": { "constantValue": "2017-03-29" }, "start": { "constantValue": "2017-03-14" } } } }, "rightField": { "constantValue": "system:time_start" } } } } } } }, "first": { "constantValue": [] }, "function": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0", "_MAPPING_VAR_0_1" ], "body": { "functionInvocationValue": { "functionName": "List.sort", "arguments": { "list": { "functionInvocationValue": { "functionName": "List.add", "arguments": { "element": { "functionInvocationValue": { "functionName": "Number.parse", "arguments": { "input": { "functionInvocationValue": { "functionName": "Date.format", "arguments": { "date": { "functionInvocationValue": { "functionName": "Image.date", "arguments": { "image": { "argumentReference": "_MAPPING_VAR_0_0" } } } }, "format": { "constantValue": "YYYYMMdd" } } } } } } }, "list": { "argumentReference": "_MAPPING_VAR_0_1" } } } } } } } } } } } })
# Create difference images (during flood - before flood)
difference_smoothed = (during_flood
.focal_median(radius=smoothing_box, kernelType='square', units='meters')
.subtract(before_flood.focal_median(radius=smoothing_box, kernelType='square', units='meters')))
difference_raw = during_flood.subtract(before_flood)
# Check if difference_smoothed and AOI are defined and contain data
if difference_smoothed is not None and AOI is not None:
# Check if the image has bands and AOI has coordinates
if difference_smoothed.bandNames().size().getInfo() > 0 and AOI.coordinates().size().getInfo() > 0:
# Clip the image
difference_smoothed_clipped = difference_smoothed.clip(AOI)
# Continue with further operations
else:
print("Either difference_smoothed or AOI is empty. Cannot clip image.")
else:
print("Either difference_smoothed or AOI is not properly defined. Cannot clip image.")
--------------------------------------------------------------------------- HttpError Traceback (most recent call last) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:394, in _execute_cloud_call(call, num_retries) 393 try: --> 394 return call.execute(num_retries=num_retries) 395 except googleapiclient.errors.HttpError as e: File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\googleapiclient\_helpers.py:130, in positional.<locals>.positional_decorator.<locals>.positional_wrapper(*args, **kwargs) 129 logger.warning(message) --> 130 return wrapped(*args, **kwargs) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\googleapiclient\http.py:938, in HttpRequest.execute(self, http, num_retries) 937 if resp.status >= 300: --> 938 raise HttpError(resp, content, uri=self.uri) 939 return self.postproc(resp, content) HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1/projects/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Image.clip: Parameter 'input' is required.". Details: "Image.clip: Parameter 'input' is required."> During handling of the above exception, another exception occurred: EEException Traceback (most recent call last) Cell In[6], line 4 1 # Check if difference_smoothed and AOI are defined and contain data 2 if difference_smoothed is not None and AOI is not None: 3 # Check if the image has bands and AOI has coordinates ----> 4 if difference_smoothed.bandNames().size().getInfo() > 0 and AOI.coordinates().size().getInfo() > 0: 5 # Clip the image 6 difference_smoothed_clipped = difference_smoothed.clip(AOI) 7 # Continue with further operations 8 else: File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\computedobject.py:107, in ComputedObject.getInfo(self) 101 def getInfo(self) -> Optional[Any]: 102 """Fetch and return information about this object. 103 104 Returns: 105 The object can evaluate to anything. 106 """ --> 107 return data.computeValue(self) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:1093, in computeValue(obj) 1090 body = {'expression': serializer.encode(obj, for_cloud_api=True)} 1091 _maybe_populate_workload_tag(body) -> 1093 return _execute_cloud_call( 1094 _get_cloud_projects() 1095 .value() 1096 .compute(body=body, project=_get_projects_path(), prettyPrint=False) 1097 )['result'] File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:396, in _execute_cloud_call(call, num_retries) 394 return call.execute(num_retries=num_retries) 395 except googleapiclient.errors.HttpError as e: --> 396 raise _translate_cloud_exception(e) EEException: Image.clip: Parameter 'input' is required.
# Check if difference_smoothed is defined and print its information
if difference_smoothed is not None:
print("difference_smoothed information:", difference_smoothed.getInfo())
else:
print("difference_smoothed is not properly defined.")
# Check if AOI (luanda_extent) is defined and print its information
if AOI is not None:
print("AOI (luanda_extent) information:", AOI.getInfo())
else:
print("AOI (luanda_extent) is not properly defined.")
# Clip the image only if both difference_smoothed and AOI are properly defined
if difference_smoothed is not None and AOI is not None:
difference_smoothed_clipped = difference_smoothed.clip(AOI)
# Continue with further operations
else:
print("Either difference_smoothed or AOI is not properly defined. Cannot clip image.")
--------------------------------------------------------------------------- HttpError Traceback (most recent call last) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:394, in _execute_cloud_call(call, num_retries) 393 try: --> 394 return call.execute(num_retries=num_retries) 395 except googleapiclient.errors.HttpError as e: File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\googleapiclient\_helpers.py:130, in positional.<locals>.positional_decorator.<locals>.positional_wrapper(*args, **kwargs) 129 logger.warning(message) --> 130 return wrapped(*args, **kwargs) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\googleapiclient\http.py:938, in HttpRequest.execute(self, http, num_retries) 937 if resp.status >= 300: --> 938 raise HttpError(resp, content, uri=self.uri) 939 return self.postproc(resp, content) HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1/projects/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Image.clip: Parameter 'input' is required.". Details: "Image.clip: Parameter 'input' is required."> During handling of the above exception, another exception occurred: EEException Traceback (most recent call last) Cell In[23], line 3 1 # Check if difference_smoothed is defined and print its information 2 if difference_smoothed is not None: ----> 3 print("difference_smoothed information:", difference_smoothed.getInfo()) 4 else: 5 print("difference_smoothed is not properly defined.") File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\image.py:116, in Image.getInfo(self) 108 def getInfo(self) -> Optional[Any]: 109 """Fetch and return information about this image. 110 111 Returns: (...) 114 properties - Dictionary containing the image's metadata properties. 115 """ --> 116 return super().getInfo() File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\computedobject.py:107, in ComputedObject.getInfo(self) 101 def getInfo(self) -> Optional[Any]: 102 """Fetch and return information about this object. 103 104 Returns: 105 The object can evaluate to anything. 106 """ --> 107 return data.computeValue(self) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:1093, in computeValue(obj) 1090 body = {'expression': serializer.encode(obj, for_cloud_api=True)} 1091 _maybe_populate_workload_tag(body) -> 1093 return _execute_cloud_call( 1094 _get_cloud_projects() 1095 .value() 1096 .compute(body=body, project=_get_projects_path(), prettyPrint=False) 1097 )['result'] File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:396, in _execute_cloud_call(call, num_retries) 394 return call.execute(num_retries=num_retries) 395 except googleapiclient.errors.HttpError as e: --> 396 raise _translate_cloud_exception(e) EEException: Image.clip: Parameter 'input' is required.
asset_id = 'NASA/NASADEM_HGT/001' # NASADEM elevation data
# Check asset existence
asset_info = ee.data.getInfo(asset_id)
if asset_info is not None:
print(f"Asset '{asset_id}' exists.")
else:
print(f"Asset '{asset_id}' does not exist or is not accessible.")
# Resample difference raster
band_VV = difference_smoothed.select('VV')
proj = band_VV.projection().getInfo()
crs = proj['crs']
# Ensure difference_smoothed is defined before attempting to resample
difference_smoothed_resampled = (difference_smoothed
.resample('bilinear')
.reproject({
'crs': crs,
'scale': 10.0
})
.clip(AOI))
During Flood Image Collection: ee.ImageCollection({ "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.map", "arguments": { "baseAlgorithm": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0" ], "body": { "functionInvocationValue": { "functionName": "Image.select", "arguments": { "bandSelectors": { "constantValue": [ "VV" ] }, "input": { "argumentReference": "_MAPPING_VAR_0_0" } } } } } }, "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "ImageCollection.load", "arguments": { "id": { "constantValue": "COPERNICUS/S1_GRD" } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.intersects", "arguments": { "leftField": { "constantValue": ".all" }, "rightValue": { "functionInvocationValue": { "functionName": "Feature", "arguments": { "geometry": { "functionInvocationValue": { "functionName": "GeometryConstructors.Point", "arguments": { "coordinates": { "constantValue": [ 13.2344, -8.8115 ] } } } } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.listContains", "arguments": { "leftField": { "constantValue": "transmitterReceiverPolarisation" }, "rightValue": { "constantValue": "VV" } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.equals", "arguments": { "leftField": { "constantValue": "orbitProperties_pass" }, "rightValue": { "constantValue": "DESCENDING" } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.dateRangeContains", "arguments": { "leftValue": { "functionInvocationValue": { "functionName": "DateRange", "arguments": { "end": { "constantValue": "2017-03-29" }, "start": { "constantValue": "2017-03-14" } } } }, "rightField": { "constantValue": "system:time_start" } } } } } } }) Before Flood Image Collection: ee.ImageCollection({ "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.map", "arguments": { "baseAlgorithm": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0" ], "body": { "functionInvocationValue": { "functionName": "Image.select", "arguments": { "bandSelectors": { "constantValue": [ "VV" ] }, "input": { "argumentReference": "_MAPPING_VAR_0_0" } } } } } }, "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "ImageCollection.load", "arguments": { "id": { "constantValue": "COPERNICUS/S1_GRD" } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.intersects", "arguments": { "leftField": { "constantValue": ".all" }, "rightValue": { "functionInvocationValue": { "functionName": "Feature", "arguments": { "geometry": { "functionInvocationValue": { "functionName": "GeometryConstructors.Point", "arguments": { "coordinates": { "constantValue": [ 13.2344, -8.8115 ] } } } } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.listContains", "arguments": { "leftField": { "constantValue": "transmitterReceiverPolarisation" }, "rightValue": { "constantValue": "VV" } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.equals", "arguments": { "leftField": { "constantValue": "orbitProperties_pass" }, "rightValue": { "constantValue": "DESCENDING" } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.dateRangeContains", "arguments": { "leftValue": { "functionInvocationValue": { "functionName": "DateRange", "arguments": { "end": { "constantValue": "2016-09-30" }, "start": { "constantValue": "2016-08-01" } } } }, "rightField": { "constantValue": "system:time_start" } } } } } } })
Before Flood Image Dates: ee.List({ "functionInvocationValue": { "functionName": "Collection.iterate", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.map", "arguments": { "baseAlgorithm": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0" ], "body": { "functionInvocationValue": { "functionName": "Image.select", "arguments": { "bandSelectors": { "constantValue": [ "VV" ] }, "input": { "argumentReference": "_MAPPING_VAR_0_0" } } } } } }, "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "ImageCollection.load", "arguments": { "id": { "constantValue": "COPERNICUS/S1_GRD" } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.intersects", "arguments": { "leftField": { "constantValue": ".all" }, "rightValue": { "functionInvocationValue": { "functionName": "Feature", "arguments": { "geometry": { "functionInvocationValue": { "functionName": "GeometryConstructors.Point", "arguments": { "coordinates": { "constantValue": [ 13.2344, -8.8115 ] } } } } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.listContains", "arguments": { "leftField": { "constantValue": "transmitterReceiverPolarisation" }, "rightValue": { "constantValue": "VV" } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.equals", "arguments": { "leftField": { "constantValue": "orbitProperties_pass" }, "rightValue": { "constantValue": "DESCENDING" } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.dateRangeContains", "arguments": { "leftValue": { "functionInvocationValue": { "functionName": "DateRange", "arguments": { "end": { "constantValue": "2016-09-30" }, "start": { "constantValue": "2016-08-01" } } } }, "rightField": { "constantValue": "system:time_start" } } } } } } }, "first": { "constantValue": [] }, "function": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0", "_MAPPING_VAR_0_1" ], "body": { "functionInvocationValue": { "functionName": "List.sort", "arguments": { "list": { "functionInvocationValue": { "functionName": "List.add", "arguments": { "element": { "functionInvocationValue": { "functionName": "Number.parse", "arguments": { "input": { "functionInvocationValue": { "functionName": "Date.format", "arguments": { "date": { "functionInvocationValue": { "functionName": "Image.date", "arguments": { "image": { "argumentReference": "_MAPPING_VAR_0_0" } } } }, "format": { "constantValue": "YYYYMMdd" } } } } } } }, "list": { "argumentReference": "_MAPPING_VAR_0_1" } } } } } } } } } } } }) During Flood Image Dates: ee.List({ "functionInvocationValue": { "functionName": "Collection.iterate", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.map", "arguments": { "baseAlgorithm": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0" ], "body": { "functionInvocationValue": { "functionName": "Image.select", "arguments": { "bandSelectors": { "constantValue": [ "VV" ] }, "input": { "argumentReference": "_MAPPING_VAR_0_0" } } } } } }, "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "Collection.filter", "arguments": { "collection": { "functionInvocationValue": { "functionName": "ImageCollection.load", "arguments": { "id": { "constantValue": "COPERNICUS/S1_GRD" } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.intersects", "arguments": { "leftField": { "constantValue": ".all" }, "rightValue": { "functionInvocationValue": { "functionName": "Feature", "arguments": { "geometry": { "functionInvocationValue": { "functionName": "GeometryConstructors.Point", "arguments": { "coordinates": { "constantValue": [ 13.2344, -8.8115 ] } } } } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.listContains", "arguments": { "leftField": { "constantValue": "transmitterReceiverPolarisation" }, "rightValue": { "constantValue": "VV" } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.equals", "arguments": { "leftField": { "constantValue": "orbitProperties_pass" }, "rightValue": { "constantValue": "DESCENDING" } } } } } } } } } }, "filter": { "functionInvocationValue": { "functionName": "Filter.dateRangeContains", "arguments": { "leftValue": { "functionInvocationValue": { "functionName": "DateRange", "arguments": { "end": { "constantValue": "2017-03-29" }, "start": { "constantValue": "2017-03-14" } } } }, "rightField": { "constantValue": "system:time_start" } } } } } } }, "first": { "constantValue": [] }, "function": { "functionDefinitionValue": { "argumentNames": [ "_MAPPING_VAR_0_0", "_MAPPING_VAR_0_1" ], "body": { "functionInvocationValue": { "functionName": "List.sort", "arguments": { "list": { "functionInvocationValue": { "functionName": "List.add", "arguments": { "element": { "functionInvocationValue": { "functionName": "Number.parse", "arguments": { "input": { "functionInvocationValue": { "functionName": "Date.format", "arguments": { "date": { "functionInvocationValue": { "functionName": "Image.date", "arguments": { "image": { "argumentReference": "_MAPPING_VAR_0_0" } } } }, "format": { "constantValue": "YYYYMMdd" } } } } } } }, "list": { "argumentReference": "_MAPPING_VAR_0_1" } } } } } } } } } } } })
Asset 'NASA/NASADEM_HGT/001' exists.
--------------------------------------------------------------------------- HttpError Traceback (most recent call last) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:394, in _execute_cloud_call(call, num_retries) 393 try: --> 394 return call.execute(num_retries=num_retries) 395 except googleapiclient.errors.HttpError as e: File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\googleapiclient\_helpers.py:130, in positional.<locals>.positional_decorator.<locals>.positional_wrapper(*args, **kwargs) 129 logger.warning(message) --> 130 return wrapped(*args, **kwargs) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\googleapiclient\http.py:938, in HttpRequest.execute(self, http, num_retries) 937 if resp.status >= 300: --> 938 raise HttpError(resp, content, uri=self.uri) 939 return self.postproc(resp, content) HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1/projects/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Image.clip: Parameter 'input' is required.". Details: "Image.clip: Parameter 'input' is required."> During handling of the above exception, another exception occurred: EEException Traceback (most recent call last) Cell In[16], line 3 1 # Resample difference raster 2 band_VV = difference_smoothed.select('VV') ----> 3 proj = band_VV.projection().getInfo() 4 crs = proj['crs'] 6 # Ensure difference_smoothed is defined before attempting to resample File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\computedobject.py:107, in ComputedObject.getInfo(self) 101 def getInfo(self) -> Optional[Any]: 102 """Fetch and return information about this object. 103 104 Returns: 105 The object can evaluate to anything. 106 """ --> 107 return data.computeValue(self) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:1093, in computeValue(obj) 1090 body = {'expression': serializer.encode(obj, for_cloud_api=True)} 1091 _maybe_populate_workload_tag(body) -> 1093 return _execute_cloud_call( 1094 _get_cloud_projects() 1095 .value() 1096 .compute(body=body, project=_get_projects_path(), prettyPrint=False) 1097 )['result'] File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:396, in _execute_cloud_call(call, num_retries) 394 return call.execute(num_retries=num_retries) 395 except googleapiclient.errors.HttpError as e: --> 396 raise _translate_cloud_exception(e) EEException: Image.clip: Parameter 'input' is required.
# Resample difference raster
band_VV = difference_smoothed.select('VV')
projection_info = band_VV.projection()
crs = projection_info.crs()
# Simplified resampling and reprojection
resampled_image = difference_smoothed.resample('bilinear').reproject(crs=crs)
# Update mask separately
resampled_image_with_mask = resampled_image.updateMask(AOI)
# Display the resampled image to check if it loads successfully
print(resampled_image_with_mask.getInfo())
--------------------------------------------------------------------------- EEException Traceback (most recent call last) Cell In[44], line 13 10 resampled_image_with_mask = resampled_image.updateMask(AOI) 12 # Display the resampled image to check if it loads successfully ---> 13 print(resampled_image_with_mask.getInfo()) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\image.py:116, in Image.getInfo(self) 108 def getInfo(self) -> Optional[Any]: 109 """Fetch and return information about this image. 110 111 Returns: (...) 114 properties - Dictionary containing the image's metadata properties. 115 """ --> 116 return super().getInfo() File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\computedobject.py:105, in ComputedObject.getInfo(self) 99 def getInfo(self) -> Optional[Any]: 100 """Fetch and return information about this object. 101 102 Returns: 103 The object can evaluate to anything. 104 """ --> 105 return data.computeValue(self) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\data.py:1018, in computeValue(obj) 1009 def computeValue(obj: computedobject.ComputedObject) -> Any: 1010 """Sends a request to compute a value. 1011 1012 Args: (...) 1016 The result of evaluating that object on the server. 1017 """ -> 1018 body = {'expression': serializer.encode(obj, for_cloud_api=True)} 1019 _maybe_populate_workload_tag(body) 1021 return _execute_cloud_call( 1022 _get_cloud_projects() 1023 .value() 1024 .compute(body=body, project=_get_projects_path(), prettyPrint=False) 1025 )['result'] File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\serializer.py:302, in encode(obj, is_compound, for_cloud_api, unbound_name) 286 """Serialize an object to a JSON-compatible structure for API calls. 287 288 Args: (...) 298 A JSON-compatible structure representing the input. 299 """ 300 serializer = Serializer( 301 is_compound, for_cloud_api=for_cloud_api, unbound_name=unbound_name) --> 302 return serializer._encode(obj) File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\serializer.py:80, in Serializer._encode(self, obj) 71 """Encodes a top level object to be executed server-side. 72 73 Args: (...) 77 An encoded object ready for JSON serialization. 78 """ 79 if self._for_cloud_api: ---> 80 return self._encode_for_cloud_api(obj) 81 value = self._encode_value(obj) 82 if self._is_compound: File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\serializer.py:98, in Serializer._encode_for_cloud_api(self, obj) 96 def _encode_for_cloud_api(self, obj: Any) -> Any: 97 """Encodes an object as an Expression or quasi-Expression.""" ---> 98 value = self._encode_cloud_object(obj) 99 if self._is_compound: 100 # Wrap the scopes and final value into an Expression. 101 value = _ExpressionOptimizer(value, self._scope).optimize() File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\serializer.py:220, in Serializer._encode_cloud_object(self, obj) 208 result = { 209 'functionInvocationValue': { 210 'functionName': 'Date', (...) 216 } 217 } 218 elif isinstance(obj, encodable.Encodable): 219 # Some objects know how to encode themselves. --> 220 result = obj.encode_cloud_value(self._encode_cloud_object) 221 elif isinstance(obj, (list, tuple)): 222 # Lists are encoded recursively. 223 if self._is_compound: File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\computedobject.py:165, in ComputedObject.encode_cloud_value(self, encoder) 163 value = self.args[name] 164 if value is not None: --> 165 encoded_args[name] = {'valueReference': encoder(value)} 166 invocation['arguments'] = encoded_args 167 return {'functionInvocationValue': invocation} File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\serializer.py:220, in Serializer._encode_cloud_object(self, obj) 208 result = { 209 'functionInvocationValue': { 210 'functionName': 'Date', (...) 216 } 217 } 218 elif isinstance(obj, encodable.Encodable): 219 # Some objects know how to encode themselves. --> 220 result = obj.encode_cloud_value(self._encode_cloud_object) 221 elif isinstance(obj, (list, tuple)): 222 # Lists are encoded recursively. 223 if self._is_compound: File c:\Users\jtrum\miniconda3\envs\wash\lib\site-packages\ee\computedobject.py:148, in ComputedObject.encode_cloud_value(self, encoder) 141 ref = encoder.__self__.unbound_name 142 if ref is None: 143 # We are trying to call getInfo() or make some other server call inside 144 # a function passed to collection.map() or .iterate(), and the call uses 145 # one of the function arguments. The argument will be unbound outside of 146 # the map operation and cannot be evaluated. See the Count Functions 147 # case in customfunction.py for details on the unbound_name mechanism. --> 148 raise ee_exception.EEException( 149 "A mapped function's arguments cannot be used in " 150 'client-side operations' 151 ) 152 return {'argumentReference': ref} 153 else: EEException: A mapped function's arguments cannot be used in client-side operations