{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#### seasonal extent change" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "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.\n", " warnings.warn(\n", "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:\n", "\n", "import os\n", "os.environ['USE_PYGEOS'] = '0'\n", "import geopandas\n", "\n", "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).\n", " import geopandas as gpd\n" ] } ], "source": [ "import ee\n", "import geemap\n", "import geopandas as gpd" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "ee.Authenticate()\n", "ee.Initialize()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "aoi = gpd.read_file('C:/Users/jtrum/Wash scan/data/aoiLuanda.geojson')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "During Flood Image Collection: ee.ImageCollection({\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.map\",\n", " \"arguments\": {\n", " \"baseAlgorithm\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.select\",\n", " \"arguments\": {\n", " \"bandSelectors\": {\n", " \"constantValue\": [\n", " \"VV\"\n", " ]\n", " },\n", " \"input\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"ImageCollection.load\",\n", " \"arguments\": {\n", " \"id\": {\n", " \"constantValue\": \"COPERNICUS/S1_GRD\"\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.intersects\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \".all\"\n", " },\n", " \"rightValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Feature\",\n", " \"arguments\": {\n", " \"geometry\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"GeometryConstructors.Point\",\n", " \"arguments\": {\n", " \"coordinates\": {\n", " \"constantValue\": [\n", " 13.2344,\n", " -8.8115\n", " ]\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.listContains\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"transmitterReceiverPolarisation\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"VV\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.equals\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"orbitProperties_pass\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"DESCENDING\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.dateRangeContains\",\n", " \"arguments\": {\n", " \"leftValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"DateRange\",\n", " \"arguments\": {\n", " \"end\": {\n", " \"constantValue\": \"2017-03-29\"\n", " },\n", " \"start\": {\n", " \"constantValue\": \"2017-03-14\"\n", " }\n", " }\n", " }\n", " },\n", " \"rightField\": {\n", " \"constantValue\": \"system:time_start\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", "})\n", "Before Flood Image Collection: ee.ImageCollection({\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.map\",\n", " \"arguments\": {\n", " \"baseAlgorithm\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.select\",\n", " \"arguments\": {\n", " \"bandSelectors\": {\n", " \"constantValue\": [\n", " \"VV\"\n", " ]\n", " },\n", " \"input\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"ImageCollection.load\",\n", " \"arguments\": {\n", " \"id\": {\n", " \"constantValue\": \"COPERNICUS/S1_GRD\"\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.intersects\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \".all\"\n", " },\n", " \"rightValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Feature\",\n", " \"arguments\": {\n", " \"geometry\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"GeometryConstructors.Point\",\n", " \"arguments\": {\n", " \"coordinates\": {\n", " \"constantValue\": [\n", " 13.2344,\n", " -8.8115\n", " ]\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.listContains\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"transmitterReceiverPolarisation\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"VV\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.equals\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"orbitProperties_pass\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"DESCENDING\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.dateRangeContains\",\n", " \"arguments\": {\n", " \"leftValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"DateRange\",\n", " \"arguments\": {\n", " \"end\": {\n", " \"constantValue\": \"2016-09-30\"\n", " },\n", " \"start\": {\n", " \"constantValue\": \"2016-08-01\"\n", " }\n", " }\n", " }\n", " },\n", " \"rightField\": {\n", " \"constantValue\": \"system:time_start\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", "})\n", "Before Flood Image Dates: ee.List({\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.iterate\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.map\",\n", " \"arguments\": {\n", " \"baseAlgorithm\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.select\",\n", " \"arguments\": {\n", " \"bandSelectors\": {\n", " \"constantValue\": [\n", " \"VV\"\n", " ]\n", " },\n", " \"input\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"ImageCollection.load\",\n", " \"arguments\": {\n", " \"id\": {\n", " \"constantValue\": \"COPERNICUS/S1_GRD\"\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.intersects\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \".all\"\n", " },\n", " \"rightValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Feature\",\n", " \"arguments\": {\n", " \"geometry\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"GeometryConstructors.Point\",\n", " \"arguments\": {\n", " \"coordinates\": {\n", " \"constantValue\": [\n", " 13.2344,\n", " -8.8115\n", " ]\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.listContains\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"transmitterReceiverPolarisation\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"VV\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.equals\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"orbitProperties_pass\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"DESCENDING\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.dateRangeContains\",\n", " \"arguments\": {\n", " \"leftValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"DateRange\",\n", " \"arguments\": {\n", " \"end\": {\n", " \"constantValue\": \"2016-09-30\"\n", " },\n", " \"start\": {\n", " \"constantValue\": \"2016-08-01\"\n", " }\n", " }\n", " }\n", " },\n", " \"rightField\": {\n", " \"constantValue\": \"system:time_start\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"first\": {\n", " \"constantValue\": []\n", " },\n", " \"function\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\",\n", " \"_MAPPING_VAR_0_1\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"List.sort\",\n", " \"arguments\": {\n", " \"list\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"List.add\",\n", " \"arguments\": {\n", " \"element\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Number.parse\",\n", " \"arguments\": {\n", " \"input\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Date.format\",\n", " \"arguments\": {\n", " \"date\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.date\",\n", " \"arguments\": {\n", " \"image\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " },\n", " \"format\": {\n", " \"constantValue\": \"YYYYMMdd\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"list\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_1\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", "})\n", "During Flood Image Dates: ee.List({\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.iterate\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.map\",\n", " \"arguments\": {\n", " \"baseAlgorithm\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.select\",\n", " \"arguments\": {\n", " \"bandSelectors\": {\n", " \"constantValue\": [\n", " \"VV\"\n", " ]\n", " },\n", " \"input\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"ImageCollection.load\",\n", " \"arguments\": {\n", " \"id\": {\n", " \"constantValue\": \"COPERNICUS/S1_GRD\"\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.intersects\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \".all\"\n", " },\n", " \"rightValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Feature\",\n", " \"arguments\": {\n", " \"geometry\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"GeometryConstructors.Point\",\n", " \"arguments\": {\n", " \"coordinates\": {\n", " \"constantValue\": [\n", " 13.2344,\n", " -8.8115\n", " ]\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.listContains\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"transmitterReceiverPolarisation\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"VV\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.equals\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"orbitProperties_pass\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"DESCENDING\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.dateRangeContains\",\n", " \"arguments\": {\n", " \"leftValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"DateRange\",\n", " \"arguments\": {\n", " \"end\": {\n", " \"constantValue\": \"2017-03-29\"\n", " },\n", " \"start\": {\n", " \"constantValue\": \"2017-03-14\"\n", " }\n", " }\n", " }\n", " },\n", " \"rightField\": {\n", " \"constantValue\": \"system:time_start\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"first\": {\n", " \"constantValue\": []\n", " },\n", " \"function\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\",\n", " \"_MAPPING_VAR_0_1\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"List.sort\",\n", " \"arguments\": {\n", " \"list\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"List.add\",\n", " \"arguments\": {\n", " \"element\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Number.parse\",\n", " \"arguments\": {\n", " \"input\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Date.format\",\n", " \"arguments\": {\n", " \"date\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.date\",\n", " \"arguments\": {\n", " \"image\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " },\n", " \"format\": {\n", " \"constantValue\": \"YYYYMMdd\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"list\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_1\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", "})\n" ] } ], "source": [ "# Define the extent (AOI) for Luanda\n", "luanda_geometry = ee.Geometry.Point([13.2344, -8.8115]) \n", "luanda_extent = ee.Geometry.Rectangle([12.8, -9.1, 13.6, -8.5]) # Replace with the actual bounding box coordinates\n", "# Set the location, AOI, and ID\n", "pt = luanda_geometry\n", "AOI = luanda_extent\n", "id = \"L1a\"\n", "\n", "# Create Water Mask\n", "water_mask_id = 'JRC/GSW1_0/GlobalSurfaceWater'\n", "WaterMask = ee.Image(water_mask_id)\n", "water_mask = WaterMask.select('transition')\n", "blank = ee.Image(0)\n", "non_water = blank.addBands(water_mask).unmask().select('transition').eq(0).rename('non_water')\n", "\n", "# Create Slope Mask\n", "srtm_id = 'NASA/NASADEM_HGT/001'\n", "srtm = ee.Image(srtm_id)\n", "slope = ee.Terrain.slope(srtm)\n", "grade_15 = slope.gt(15)\n", "gt_grade_15 = grade_15.updateMask(grade_15.neq(0))\n", "slope_mask = gt_grade_15.clip(AOI).unmask(0).subtract(1).multiply(-1)\n", "\n", "# Load Sentinel-1 C-band SAR Ground Range collection (log scaling, VV co-polar)\n", "collection = (ee.ImageCollection('COPERNICUS/S1_GRD')\n", " .filterBounds(pt)\n", " .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))\n", " .filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))\n", " .select('VV'))\n", "\n", "# Filter by date\n", "\n", "# Flood date: 03/13/2017 03/28/2017\n", "during_flood_collection = (collection\n", " .filterDate('2017-03-14', '2017-03-29'))\n", "during_flood = (during_flood_collection\n", " .first()\n", " .clip(AOI)\n", " .updateMask(non_water)\n", " .updateMask(slope_mask))\n", "print('During Flood Image Collection: ', during_flood_collection)\n", "\n", "# Before Flood & in Dry Season: May - Sept\n", "before_flood_collection = (collection\n", " .filterDate('2016-08-01', '2016-09-30'))\n", "before_flood = (before_flood_collection\n", " .median()\n", " .clip(AOI)\n", " .updateMask(non_water)\n", " .updateMask(slope_mask))\n", "print('Before Flood Image Collection: ', before_flood_collection)\n", "\n", "def ymd_list(image_collection):\n", " # Define a function to iterate over the image collection\n", " def iter_func(image, new_list):\n", " date = ee.Number.parse(ee.Date(image.date()).format(\"YYYYMMdd\"))\n", " new_list = ee.List(new_list)\n", " return ee.List(new_list.add(date).sort())\n", "\n", " # Use list comprehension to iterate over the image collection\n", " return ee.List(image_collection.iterate(iter_func, ee.List([])))\n", "\n", "# Print the image dates for Before Flood and During Flood collections\n", "print('Before Flood Image Dates: ', ymd_list(before_flood_collection))\n", "print('During Flood Image Dates: ', ymd_list(during_flood_collection))\n", "\n", "# Set smoothing box (30m is 3x size of S1 pixel)\n", "smoothing_box = 30\n", "\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "# Create difference images (during flood - before flood)\n", "difference_smoothed = (during_flood\n", " .focal_median(radius=smoothing_box, kernelType='square', units='meters')\n", " .subtract(before_flood.focal_median(radius=smoothing_box, kernelType='square', units='meters')))\n", "difference_raw = during_flood.subtract(before_flood)\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "ename": "EEException", "evalue": "Image.clip: Parameter 'input' is required.", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mHttpError\u001b[0m Traceback (most recent call last)", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:394\u001b[0m, in \u001b[0;36m_execute_cloud_call\u001b[1;34m(call, num_retries)\u001b[0m\n\u001b[0;32m 393\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 394\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcall\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnum_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnum_retries\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 395\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m googleapiclient\u001b[38;5;241m.\u001b[39merrors\u001b[38;5;241m.\u001b[39mHttpError \u001b[38;5;28;01mas\u001b[39;00m e:\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\googleapiclient\\_helpers.py:130\u001b[0m, in \u001b[0;36mpositional..positional_decorator..positional_wrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 129\u001b[0m logger\u001b[38;5;241m.\u001b[39mwarning(message)\n\u001b[1;32m--> 130\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mwrapped\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\googleapiclient\\http.py:938\u001b[0m, in \u001b[0;36mHttpRequest.execute\u001b[1;34m(self, http, num_retries)\u001b[0m\n\u001b[0;32m 937\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m resp\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m300\u001b[39m:\n\u001b[1;32m--> 938\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HttpError(resp, content, uri\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39muri)\n\u001b[0;32m 939\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpostproc(resp, content)\n", "\u001b[1;31mHttpError\u001b[0m: ", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[1;31mEEException\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[6], line 4\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# Check if difference_smoothed and AOI are defined and contain data\u001b[39;00m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m difference_smoothed \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m AOI \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m# Check if the image has bands and AOI has coordinates\u001b[39;00m\n\u001b[1;32m----> 4\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43mdifference_smoothed\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbandNames\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msize\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetInfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m AOI\u001b[38;5;241m.\u001b[39mcoordinates()\u001b[38;5;241m.\u001b[39msize()\u001b[38;5;241m.\u001b[39mgetInfo() \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m 5\u001b[0m \u001b[38;5;66;03m# Clip the image\u001b[39;00m\n\u001b[0;32m 6\u001b[0m difference_smoothed_clipped \u001b[38;5;241m=\u001b[39m difference_smoothed\u001b[38;5;241m.\u001b[39mclip(AOI)\n\u001b[0;32m 7\u001b[0m \u001b[38;5;66;03m# Continue with further operations\u001b[39;00m\n\u001b[0;32m 8\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\computedobject.py:107\u001b[0m, in \u001b[0;36mComputedObject.getInfo\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 101\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetInfo\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Optional[Any]:\n\u001b[0;32m 102\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Fetch and return information about this object.\u001b[39;00m\n\u001b[0;32m 103\u001b[0m \n\u001b[0;32m 104\u001b[0m \u001b[38;5;124;03m Returns:\u001b[39;00m\n\u001b[0;32m 105\u001b[0m \u001b[38;5;124;03m The object can evaluate to anything.\u001b[39;00m\n\u001b[0;32m 106\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 107\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdata\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomputeValue\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:1093\u001b[0m, in \u001b[0;36mcomputeValue\u001b[1;34m(obj)\u001b[0m\n\u001b[0;32m 1090\u001b[0m body \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mexpression\u001b[39m\u001b[38;5;124m'\u001b[39m: serializer\u001b[38;5;241m.\u001b[39mencode(obj, for_cloud_api\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)}\n\u001b[0;32m 1091\u001b[0m _maybe_populate_workload_tag(body)\n\u001b[1;32m-> 1093\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_execute_cloud_call\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 1094\u001b[0m \u001b[43m \u001b[49m\u001b[43m_get_cloud_projects\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1095\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1096\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcompute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproject\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_get_projects_path\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mprettyPrint\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[0;32m 1097\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mresult\u001b[39m\u001b[38;5;124m'\u001b[39m]\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:396\u001b[0m, in \u001b[0;36m_execute_cloud_call\u001b[1;34m(call, num_retries)\u001b[0m\n\u001b[0;32m 394\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m call\u001b[38;5;241m.\u001b[39mexecute(num_retries\u001b[38;5;241m=\u001b[39mnum_retries)\n\u001b[0;32m 395\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m googleapiclient\u001b[38;5;241m.\u001b[39merrors\u001b[38;5;241m.\u001b[39mHttpError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m--> 396\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m _translate_cloud_exception(e)\n", "\u001b[1;31mEEException\u001b[0m: Image.clip: Parameter 'input' is required." ] } ], "source": [ "# Check if difference_smoothed and AOI are defined and contain data\n", "if difference_smoothed is not None and AOI is not None:\n", " # Check if the image has bands and AOI has coordinates\n", " if difference_smoothed.bandNames().size().getInfo() > 0 and AOI.coordinates().size().getInfo() > 0:\n", " # Clip the image\n", " difference_smoothed_clipped = difference_smoothed.clip(AOI)\n", " # Continue with further operations\n", " else:\n", " print(\"Either difference_smoothed or AOI is empty. Cannot clip image.\")\n", "else:\n", " print(\"Either difference_smoothed or AOI is not properly defined. Cannot clip image.\")\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "ename": "EEException", "evalue": "Image.clip: Parameter 'input' is required.", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mHttpError\u001b[0m Traceback (most recent call last)", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:394\u001b[0m, in \u001b[0;36m_execute_cloud_call\u001b[1;34m(call, num_retries)\u001b[0m\n\u001b[0;32m 393\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 394\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcall\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnum_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnum_retries\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 395\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m googleapiclient\u001b[38;5;241m.\u001b[39merrors\u001b[38;5;241m.\u001b[39mHttpError \u001b[38;5;28;01mas\u001b[39;00m e:\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\googleapiclient\\_helpers.py:130\u001b[0m, in \u001b[0;36mpositional..positional_decorator..positional_wrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 129\u001b[0m logger\u001b[38;5;241m.\u001b[39mwarning(message)\n\u001b[1;32m--> 130\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mwrapped\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\googleapiclient\\http.py:938\u001b[0m, in \u001b[0;36mHttpRequest.execute\u001b[1;34m(self, http, num_retries)\u001b[0m\n\u001b[0;32m 937\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m resp\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m300\u001b[39m:\n\u001b[1;32m--> 938\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HttpError(resp, content, uri\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39muri)\n\u001b[0;32m 939\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpostproc(resp, content)\n", "\u001b[1;31mHttpError\u001b[0m: ", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[1;31mEEException\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[23], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# Check if difference_smoothed is defined and print its information\u001b[39;00m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m difference_smoothed \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m----> 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdifference_smoothed information:\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[43mdifference_smoothed\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetInfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[0;32m 4\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdifference_smoothed is not properly defined.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\image.py:116\u001b[0m, in \u001b[0;36mImage.getInfo\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 108\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetInfo\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Optional[Any]:\n\u001b[0;32m 109\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Fetch and return information about this image.\u001b[39;00m\n\u001b[0;32m 110\u001b[0m \n\u001b[0;32m 111\u001b[0m \u001b[38;5;124;03m Returns:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 114\u001b[0m \u001b[38;5;124;03m properties - Dictionary containing the image's metadata properties.\u001b[39;00m\n\u001b[0;32m 115\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetInfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\computedobject.py:107\u001b[0m, in \u001b[0;36mComputedObject.getInfo\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 101\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetInfo\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Optional[Any]:\n\u001b[0;32m 102\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Fetch and return information about this object.\u001b[39;00m\n\u001b[0;32m 103\u001b[0m \n\u001b[0;32m 104\u001b[0m \u001b[38;5;124;03m Returns:\u001b[39;00m\n\u001b[0;32m 105\u001b[0m \u001b[38;5;124;03m The object can evaluate to anything.\u001b[39;00m\n\u001b[0;32m 106\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 107\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdata\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomputeValue\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:1093\u001b[0m, in \u001b[0;36mcomputeValue\u001b[1;34m(obj)\u001b[0m\n\u001b[0;32m 1090\u001b[0m body \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mexpression\u001b[39m\u001b[38;5;124m'\u001b[39m: serializer\u001b[38;5;241m.\u001b[39mencode(obj, for_cloud_api\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)}\n\u001b[0;32m 1091\u001b[0m _maybe_populate_workload_tag(body)\n\u001b[1;32m-> 1093\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_execute_cloud_call\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 1094\u001b[0m \u001b[43m \u001b[49m\u001b[43m_get_cloud_projects\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1095\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1096\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcompute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproject\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_get_projects_path\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mprettyPrint\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[0;32m 1097\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mresult\u001b[39m\u001b[38;5;124m'\u001b[39m]\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:396\u001b[0m, in \u001b[0;36m_execute_cloud_call\u001b[1;34m(call, num_retries)\u001b[0m\n\u001b[0;32m 394\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m call\u001b[38;5;241m.\u001b[39mexecute(num_retries\u001b[38;5;241m=\u001b[39mnum_retries)\n\u001b[0;32m 395\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m googleapiclient\u001b[38;5;241m.\u001b[39merrors\u001b[38;5;241m.\u001b[39mHttpError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m--> 396\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m _translate_cloud_exception(e)\n", "\u001b[1;31mEEException\u001b[0m: Image.clip: Parameter 'input' is required." ] } ], "source": [ "# Check if difference_smoothed is defined and print its information\n", "if difference_smoothed is not None:\n", " print(\"difference_smoothed information:\", difference_smoothed.getInfo())\n", "else:\n", " print(\"difference_smoothed is not properly defined.\")\n", "\n", "# Check if AOI (luanda_extent) is defined and print its information\n", "if AOI is not None:\n", " print(\"AOI (luanda_extent) information:\", AOI.getInfo())\n", "else:\n", " print(\"AOI (luanda_extent) is not properly defined.\")\n", "\n", "# Clip the image only if both difference_smoothed and AOI are properly defined\n", "if difference_smoothed is not None and AOI is not None:\n", " difference_smoothed_clipped = difference_smoothed.clip(AOI)\n", " # Continue with further operations\n", "else:\n", " print(\"Either difference_smoothed or AOI is not properly defined. Cannot clip image.\")\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "asset_id = 'NASA/NASADEM_HGT/001' # NASADEM elevation data\n", "\n", "# Check asset existence\n", "asset_info = ee.data.getInfo(asset_id)\n", "if asset_info is not None:\n", " print(f\"Asset '{asset_id}' exists.\")\n", "else:\n", " print(f\"Asset '{asset_id}' does not exist or is not accessible.\")\n", "\n", "# Resample difference raster\n", "band_VV = difference_smoothed.select('VV')\n", "proj = band_VV.projection().getInfo()\n", "crs = proj['crs']\n", "\n", "# Ensure difference_smoothed is defined before attempting to resample\n", "difference_smoothed_resampled = (difference_smoothed\n", " .resample('bilinear')\n", " .reproject({\n", " 'crs': crs,\n", " 'scale': 10.0\n", " })\n", " .clip(AOI))\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "During Flood Image Collection: ee.ImageCollection({\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.map\",\n", " \"arguments\": {\n", " \"baseAlgorithm\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.select\",\n", " \"arguments\": {\n", " \"bandSelectors\": {\n", " \"constantValue\": [\n", " \"VV\"\n", " ]\n", " },\n", " \"input\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"ImageCollection.load\",\n", " \"arguments\": {\n", " \"id\": {\n", " \"constantValue\": \"COPERNICUS/S1_GRD\"\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.intersects\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \".all\"\n", " },\n", " \"rightValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Feature\",\n", " \"arguments\": {\n", " \"geometry\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"GeometryConstructors.Point\",\n", " \"arguments\": {\n", " \"coordinates\": {\n", " \"constantValue\": [\n", " 13.2344,\n", " -8.8115\n", " ]\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.listContains\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"transmitterReceiverPolarisation\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"VV\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.equals\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"orbitProperties_pass\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"DESCENDING\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.dateRangeContains\",\n", " \"arguments\": {\n", " \"leftValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"DateRange\",\n", " \"arguments\": {\n", " \"end\": {\n", " \"constantValue\": \"2017-03-29\"\n", " },\n", " \"start\": {\n", " \"constantValue\": \"2017-03-14\"\n", " }\n", " }\n", " }\n", " },\n", " \"rightField\": {\n", " \"constantValue\": \"system:time_start\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", "})\n", "Before Flood Image Collection: ee.ImageCollection({\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.map\",\n", " \"arguments\": {\n", " \"baseAlgorithm\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.select\",\n", " \"arguments\": {\n", " \"bandSelectors\": {\n", " \"constantValue\": [\n", " \"VV\"\n", " ]\n", " },\n", " \"input\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"ImageCollection.load\",\n", " \"arguments\": {\n", " \"id\": {\n", " \"constantValue\": \"COPERNICUS/S1_GRD\"\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.intersects\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \".all\"\n", " },\n", " \"rightValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Feature\",\n", " \"arguments\": {\n", " \"geometry\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"GeometryConstructors.Point\",\n", " \"arguments\": {\n", " \"coordinates\": {\n", " \"constantValue\": [\n", " 13.2344,\n", " -8.8115\n", " ]\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.listContains\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"transmitterReceiverPolarisation\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"VV\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.equals\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"orbitProperties_pass\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"DESCENDING\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.dateRangeContains\",\n", " \"arguments\": {\n", " \"leftValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"DateRange\",\n", " \"arguments\": {\n", " \"end\": {\n", " \"constantValue\": \"2016-09-30\"\n", " },\n", " \"start\": {\n", " \"constantValue\": \"2016-08-01\"\n", " }\n", " }\n", " }\n", " },\n", " \"rightField\": {\n", " \"constantValue\": \"system:time_start\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", "})\n" ] } ], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Before Flood Image Dates: ee.List({\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.iterate\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.map\",\n", " \"arguments\": {\n", " \"baseAlgorithm\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.select\",\n", " \"arguments\": {\n", " \"bandSelectors\": {\n", " \"constantValue\": [\n", " \"VV\"\n", " ]\n", " },\n", " \"input\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"ImageCollection.load\",\n", " \"arguments\": {\n", " \"id\": {\n", " \"constantValue\": \"COPERNICUS/S1_GRD\"\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.intersects\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \".all\"\n", " },\n", " \"rightValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Feature\",\n", " \"arguments\": {\n", " \"geometry\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"GeometryConstructors.Point\",\n", " \"arguments\": {\n", " \"coordinates\": {\n", " \"constantValue\": [\n", " 13.2344,\n", " -8.8115\n", " ]\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.listContains\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"transmitterReceiverPolarisation\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"VV\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.equals\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"orbitProperties_pass\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"DESCENDING\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.dateRangeContains\",\n", " \"arguments\": {\n", " \"leftValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"DateRange\",\n", " \"arguments\": {\n", " \"end\": {\n", " \"constantValue\": \"2016-09-30\"\n", " },\n", " \"start\": {\n", " \"constantValue\": \"2016-08-01\"\n", " }\n", " }\n", " }\n", " },\n", " \"rightField\": {\n", " \"constantValue\": \"system:time_start\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"first\": {\n", " \"constantValue\": []\n", " },\n", " \"function\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\",\n", " \"_MAPPING_VAR_0_1\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"List.sort\",\n", " \"arguments\": {\n", " \"list\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"List.add\",\n", " \"arguments\": {\n", " \"element\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Number.parse\",\n", " \"arguments\": {\n", " \"input\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Date.format\",\n", " \"arguments\": {\n", " \"date\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.date\",\n", " \"arguments\": {\n", " \"image\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " },\n", " \"format\": {\n", " \"constantValue\": \"YYYYMMdd\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"list\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_1\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", "})\n", "During Flood Image Dates: ee.List({\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.iterate\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.map\",\n", " \"arguments\": {\n", " \"baseAlgorithm\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.select\",\n", " \"arguments\": {\n", " \"bandSelectors\": {\n", " \"constantValue\": [\n", " \"VV\"\n", " ]\n", " },\n", " \"input\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Collection.filter\",\n", " \"arguments\": {\n", " \"collection\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"ImageCollection.load\",\n", " \"arguments\": {\n", " \"id\": {\n", " \"constantValue\": \"COPERNICUS/S1_GRD\"\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.intersects\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \".all\"\n", " },\n", " \"rightValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Feature\",\n", " \"arguments\": {\n", " \"geometry\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"GeometryConstructors.Point\",\n", " \"arguments\": {\n", " \"coordinates\": {\n", " \"constantValue\": [\n", " 13.2344,\n", " -8.8115\n", " ]\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.listContains\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"transmitterReceiverPolarisation\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"VV\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.equals\",\n", " \"arguments\": {\n", " \"leftField\": {\n", " \"constantValue\": \"orbitProperties_pass\"\n", " },\n", " \"rightValue\": {\n", " \"constantValue\": \"DESCENDING\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"filter\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Filter.dateRangeContains\",\n", " \"arguments\": {\n", " \"leftValue\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"DateRange\",\n", " \"arguments\": {\n", " \"end\": {\n", " \"constantValue\": \"2017-03-29\"\n", " },\n", " \"start\": {\n", " \"constantValue\": \"2017-03-14\"\n", " }\n", " }\n", " }\n", " },\n", " \"rightField\": {\n", " \"constantValue\": \"system:time_start\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"first\": {\n", " \"constantValue\": []\n", " },\n", " \"function\": {\n", " \"functionDefinitionValue\": {\n", " \"argumentNames\": [\n", " \"_MAPPING_VAR_0_0\",\n", " \"_MAPPING_VAR_0_1\"\n", " ],\n", " \"body\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"List.sort\",\n", " \"arguments\": {\n", " \"list\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"List.add\",\n", " \"arguments\": {\n", " \"element\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Number.parse\",\n", " \"arguments\": {\n", " \"input\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Date.format\",\n", " \"arguments\": {\n", " \"date\": {\n", " \"functionInvocationValue\": {\n", " \"functionName\": \"Image.date\",\n", " \"arguments\": {\n", " \"image\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_0\"\n", " }\n", " }\n", " }\n", " },\n", " \"format\": {\n", " \"constantValue\": \"YYYYMMdd\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " },\n", " \"list\": {\n", " \"argumentReference\": \"_MAPPING_VAR_0_1\"\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", "})\n" ] } ], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Asset 'NASA/NASADEM_HGT/001' exists.\n" ] } ], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "ename": "EEException", "evalue": "Image.clip: Parameter 'input' is required.", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mHttpError\u001b[0m Traceback (most recent call last)", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:394\u001b[0m, in \u001b[0;36m_execute_cloud_call\u001b[1;34m(call, num_retries)\u001b[0m\n\u001b[0;32m 393\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 394\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcall\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnum_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnum_retries\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 395\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m googleapiclient\u001b[38;5;241m.\u001b[39merrors\u001b[38;5;241m.\u001b[39mHttpError \u001b[38;5;28;01mas\u001b[39;00m e:\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\googleapiclient\\_helpers.py:130\u001b[0m, in \u001b[0;36mpositional..positional_decorator..positional_wrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 129\u001b[0m logger\u001b[38;5;241m.\u001b[39mwarning(message)\n\u001b[1;32m--> 130\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mwrapped\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\googleapiclient\\http.py:938\u001b[0m, in \u001b[0;36mHttpRequest.execute\u001b[1;34m(self, http, num_retries)\u001b[0m\n\u001b[0;32m 937\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m resp\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m300\u001b[39m:\n\u001b[1;32m--> 938\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HttpError(resp, content, uri\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39muri)\n\u001b[0;32m 939\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpostproc(resp, content)\n", "\u001b[1;31mHttpError\u001b[0m: ", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[1;31mEEException\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[16], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# Resample difference raster\u001b[39;00m\n\u001b[0;32m 2\u001b[0m band_VV \u001b[38;5;241m=\u001b[39m difference_smoothed\u001b[38;5;241m.\u001b[39mselect(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mVV\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m----> 3\u001b[0m proj \u001b[38;5;241m=\u001b[39m \u001b[43mband_VV\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprojection\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetInfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 4\u001b[0m crs \u001b[38;5;241m=\u001b[39m proj[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcrs\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[0;32m 6\u001b[0m \u001b[38;5;66;03m# Ensure difference_smoothed is defined before attempting to resample\u001b[39;00m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\computedobject.py:107\u001b[0m, in \u001b[0;36mComputedObject.getInfo\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 101\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetInfo\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Optional[Any]:\n\u001b[0;32m 102\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Fetch and return information about this object.\u001b[39;00m\n\u001b[0;32m 103\u001b[0m \n\u001b[0;32m 104\u001b[0m \u001b[38;5;124;03m Returns:\u001b[39;00m\n\u001b[0;32m 105\u001b[0m \u001b[38;5;124;03m The object can evaluate to anything.\u001b[39;00m\n\u001b[0;32m 106\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 107\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdata\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomputeValue\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:1093\u001b[0m, in \u001b[0;36mcomputeValue\u001b[1;34m(obj)\u001b[0m\n\u001b[0;32m 1090\u001b[0m body \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mexpression\u001b[39m\u001b[38;5;124m'\u001b[39m: serializer\u001b[38;5;241m.\u001b[39mencode(obj, for_cloud_api\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)}\n\u001b[0;32m 1091\u001b[0m _maybe_populate_workload_tag(body)\n\u001b[1;32m-> 1093\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_execute_cloud_call\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 1094\u001b[0m \u001b[43m \u001b[49m\u001b[43m_get_cloud_projects\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1095\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1096\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcompute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproject\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_get_projects_path\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mprettyPrint\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[0;32m 1097\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mresult\u001b[39m\u001b[38;5;124m'\u001b[39m]\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:396\u001b[0m, in \u001b[0;36m_execute_cloud_call\u001b[1;34m(call, num_retries)\u001b[0m\n\u001b[0;32m 394\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m call\u001b[38;5;241m.\u001b[39mexecute(num_retries\u001b[38;5;241m=\u001b[39mnum_retries)\n\u001b[0;32m 395\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m googleapiclient\u001b[38;5;241m.\u001b[39merrors\u001b[38;5;241m.\u001b[39mHttpError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m--> 396\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m _translate_cloud_exception(e)\n", "\u001b[1;31mEEException\u001b[0m: Image.clip: Parameter 'input' is required." ] } ], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "ename": "EEException", "evalue": "A mapped function's arguments cannot be used in client-side operations", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mEEException\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[44], line 13\u001b[0m\n\u001b[0;32m 10\u001b[0m resampled_image_with_mask \u001b[38;5;241m=\u001b[39m resampled_image\u001b[38;5;241m.\u001b[39mupdateMask(AOI)\n\u001b[0;32m 12\u001b[0m \u001b[38;5;66;03m# Display the resampled image to check if it loads successfully\u001b[39;00m\n\u001b[1;32m---> 13\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mresampled_image_with_mask\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetInfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m)\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\image.py:116\u001b[0m, in \u001b[0;36mImage.getInfo\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 108\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetInfo\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Optional[Any]:\n\u001b[0;32m 109\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Fetch and return information about this image.\u001b[39;00m\n\u001b[0;32m 110\u001b[0m \n\u001b[0;32m 111\u001b[0m \u001b[38;5;124;03m Returns:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 114\u001b[0m \u001b[38;5;124;03m properties - Dictionary containing the image's metadata properties.\u001b[39;00m\n\u001b[0;32m 115\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetInfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\computedobject.py:105\u001b[0m, in \u001b[0;36mComputedObject.getInfo\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 99\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetInfo\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Optional[Any]:\n\u001b[0;32m 100\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Fetch and return information about this object.\u001b[39;00m\n\u001b[0;32m 101\u001b[0m \n\u001b[0;32m 102\u001b[0m \u001b[38;5;124;03m Returns:\u001b[39;00m\n\u001b[0;32m 103\u001b[0m \u001b[38;5;124;03m The object can evaluate to anything.\u001b[39;00m\n\u001b[0;32m 104\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 105\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdata\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomputeValue\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\data.py:1018\u001b[0m, in \u001b[0;36mcomputeValue\u001b[1;34m(obj)\u001b[0m\n\u001b[0;32m 1009\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcomputeValue\u001b[39m(obj: computedobject\u001b[38;5;241m.\u001b[39mComputedObject) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Any:\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sends a request to compute a value.\u001b[39;00m\n\u001b[0;32m 1011\u001b[0m \n\u001b[0;32m 1012\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1016\u001b[0m \u001b[38;5;124;03m The result of evaluating that object on the server.\u001b[39;00m\n\u001b[0;32m 1017\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m-> 1018\u001b[0m body \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mexpression\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[43mserializer\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencode\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfor_cloud_api\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m}\n\u001b[0;32m 1019\u001b[0m _maybe_populate_workload_tag(body)\n\u001b[0;32m 1021\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _execute_cloud_call(\n\u001b[0;32m 1022\u001b[0m _get_cloud_projects()\n\u001b[0;32m 1023\u001b[0m \u001b[38;5;241m.\u001b[39mvalue()\n\u001b[0;32m 1024\u001b[0m \u001b[38;5;241m.\u001b[39mcompute(body\u001b[38;5;241m=\u001b[39mbody, project\u001b[38;5;241m=\u001b[39m_get_projects_path(), prettyPrint\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[0;32m 1025\u001b[0m )[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mresult\u001b[39m\u001b[38;5;124m'\u001b[39m]\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\serializer.py:302\u001b[0m, in \u001b[0;36mencode\u001b[1;34m(obj, is_compound, for_cloud_api, unbound_name)\u001b[0m\n\u001b[0;32m 286\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Serialize an object to a JSON-compatible structure for API calls.\u001b[39;00m\n\u001b[0;32m 287\u001b[0m \n\u001b[0;32m 288\u001b[0m \u001b[38;5;124;03mArgs:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 298\u001b[0m \u001b[38;5;124;03m A JSON-compatible structure representing the input.\u001b[39;00m\n\u001b[0;32m 299\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 300\u001b[0m serializer \u001b[38;5;241m=\u001b[39m Serializer(\n\u001b[0;32m 301\u001b[0m is_compound, for_cloud_api\u001b[38;5;241m=\u001b[39mfor_cloud_api, unbound_name\u001b[38;5;241m=\u001b[39munbound_name)\n\u001b[1;32m--> 302\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mserializer\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_encode\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\serializer.py:80\u001b[0m, in \u001b[0;36mSerializer._encode\u001b[1;34m(self, obj)\u001b[0m\n\u001b[0;32m 71\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Encodes a top level object to be executed server-side.\u001b[39;00m\n\u001b[0;32m 72\u001b[0m \n\u001b[0;32m 73\u001b[0m \u001b[38;5;124;03mArgs:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 77\u001b[0m \u001b[38;5;124;03m An encoded object ready for JSON serialization.\u001b[39;00m\n\u001b[0;32m 78\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 79\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_for_cloud_api:\n\u001b[1;32m---> 80\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_encode_for_cloud_api\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 81\u001b[0m value \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_encode_value(obj)\n\u001b[0;32m 82\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_is_compound:\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\serializer.py:98\u001b[0m, in \u001b[0;36mSerializer._encode_for_cloud_api\u001b[1;34m(self, obj)\u001b[0m\n\u001b[0;32m 96\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_encode_for_cloud_api\u001b[39m(\u001b[38;5;28mself\u001b[39m, obj: Any) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Any:\n\u001b[0;32m 97\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Encodes an object as an Expression or quasi-Expression.\"\"\"\u001b[39;00m\n\u001b[1;32m---> 98\u001b[0m value \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_encode_cloud_object\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 99\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_is_compound:\n\u001b[0;32m 100\u001b[0m \u001b[38;5;66;03m# Wrap the scopes and final value into an Expression.\u001b[39;00m\n\u001b[0;32m 101\u001b[0m value \u001b[38;5;241m=\u001b[39m _ExpressionOptimizer(value, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_scope)\u001b[38;5;241m.\u001b[39moptimize()\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\serializer.py:220\u001b[0m, in \u001b[0;36mSerializer._encode_cloud_object\u001b[1;34m(self, obj)\u001b[0m\n\u001b[0;32m 208\u001b[0m result \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m 209\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfunctionInvocationValue\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[0;32m 210\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfunctionName\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mDate\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 216\u001b[0m }\n\u001b[0;32m 217\u001b[0m }\n\u001b[0;32m 218\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(obj, encodable\u001b[38;5;241m.\u001b[39mEncodable):\n\u001b[0;32m 219\u001b[0m \u001b[38;5;66;03m# Some objects know how to encode themselves.\u001b[39;00m\n\u001b[1;32m--> 220\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencode_cloud_value\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_encode_cloud_object\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 221\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(obj, (\u001b[38;5;28mlist\u001b[39m, \u001b[38;5;28mtuple\u001b[39m)):\n\u001b[0;32m 222\u001b[0m \u001b[38;5;66;03m# Lists are encoded recursively.\u001b[39;00m\n\u001b[0;32m 223\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_is_compound:\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\computedobject.py:165\u001b[0m, in \u001b[0;36mComputedObject.encode_cloud_value\u001b[1;34m(self, encoder)\u001b[0m\n\u001b[0;32m 163\u001b[0m value \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39margs[name]\n\u001b[0;32m 164\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m value \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m--> 165\u001b[0m encoded_args[name] \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvalueReference\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[43mencoder\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m}\n\u001b[0;32m 166\u001b[0m invocation[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124marguments\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m encoded_args\n\u001b[0;32m 167\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfunctionInvocationValue\u001b[39m\u001b[38;5;124m'\u001b[39m: invocation}\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\serializer.py:220\u001b[0m, in \u001b[0;36mSerializer._encode_cloud_object\u001b[1;34m(self, obj)\u001b[0m\n\u001b[0;32m 208\u001b[0m result \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m 209\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfunctionInvocationValue\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[0;32m 210\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfunctionName\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mDate\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 216\u001b[0m }\n\u001b[0;32m 217\u001b[0m }\n\u001b[0;32m 218\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(obj, encodable\u001b[38;5;241m.\u001b[39mEncodable):\n\u001b[0;32m 219\u001b[0m \u001b[38;5;66;03m# Some objects know how to encode themselves.\u001b[39;00m\n\u001b[1;32m--> 220\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencode_cloud_value\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_encode_cloud_object\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 221\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(obj, (\u001b[38;5;28mlist\u001b[39m, \u001b[38;5;28mtuple\u001b[39m)):\n\u001b[0;32m 222\u001b[0m \u001b[38;5;66;03m# Lists are encoded recursively.\u001b[39;00m\n\u001b[0;32m 223\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_is_compound:\n", "File \u001b[1;32mc:\\Users\\jtrum\\miniconda3\\envs\\wash\\lib\\site-packages\\ee\\computedobject.py:148\u001b[0m, in \u001b[0;36mComputedObject.encode_cloud_value\u001b[1;34m(self, encoder)\u001b[0m\n\u001b[0;32m 141\u001b[0m ref \u001b[38;5;241m=\u001b[39m encoder\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__self__\u001b[39m\u001b[38;5;241m.\u001b[39munbound_name\n\u001b[0;32m 142\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m ref \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 143\u001b[0m \u001b[38;5;66;03m# We are trying to call getInfo() or make some other server call inside\u001b[39;00m\n\u001b[0;32m 144\u001b[0m \u001b[38;5;66;03m# a function passed to collection.map() or .iterate(), and the call uses\u001b[39;00m\n\u001b[0;32m 145\u001b[0m \u001b[38;5;66;03m# one of the function arguments. The argument will be unbound outside of\u001b[39;00m\n\u001b[0;32m 146\u001b[0m \u001b[38;5;66;03m# the map operation and cannot be evaluated. See the Count Functions\u001b[39;00m\n\u001b[0;32m 147\u001b[0m \u001b[38;5;66;03m# case in customfunction.py for details on the unbound_name mechanism.\u001b[39;00m\n\u001b[1;32m--> 148\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ee_exception\u001b[38;5;241m.\u001b[39mEEException(\n\u001b[0;32m 149\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mA mapped function\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ms arguments cannot be used in \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 150\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mclient-side operations\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m 151\u001b[0m )\n\u001b[0;32m 152\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124margumentReference\u001b[39m\u001b[38;5;124m'\u001b[39m: ref}\n\u001b[0;32m 153\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", "\u001b[1;31mEEException\u001b[0m: A mapped function's arguments cannot be used in client-side operations" ] } ], "source": [ "# Resample difference raster\n", "band_VV = difference_smoothed.select('VV')\n", "projection_info = band_VV.projection()\n", "crs = projection_info.crs()\n", "\n", "# Simplified resampling and reprojection\n", "resampled_image = difference_smoothed.resample('bilinear').reproject(crs=crs)\n", "\n", "# Update mask separately\n", "resampled_image_with_mask = resampled_image.updateMask(AOI)\n", "\n", "# Display the resampled image to check if it loads successfully\n", "print(resampled_image_with_mask.getInfo())\n" ] } ], "metadata": { "kernelspec": { "display_name": "wash", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.18" } }, "nbformat": 4, "nbformat_minor": 2 }