"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/anaconda3/envs/zeel_py310/lib/python3.10/site-packages/eerepr/repr.py:57: UserWarning: Getting info failed with: 'Collection query aborted after accumulating over 5000 elements.'. Falling back to string repr.\n",
" warn(f\"Getting info failed with: '{e}'. Falling back to string repr.\")\n"
]
},
{
"data": {
"text/html": [
"<ee.imagecollection.ImageCollection object at 0x7f4811b9e050>
"
],
"text/plain": [
""
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"collection = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED').filterBounds(ee.Geometry(gdf.iloc[0].geometry.__geo_interface__)).filterDate('2020-01-01', '2020-01-10')\n",
"collection"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# get first image from collection\n",
"image = collection.first()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"image.clamp(0, 1)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"- type:Image
- id:COPERNICUS/S2_SR_HARMONIZED/20200103T054229_20200103T054832_T43QCG
- version:1729693238711098
- AOT_RETRIEVAL_ACCURACY:0
- CLOUDY_PIXEL_PERCENTAGE:31.922709
- CLOUD_COVERAGE_ASSESSMENT:31.922709
- CLOUD_SHADOW_PERCENTAGE:0.198579
- DARK_FEATURES_PERCENTAGE:0.549102
- DATASTRIP_ID:S2B_OPER_MSI_L2A_DS_EPAE_20200103T090132_S20200103T054832_N02.13
- DATATAKE_IDENTIFIER:GS2B_20200103T054229_014760_N02.13
- DATATAKE_TYPE:INS-NOBS
- DEGRADED_MSI_DATA_PERCENTAGE:0
- FORMAT_CORRECTNESS:PASSED
- GENERAL_QUALITY:PASSED
- GENERATION_TIME:1578042092000
- GEOMETRIC_QUALITY:PASSED
- GRANULE_ID:L2A_T43QCG_A014760_20200103T054832
- HIGH_PROBA_CLOUDS_PERCENTAGE:7.175779
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B1:228.866693947
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B10:231.181075346
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B11:229.390344022
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B12:228.693796089
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B2:234.499920967
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B3:232.023517476
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B4:230.59537529
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B5:229.956341503
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B6:229.518495929
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B7:229.037434243
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8:233.108324536
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A:228.7554452
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B9:228.681896618
- MEAN_INCIDENCE_ZENITH_ANGLE_B1:3.84876005888
- MEAN_INCIDENCE_ZENITH_ANGLE_B10:3.45177233793
- MEAN_INCIDENCE_ZENITH_ANGLE_B11:3.60137297281
- MEAN_INCIDENCE_ZENITH_ANGLE_B12:3.78570081137
- MEAN_INCIDENCE_ZENITH_ANGLE_B2:3.2782764992
- MEAN_INCIDENCE_ZENITH_ANGLE_B3:3.37551363359
- MEAN_INCIDENCE_ZENITH_ANGLE_B4:3.48451409456
- MEAN_INCIDENCE_ZENITH_ANGLE_B5:3.54599791747
- MEAN_INCIDENCE_ZENITH_ANGLE_B6:3.61605291573
- MEAN_INCIDENCE_ZENITH_ANGLE_B7:3.6859370775
- MEAN_INCIDENCE_ZENITH_ANGLE_B8:3.32377205921
- MEAN_INCIDENCE_ZENITH_ANGLE_B8A:3.76323633487
- MEAN_INCIDENCE_ZENITH_ANGLE_B9:3.93447100737
- MEAN_SOLAR_AZIMUTH_ANGLE:156.635542399
- MEAN_SOLAR_ZENITH_ANGLE:50.4236448912
- MEDIUM_PROBA_CLOUDS_PERCENTAGE:19.061849
- MGRS_TILE:43QCG
- NODATA_PIXEL_PERCENTAGE:7e-06
- NOT_VEGETATED_PERCENTAGE:25.851753
- PROCESSING_BASELINE:02.13
- PRODUCT_ID:S2B_MSIL2A_20200103T054229_N0213_R005_T43QCG_20200103T090132
- RADIATIVE_TRANSFER_ACCURACY:0
- RADIOMETRIC_QUALITY:PASSED
- REFLECTANCE_CONVERSION_CORRECTION:1.03421965737
- SATURATED_DEFECTIVE_PIXEL_PERCENTAGE:0
- SENSING_ORBIT_DIRECTION:DESCENDING
- SENSING_ORBIT_NUMBER:5
- SENSOR_QUALITY:PASSED
- SNOW_ICE_PERCENTAGE:0
- SOLAR_IRRADIANCE_B1:1874.3
- SOLAR_IRRADIANCE_B10:365.41
- SOLAR_IRRADIANCE_B11:247.08
- SOLAR_IRRADIANCE_B12:87.75
- SOLAR_IRRADIANCE_B2:1959.75
- SOLAR_IRRADIANCE_B3:1824.93
- SOLAR_IRRADIANCE_B4:1512.79
- SOLAR_IRRADIANCE_B5:1425.78
- SOLAR_IRRADIANCE_B6:1291.13
- SOLAR_IRRADIANCE_B7:1175.57
- SOLAR_IRRADIANCE_B8:1041.28
- SOLAR_IRRADIANCE_B8A:953.93
- SOLAR_IRRADIANCE_B9:817.58
- SPACECRAFT_NAME:Sentinel-2B
- THIN_CIRRUS_PERCENTAGE:5.685081
- UNCLASSIFIED_PERCENTAGE:23.282081
- VEGETATION_PERCENTAGE:17.555073
- WATER_PERCENTAGE:0.640701
- WATER_VAPOUR_RETRIEVAL_ACCURACY:0
- system:asset_size:1657256589
- type:LinearRing
- 0:74.11016540745601
- 1:24.410902070189405
- 0:74.11015304070706
- 1:24.41090268552488
- 0:73.02774900042658
- 1:24.400670996155263
- 0:73.02770404977073
- 1:24.400633859210657
- 0:73.02765432478664
- 1:24.400602059690048
- 0:73.02765153226005
- 1:24.40058724459411
- 0:73.03524590991442
- 1:23.905101331454237
- 0:73.04263691932812
- 1:23.40958874371405
- 0:73.04267736331765
- 1:23.409547741651778
- 0:73.04271195238107
- 1:23.409502480476807
- 0:73.0427280759271
- 1:23.409499872731466
- 0:74.11691932286789
- 1:23.41926657630988
- 0:74.11696421791991
- 1:23.41930339484835
- 0:74.11701386233618
- 1:23.419334786767944
- 0:74.11701681949414
- 1:23.41934958311633
- 0:74.11368048838503
- 1:23.915101382828507
- 0:74.11025251236038
- 1:24.410813246431026
- 0:74.11021209640668
- 1:24.410854510840057
- 0:74.11017759497592
- 1:24.41090002461655
- 0:74.11016540745601
- 1:24.410902070189405
- system:index:20200103T054229_20200103T054832_T43QCG
- system:time_end:1578030739975
- system:time_start:1578030739975
"
],
"text/plain": [
""
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"image.addBands([image, image])"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"(, 78)"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"image, 26*3"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"- type:Image
- id:COPERNICUS/S2_SR_HARMONIZED/20200103T054229_20200103T054832_T43QCG
- version:1729686309598954
- AOT_RETRIEVAL_ACCURACY:0
- CLOUDY_PIXEL_PERCENTAGE:31.922709
- CLOUD_COVERAGE_ASSESSMENT:31.922709
- CLOUD_SHADOW_PERCENTAGE:0.198579
- DARK_FEATURES_PERCENTAGE:0.549102
- DATASTRIP_ID:S2B_OPER_MSI_L2A_DS_EPAE_20200103T090132_S20200103T054832_N02.13
- DATATAKE_IDENTIFIER:GS2B_20200103T054229_014760_N02.13
- DATATAKE_TYPE:INS-NOBS
- DEGRADED_MSI_DATA_PERCENTAGE:0
- FORMAT_CORRECTNESS:PASSED
- GENERAL_QUALITY:PASSED
- GENERATION_TIME:1578042092000
- GEOMETRIC_QUALITY:PASSED
- GRANULE_ID:L2A_T43QCG_A014760_20200103T054832
- HIGH_PROBA_CLOUDS_PERCENTAGE:7.175779
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B1:228.866693947
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B10:231.181075346
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B11:229.390344022
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B12:228.693796089
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B2:234.499920967
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B3:232.023517476
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B4:230.59537529
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B5:229.956341503
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B6:229.518495929
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B7:229.037434243
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8:233.108324536
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A:228.7554452
- MEAN_INCIDENCE_AZIMUTH_ANGLE_B9:228.681896618
- MEAN_INCIDENCE_ZENITH_ANGLE_B1:3.84876005888
- MEAN_INCIDENCE_ZENITH_ANGLE_B10:3.45177233793
- MEAN_INCIDENCE_ZENITH_ANGLE_B11:3.60137297281
- MEAN_INCIDENCE_ZENITH_ANGLE_B12:3.78570081137
- MEAN_INCIDENCE_ZENITH_ANGLE_B2:3.2782764992
- MEAN_INCIDENCE_ZENITH_ANGLE_B3:3.37551363359
- MEAN_INCIDENCE_ZENITH_ANGLE_B4:3.48451409456
- MEAN_INCIDENCE_ZENITH_ANGLE_B5:3.54599791747
- MEAN_INCIDENCE_ZENITH_ANGLE_B6:3.61605291573
- MEAN_INCIDENCE_ZENITH_ANGLE_B7:3.6859370775
- MEAN_INCIDENCE_ZENITH_ANGLE_B8:3.32377205921
- MEAN_INCIDENCE_ZENITH_ANGLE_B8A:3.76323633487
- MEAN_INCIDENCE_ZENITH_ANGLE_B9:3.93447100737
- MEAN_SOLAR_AZIMUTH_ANGLE:156.635542399
- MEAN_SOLAR_ZENITH_ANGLE:50.4236448912
- MEDIUM_PROBA_CLOUDS_PERCENTAGE:19.061849
- MGRS_TILE:43QCG
- NODATA_PIXEL_PERCENTAGE:7e-06
- NOT_VEGETATED_PERCENTAGE:25.851753
- PROCESSING_BASELINE:02.13
- PRODUCT_ID:S2B_MSIL2A_20200103T054229_N0213_R005_T43QCG_20200103T090132
- RADIATIVE_TRANSFER_ACCURACY:0
- RADIOMETRIC_QUALITY:PASSED
- REFLECTANCE_CONVERSION_CORRECTION:1.03421965737
- SATURATED_DEFECTIVE_PIXEL_PERCENTAGE:0
- SENSING_ORBIT_DIRECTION:DESCENDING
- SENSING_ORBIT_NUMBER:5
- SENSOR_QUALITY:PASSED
- SNOW_ICE_PERCENTAGE:0
- SOLAR_IRRADIANCE_B1:1874.3
- SOLAR_IRRADIANCE_B10:365.41
- SOLAR_IRRADIANCE_B11:247.08
- SOLAR_IRRADIANCE_B12:87.75
- SOLAR_IRRADIANCE_B2:1959.75
- SOLAR_IRRADIANCE_B3:1824.93
- SOLAR_IRRADIANCE_B4:1512.79
- SOLAR_IRRADIANCE_B5:1425.78
- SOLAR_IRRADIANCE_B6:1291.13
- SOLAR_IRRADIANCE_B7:1175.57
- SOLAR_IRRADIANCE_B8:1041.28
- SOLAR_IRRADIANCE_B8A:953.93
- SOLAR_IRRADIANCE_B9:817.58
- SPACECRAFT_NAME:Sentinel-2B
- THIN_CIRRUS_PERCENTAGE:5.685081
- UNCLASSIFIED_PERCENTAGE:23.282081
- VEGETATION_PERCENTAGE:17.555073
- WATER_PERCENTAGE:0.640701
- WATER_VAPOUR_RETRIEVAL_ACCURACY:0
- system:asset_size:1657256589
- type:LinearRing
- 0:74.11016540745601
- 1:24.410902070189405
- 0:74.11015304070706
- 1:24.41090268552488
- 0:73.02774900042658
- 1:24.400670996155263
- 0:73.02770404977073
- 1:24.400633859210657
- 0:73.02765432478664
- 1:24.400602059690048
- 0:73.02765153226005
- 1:24.40058724459411
- 0:73.03524590991442
- 1:23.905101331454237
- 0:73.04263691932812
- 1:23.40958874371405
- 0:73.04267736331765
- 1:23.409547741651778
- 0:73.04271195238107
- 1:23.409502480476807
- 0:73.0427280759271
- 1:23.409499872731466
- 0:74.11691932286789
- 1:23.41926657630988
- 0:74.11696421791991
- 1:23.41930339484835
- 0:74.11701386233618
- 1:23.419334786767944
- 0:74.11701681949414
- 1:23.41934958311633
- 0:74.11368048838503
- 1:23.915101382828507
- 0:74.11025251236038
- 1:24.410813246431026
- 0:74.11021209640668
- 1:24.410854510840057
- 0:74.11017759497592
- 1:24.41090002461655
- 0:74.11016540745601
- 1:24.410902070189405
- system:index:20200103T054229_20200103T054832_T43QCG
- system:time_end:1578030739975
- system:time_start:1578030739975
"
],
"text/plain": [
""
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b2 = image.select('B2')\n",
"b2"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b2.subtract(b2).multiply(b2).add(2.5)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"{'type': 'Image',\n",
" 'bands': [{'id': 'B2',\n",
" 'data_type': {'type': 'PixelType',\n",
" 'precision': 'int',\n",
" 'min': 0,\n",
" 'max': 65535},\n",
" 'dimensions': [10980, 10980],\n",
" 'crs': 'EPSG:32643',\n",
" 'crs_transform': [10, 0, 300000, 0, -10, 2700000]}],\n",
" 'version': 1729686309598954,\n",
" 'id': 'COPERNICUS/S2_SR_HARMONIZED/20200103T054229_20200103T054832_T43QCG',\n",
" 'properties': {'DATATAKE_IDENTIFIER': 'GS2B_20200103T054229_014760_N02.13',\n",
" 'AOT_RETRIEVAL_ACCURACY': 0,\n",
" 'SPACECRAFT_NAME': 'Sentinel-2B',\n",
" 'SATURATED_DEFECTIVE_PIXEL_PERCENTAGE': 0,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A': 228.7554452,\n",
" 'CLOUD_SHADOW_PERCENTAGE': 0.198579,\n",
" 'MEAN_SOLAR_AZIMUTH_ANGLE': 156.635542399,\n",
" 'system:footprint': {'type': 'LinearRing',\n",
" 'coordinates': [[74.11016540745601, 24.410902070189405],\n",
" [74.11015304070706, 24.41090268552488],\n",
" [73.02774900042658, 24.400670996155263],\n",
" [73.02770404977073, 24.400633859210657],\n",
" [73.02765432478664, 24.400602059690048],\n",
" [73.02765153226005, 24.40058724459411],\n",
" [73.03524590991442, 23.905101331454237],\n",
" [73.04263691932812, 23.40958874371405],\n",
" [73.04267736331765, 23.409547741651778],\n",
" [73.04271195238107, 23.409502480476807],\n",
" [73.0427280759271, 23.409499872731466],\n",
" [74.11691932286789, 23.41926657630988],\n",
" [74.11696421791991, 23.41930339484835],\n",
" [74.11701386233618, 23.419334786767944],\n",
" [74.11701681949414, 23.41934958311633],\n",
" [74.11368048838503, 23.915101382828507],\n",
" [74.11025251236038, 24.410813246431026],\n",
" [74.11021209640668, 24.410854510840057],\n",
" [74.11017759497592, 24.41090002461655],\n",
" [74.11016540745601, 24.410902070189405]]},\n",
" 'VEGETATION_PERCENTAGE': 17.555073,\n",
" 'SOLAR_IRRADIANCE_B12': 87.75,\n",
" 'SOLAR_IRRADIANCE_B10': 365.41,\n",
" 'SENSOR_QUALITY': 'PASSED',\n",
" 'SOLAR_IRRADIANCE_B11': 247.08,\n",
" 'GENERATION_TIME': 1578042092000,\n",
" 'SOLAR_IRRADIANCE_B8A': 953.93,\n",
" 'FORMAT_CORRECTNESS': 'PASSED',\n",
" 'CLOUD_COVERAGE_ASSESSMENT': 31.922709,\n",
" 'THIN_CIRRUS_PERCENTAGE': 5.685081,\n",
" 'system:time_end': 1578030739975,\n",
" 'WATER_VAPOUR_RETRIEVAL_ACCURACY': 0,\n",
" 'system:time_start': 1578030739975,\n",
" 'DATASTRIP_ID': 'S2B_OPER_MSI_L2A_DS_EPAE_20200103T090132_S20200103T054832_N02.13',\n",
" 'PROCESSING_BASELINE': '02.13',\n",
" 'SENSING_ORBIT_NUMBER': 5,\n",
" 'NODATA_PIXEL_PERCENTAGE': 7e-06,\n",
" 'SENSING_ORBIT_DIRECTION': 'DESCENDING',\n",
" 'GENERAL_QUALITY': 'PASSED',\n",
" 'GRANULE_ID': 'L2A_T43QCG_A014760_20200103T054832',\n",
" 'REFLECTANCE_CONVERSION_CORRECTION': 1.03421965737,\n",
" 'MEDIUM_PROBA_CLOUDS_PERCENTAGE': 19.061849,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B8': 233.108324536,\n",
" 'DATATAKE_TYPE': 'INS-NOBS',\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B9': 228.681896618,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B6': 229.518495929,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B7': 229.037434243,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B4': 230.59537529,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B1': 3.84876005888,\n",
" 'NOT_VEGETATED_PERCENTAGE': 25.851753,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B5': 229.956341503,\n",
" 'RADIOMETRIC_QUALITY': 'PASSED',\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B2': 234.499920967,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B3': 232.023517476,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B5': 3.54599791747,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B1': 228.866693947,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B4': 3.48451409456,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B3': 3.37551363359,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B2': 3.2782764992,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B9': 3.93447100737,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B8': 3.32377205921,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B7': 3.6859370775,\n",
" 'DARK_FEATURES_PERCENTAGE': 0.549102,\n",
" 'HIGH_PROBA_CLOUDS_PERCENTAGE': 7.175779,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B6': 3.61605291573,\n",
" 'UNCLASSIFIED_PERCENTAGE': 23.282081,\n",
" 'MEAN_SOLAR_ZENITH_ANGLE': 50.4236448912,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B8A': 3.76323633487,\n",
" 'RADIATIVE_TRANSFER_ACCURACY': 0,\n",
" 'MGRS_TILE': '43QCG',\n",
" 'CLOUDY_PIXEL_PERCENTAGE': 31.922709,\n",
" 'PRODUCT_ID': 'S2B_MSIL2A_20200103T054229_N0213_R005_T43QCG_20200103T090132',\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B10': 3.45177233793,\n",
" 'SOLAR_IRRADIANCE_B9': 817.58,\n",
" 'SNOW_ICE_PERCENTAGE': 0,\n",
" 'DEGRADED_MSI_DATA_PERCENTAGE': 0,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B11': 3.60137297281,\n",
" 'MEAN_INCIDENCE_ZENITH_ANGLE_B12': 3.78570081137,\n",
" 'SOLAR_IRRADIANCE_B6': 1291.13,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B10': 231.181075346,\n",
" 'SOLAR_IRRADIANCE_B5': 1425.78,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B11': 229.390344022,\n",
" 'SOLAR_IRRADIANCE_B8': 1041.28,\n",
" 'MEAN_INCIDENCE_AZIMUTH_ANGLE_B12': 228.693796089,\n",
" 'SOLAR_IRRADIANCE_B7': 1175.57,\n",
" 'SOLAR_IRRADIANCE_B2': 1959.75,\n",
" 'SOLAR_IRRADIANCE_B1': 1874.3,\n",
" 'SOLAR_IRRADIANCE_B4': 1512.79,\n",
" 'GEOMETRIC_QUALITY': 'PASSED',\n",
" 'SOLAR_IRRADIANCE_B3': 1824.93,\n",
" 'system:asset_size': 1657256589,\n",
" 'WATER_PERCENTAGE': 0.640701,\n",
" 'system:index': '20200103T054229_20200103T054832_T43QCG'}}"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b2.getInfo()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"{'type': 'Polygon',\n",
" 'coordinates': [[[-122.52021789550781, 37.76885797689413],\n",
" [-122.51060485839844, 37.76885797689413],\n",
" [-122.51060485839844, 37.77478500000001],\n",
" [-122.52021789550781, 37.77478500000001],\n",
" [-122.52021789550781, 37.76885797689413]]]}"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ee_polygon.getInfo()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import geemap.foliumap as gee_folium"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"m = gee_folium.Map()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"7272.727272727272"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1/2.75e-05 * 0.2"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;31mSignature:\u001b[0m\n",
"\u001b[0mm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maddLayer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mee_object\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mvis_params\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'Layer untitled'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mshown\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mopacity\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mSource:\u001b[0m \n",
" \u001b[0;32mdef\u001b[0m \u001b[0madd_layer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mee_object\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mvis_params\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Layer untitled\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mshown\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mopacity\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"\"\"Adds a given EE object to the map as a layer.\u001b[0m\n",
"\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m Args:\u001b[0m\n",
"\u001b[0;34m ee_object (Collection|Feature|Image|MapId): The object to add to the map.\u001b[0m\n",
"\u001b[0;34m vis_params (dict, optional): The visualization parameters. Defaults to {}.\u001b[0m\n",
"\u001b[0;34m name (str, optional): The name of the layer. Defaults to 'Layer untitled'.\u001b[0m\n",
"\u001b[0;34m shown (bool, optional): A flag indicating whether the layer should be on by default. Defaults to True.\u001b[0m\n",
"\u001b[0;34m opacity (float, optional): The layer's opacity represented as a number between 0 and 1. Defaults to 1.\u001b[0m\n",
"\u001b[0;34m \"\"\"\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mlayer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mEEFoliumTileLayer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mee_object\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvis_params\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mshown\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mopacity\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mlayer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd_to\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0marc_add_layer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlayer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0murl_format\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mshown\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mopacity\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mFile:\u001b[0m /opt/anaconda3/envs/zeel_py310/lib/python3.10/site-packages/geemap/foliumap.py\n",
"\u001b[0;31mType:\u001b[0m method"
]
}
],
"source": [
"m.addLayer??"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"Index(['2023-01', '2023-02', '2023-03', '2023-04', '2023-05', '2023-06',\n",
" '2023-07', '2023-08', '2023-09', '2023-10', '2023-11', '2023-12',\n",
" '2024-01'],\n",
" dtype='object')"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"start = \"2023-01\"\n",
"end = \"2024-01\"\n",
"pd.date_range(start, end, freq='MS').strftime(\"%Y-%m\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'type': 'Polygon', 'coordinates': (((73.19791470947145, 24.01977640858627), (73.1951165609439, 24.01754094149261), (73.1955205367043, 24.01738340683521), (73.19480033400262, 24.01523619312771), (73.19463695073262, 24.01440311871703), (73.19454286010809, 24.0139003560814), (73.1942443392165, 24.0126807914708), (73.1942341944796, 24.0126863557728), (73.19653511275247, 24.01252023885471), (73.19648432210984, 24.01217871972386), (73.19764861281237, 24.01199930187962), (73.1981728693097, 24.01433254741455), (73.1986819814156, 24.01611200638915), (73.19959745133227, 24.01895266153662), (73.19791470947145, 24.01977640858627)),)}\n",
"\n"
]
},
{
"data": {
"text/html": [
"- type:FeatureCollection
- type:Feature
- id:0
- type:Polygon
- 0:73.19791470947145
- 1:24.01977640858627
- 0:73.1951165609439
- 1:24.01754094149261
- 0:73.1955205367043
- 1:24.01738340683521
- 0:73.19480033400262
- 1:24.01523619312771
- 0:73.19463695073262
- 1:24.01440311871703
- 0:73.19454286010809
- 1:24.0139003560814
- 0:73.1942443392165
- 1:24.0126807914708
- 0:73.1942341944796
- 1:24.0126863557728
- 0:73.19653511275247
- 1:24.01252023885471
- 0:73.19648432210984
- 1:24.01217871972386
- 0:73.19764861281237
- 1:24.01199930187962
- 0:73.1981728693097
- 1:24.01433254741455
- 0:73.1986819814156
- 1:24.01611200638915
- 0:73.19959745133227
- 1:24.01895266153662
- 0:73.19791470947145
- 1:24.01977640858627
"
],
"text/plain": [
""
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gdf = gpd.read_file(\"/home/patel_zeel/Mean_NDVI/golvada he 10 2023-24.kml\")\n",
"gdf = gdf.to_crs(epsg=4326)\n",
"def poly_3d_to_2d(shape):\n",
" if shape.has_z:\n",
" return transform(lambda x, y, z: (x, y), shape)\n",
" else:\n",
" return shape\n",
"gdf['geometry'] = gdf['geometry'].apply(poly_3d_to_2d)\n",
"gdf = gdf.to_crs(epsg=4326)\n",
"first_item = gdf.iloc[0].geometry.__geo_interface__\n",
"print(first_item)\n",
"print(type(first_item))\n",
"ee_geometry = ee.Geometry(first_item)\n",
"ee_feature_collection = ee.FeatureCollection(ee_geometry)\n",
"ee_feature_collection\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['LANDSAT/LC08/C02/T1_TOA/LC08_148043_20230405', 'LANDSAT/LC08/C02/T1_TOA/LC08_148043_20230421', 'LANDSAT/LC08/C02/T1_TOA/LC08_148043_20230507', 'LANDSAT/LC08/C02/T1_TOA/LC08_148043_20230523', 'LANDSAT/LC08/C02/T1_TOA/LC08_148043_20230608', 'LANDSAT/LC08/C02/T1_TOA/LC08_148043_20230624', 'LANDSAT/LC08/C02/T1_TOA/LC08_148043_20230811', 'LANDSAT/LC08/C02/T1_TOA/LC08_148043_20230827', 'LANDSAT/LC08/C02/T1_TOA/LC08_148044_20230405', 'LANDSAT/LC08/C02/T1_TOA/LC08_148044_20230421', 'LANDSAT/LC08/C02/T1_TOA/LC08_148044_20230507', 'LANDSAT/LC08/C02/T1_TOA/LC08_148044_20230523', 'LANDSAT/LC08/C02/T1_TOA/LC08_148044_20230608', 'LANDSAT/LC08/C02/T1_TOA/LC08_148044_20230811', 'LANDSAT/LC08/C02/T1_TOA/LC08_148044_20230827']\n"
]
}
],
"source": [
"dataset = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA').filterBounds(ee_geometry).filterDate('2023-04', '2023-09')\n",
"# print image IDs\n",
"image_ids = dataset.aggregate_array('system:id').getInfo()\n",
"print(image_ids)\n",
"\n",
"# true_color_432 = dataset.select(['B4', 'B3', 'B2'])\n",
"# print(\"Number of images in the collection: \", true_color_432.size().getInfo())"
]
},
{
"cell_type": "code",
"execution_count": 136,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Image ID: LC08_148044_20230115\n",
"New Image ID: LC08_148044_20230115\n"
]
}
],
"source": [
"# pick the second image in the collection\n",
"image = dataset.toList(true_color_432.size()).get(1)\n",
"image = ee.Image(image)\n",
"# print image id\n",
"print(\"Image ID: \", image.id().getInfo())\n",
"# replace id with \"anonymous\"\n",
"image = image.set('id', 'anonymous')\n",
"# print new image id\n",
"print(\"New Image ID: \", image.id().getInfo())"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Computing statistics ...\n"
]
},
{
"data": {
"text/plain": [
"{'type': 'FeatureCollection',\n",
" 'columns': {'mean': 'Float', 'system:index': 'String'},\n",
" 'features': [{'type': 'Feature',\n",
" 'geometry': {'type': 'Polygon',\n",
" 'coordinates': [[[73.19791470947145, 24.01977640858627],\n",
" [73.1951165609439, 24.01754094149261],\n",
" [73.1955205367043, 24.01738340683521],\n",
" [73.19480033400262, 24.01523619312771],\n",
" [73.19463695073262, 24.01440311871703],\n",
" [73.19454286010809, 24.0139003560814],\n",
" [73.1942443392165, 24.0126807914708],\n",
" [73.1942341944796, 24.0126863557728],\n",
" [73.19653511275247, 24.01252023885471],\n",
" [73.19648432210984, 24.01217871972386],\n",
" [73.19764861281237, 24.01199930187962],\n",
" [73.1981728693097, 24.01433254741455],\n",
" [73.1986819814156, 24.01611200638915],\n",
" [73.19959745133227, 24.01895266153662],\n",
" [73.19791470947145, 24.01977640858627]]]},\n",
" 'id': '0',\n",
" 'properties': {'mean': 0.7695880858277654}}]}"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"geemap.zonal_stats(dataset.qualityMosaic(\"B4\").select([\"B4\"]), ee_feature_collection, statistics_type='mean', scale=10, return_fc=True).getInfo()"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"[{'type': 'Feature',\n",
" 'geometry': {'type': 'Polygon',\n",
" 'coordinates': [[[73.19791470947145, 24.01977640858627],\n",
" [73.1951165609439, 24.01754094149261],\n",
" [73.1955205367043, 24.01738340683521],\n",
" [73.19480033400262, 24.01523619312771],\n",
" [73.19463695073262, 24.01440311871703],\n",
" [73.19454286010809, 24.0139003560814],\n",
" [73.1942443392165, 24.0126807914708],\n",
" [73.1942341944796, 24.0126863557728],\n",
" [73.19653511275247, 24.01252023885471],\n",
" [73.19648432210984, 24.01217871972386],\n",
" [73.19764861281237, 24.01199930187962],\n",
" [73.1981728693097, 24.01433254741455],\n",
" [73.1986819814156, 24.01611200638915],\n",
" [73.19959745133227, 24.01895266153662],\n",
" [73.19791470947145, 24.01977640858627]]]},\n",
" 'id': '0',\n",
" 'properties': {'mean': 0.7695880858277654}}]"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"features.getInfo()['features']"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"'20210125'"
]
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import re\n",
"\n",
"re.findall(r\"LC08_\\d+_(\\d+)_NDVI\", \"LC08_148043_20210125_NDVI\")[0]"
]
},
{
"cell_type": "code",
"execution_count": 72,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<ee.image.Image object at 0x7fd10c62b820>
"
],
"text/plain": [
""
]
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dataset.qualityMosaic('NDVI')"
]
},
{
"cell_type": "code",
"execution_count": 116,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"'2023-01-01'"
]
},
"execution_count": 116,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"start = '2023-01-01'\n",
"start.format(\"YYYY-MM\")"
]
},
{
"cell_type": "code",
"execution_count": 110,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['2023-01-01', '2023-02-01', '2023-03-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-07-01', '2023-08-01', '2023-09-01', '2023-10-01', '2023-11-01', '2023-12-01', '2024-01-01']\n"
]
}
],
"source": [
"import pandas as pd\n",
"start_date = '2023-01'\n",
"end_date = '2024-01'\n",
"\n",
"# get 1st day of each month\n",
"dates = pd.date_range(start_date, end_date, freq='MS').strftime(\"%Y-%m-%d\").tolist()\n",
"print(dates)"
]
},
{
"cell_type": "code",
"execution_count": 138,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;31mSignature:\u001b[0m\n",
"\u001b[0mgeemap\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzonal_stats\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0min_value_raster\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0min_zone_vector\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mout_file_path\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mstat_type\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'MEAN'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mscale\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcrs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtile_scale\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mreturn_fc\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m300\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mproxies\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mSource:\u001b[0m \n",
"\u001b[0;32mdef\u001b[0m \u001b[0mzonal_stats\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0min_value_raster\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0min_zone_vector\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mout_file_path\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mstat_type\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"MEAN\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mscale\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcrs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtile_scale\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mreturn_fc\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m300\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mproxies\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"\"\"Summarizes the values of a raster within the zones of another dataset and exports the results as a csv, shp, json, kml, or kmz.\u001b[0m\n",
"\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m Args:\u001b[0m\n",
"\u001b[0;34m in_value_raster (object): An ee.Image or ee.ImageCollection that contains the values on which to calculate a statistic.\u001b[0m\n",
"\u001b[0;34m in_zone_vector (object): An ee.FeatureCollection that defines the zones.\u001b[0m\n",
"\u001b[0;34m out_file_path (str): Output file path that will contain the summary of the values in each zone. The file type can be: csv, shp, json, kml, kmz\u001b[0m\n",
"\u001b[0;34m stat_type (str, optional): Statistical type to be calculated. Defaults to 'MEAN'. For 'HIST', you can provide three parameters: max_buckets, min_bucket_width, and max_raw. For 'FIXED_HIST', you must provide three parameters: hist_min, hist_max, and hist_steps.\u001b[0m\n",
"\u001b[0;34m scale (float, optional): A nominal scale in meters of the projection to work in. Defaults to None.\u001b[0m\n",
"\u001b[0;34m crs (str, optional): The projection to work in. If unspecified, the projection of the image's first band is used. If specified in addition to scale, rescaled to the specified scale. Defaults to None.\u001b[0m\n",
"\u001b[0;34m tile_scale (float, optional): A scaling factor used to reduce aggregation tile size; using a larger tileScale (e.g. 2 or 4) may enable computations that run out of memory with the default. Defaults to 1.0.\u001b[0m\n",
"\u001b[0;34m verbose (bool, optional): Whether to print descriptive text when the programming is running. Default to True.\u001b[0m\n",
"\u001b[0;34m return_fc (bool, optional): Whether to return the results as an ee.FeatureCollection. Defaults to False.\u001b[0m\n",
"\u001b[0;34m timeout (int, optional): Timeout in seconds. Default to 300.\u001b[0m\n",
"\u001b[0;34m proxies (dict, optional): A dictionary of proxy servers to use for the request. Default to None.\u001b[0m\n",
"\u001b[0;34m \"\"\"\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0min_value_raster\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mImageCollection\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0min_value_raster\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0min_value_raster\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoBands\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0min_value_raster\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mImage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"The input raster must be an ee.Image.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0min_zone_vector\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mFeatureCollection\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"The input zone data must be an ee.FeatureCollection.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mout_file_path\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mout_file_path\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetcwd\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"zonal_stats.csv\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m\"statistics_type\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mstat_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"statistics_type\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mallowed_formats\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m\"csv\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"geojson\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"kml\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"kmz\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"shp\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mfilename\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mabspath\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mout_file_path\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mbasename\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbasename\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;31m# name = os.path.splitext(basename)[0]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mfiletype\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplitext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbasename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mfiletype\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mallowed_formats\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"The file type must be one of the following: {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\", \"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mallowed_formats\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;31m# Parameters for histogram\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;31m# The maximum number of buckets to use when building a histogram; will be rounded up to a power of 2.\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmax_buckets\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;31m# The minimum histogram bucket width, or null to allow any power of 2.\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmin_bucket_width\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;31m# The number of values to accumulate before building the initial histogram.\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmax_raw\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhist_min\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1.0\u001b[0m \u001b[0;31m# The lower (inclusive) bound of the first bucket.\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhist_max\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m100.0\u001b[0m \u001b[0;31m# The upper (exclusive) bound of the last bucket.\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhist_steps\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m10\u001b[0m \u001b[0;31m# The number of buckets to use.\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m\"max_buckets\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmax_buckets\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"max_buckets\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m\"min_bucket_width\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmin_bucket_width\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"min_bucket\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m\"max_raw\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmax_raw\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"max_raw\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstat_type\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mstat_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"FIXED_HIST\"\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m\"hist_min\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m\"hist_max\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m\"hist_steps\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhist_min\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"hist_min\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhist_max\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"hist_max\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhist_steps\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"hist_steps\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mstat_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"FIXED_HIST\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"To use fixedHistogram, please provide these three parameters: hist_min, hist_max, and hist_steps.\"\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mallowed_statistics\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"COUNT\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcount\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"MEAN\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"MEAN_UNWEIGHTED\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munweighted\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"MAXIMUM\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"MEDIAN\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmedian\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"MINIMUM\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"MODE\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"STD\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstdDev\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"MIN_MAX\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mminMax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"SUM\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"VARIANCE\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvariance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"HIST\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhistogram\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmaxBuckets\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmax_buckets\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mminBucketWidth\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmin_bucket_width\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmaxRaw\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmax_raw\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"FIXED_HIST\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfixedHistogram\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhist_min\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhist_max\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhist_steps\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"COMBINED_COUNT_MEAN\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcount\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcombine\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msharedInputs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"COMBINED_COUNT_MEAN_UNWEIGHTED\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcount\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcombine\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munweighted\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msharedInputs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstat_type\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mstat_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mallowed_statistics\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\"The statistics type must be one of the following: {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m\", \"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mallowed_statistics\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mreducer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mallowed_statistics\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstat_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstat_type\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReducer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mreducer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstat_type\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"statistics_type must be either a string or ee.Reducer.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mscale\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mscale\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0min_value_raster\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprojection\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnominalScale\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmultiply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Computing statistics ...\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0min_value_raster\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreduceRegions\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcollection\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0min_zone_vector\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mreducer\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mreducer\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mscale\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mscale\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcrs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcrs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtileScale\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtile_scale\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mreturn_fc\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mee_export_vector\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mproxies\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mproxies\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mException\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mFile:\u001b[0m /opt/anaconda3/envs/zeel_py310/lib/python3.10/site-packages/geemap/common.py\n",
"\u001b[0;31mType:\u001b[0m function"
]
}
],
"source": [
"geemap.zonal_stats??"
]
},
{
"cell_type": "code",
"execution_count": 139,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 140,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;31mSignature:\u001b[0m\n",
"\u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmerge\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'DataFrame | Series'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'DataFrame | Series'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhow\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'MergeHow'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'inner'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mon\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'IndexLabel | None'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_on\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'IndexLabel | None'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_on\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'IndexLabel | None'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_index\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'bool'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_index\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'bool'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msort\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'bool'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msuffixes\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'Suffixes'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m'_x'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'_y'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'bool | None'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mindicator\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'str | bool'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mvalidate\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'str | None'\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0;34m'DataFrame'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Merge DataFrame or named Series objects with a database-style join.\n",
"\n",
"A named Series object is treated as a DataFrame with a single named column.\n",
"\n",
"The join is done on columns or indexes. If joining columns on\n",
"columns, the DataFrame indexes *will be ignored*. Otherwise if joining indexes\n",
"on indexes or indexes on a column or columns, the index will be passed on.\n",
"When performing a cross merge, no column specifications to merge on are\n",
"allowed.\n",
"\n",
".. warning::\n",
"\n",
" If both key columns contain rows where the key is a null value, those\n",
" rows will be matched against each other. This is different from usual SQL\n",
" join behaviour and can lead to unexpected results.\n",
"\n",
"Parameters\n",
"----------\n",
"left : DataFrame or named Series\n",
"right : DataFrame or named Series\n",
" Object to merge with.\n",
"how : {'left', 'right', 'outer', 'inner', 'cross'}, default 'inner'\n",
" Type of merge to be performed.\n",
"\n",
" * left: use only keys from left frame, similar to a SQL left outer join;\n",
" preserve key order.\n",
" * right: use only keys from right frame, similar to a SQL right outer join;\n",
" preserve key order.\n",
" * outer: use union of keys from both frames, similar to a SQL full outer\n",
" join; sort keys lexicographically.\n",
" * inner: use intersection of keys from both frames, similar to a SQL inner\n",
" join; preserve the order of the left keys.\n",
" * cross: creates the cartesian product from both frames, preserves the order\n",
" of the left keys.\n",
"\n",
" .. versionadded:: 1.2.0\n",
"\n",
"on : label or list\n",
" Column or index level names to join on. These must be found in both\n",
" DataFrames. If `on` is None and not merging on indexes then this defaults\n",
" to the intersection of the columns in both DataFrames.\n",
"left_on : label or list, or array-like\n",
" Column or index level names to join on in the left DataFrame. Can also\n",
" be an array or list of arrays of the length of the left DataFrame.\n",
" These arrays are treated as if they are columns.\n",
"right_on : label or list, or array-like\n",
" Column or index level names to join on in the right DataFrame. Can also\n",
" be an array or list of arrays of the length of the right DataFrame.\n",
" These arrays are treated as if they are columns.\n",
"left_index : bool, default False\n",
" Use the index from the left DataFrame as the join key(s). If it is a\n",
" MultiIndex, the number of keys in the other DataFrame (either the index\n",
" or a number of columns) must match the number of levels.\n",
"right_index : bool, default False\n",
" Use the index from the right DataFrame as the join key. Same caveats as\n",
" left_index.\n",
"sort : bool, default False\n",
" Sort the join keys lexicographically in the result DataFrame. If False,\n",
" the order of the join keys depends on the join type (how keyword).\n",
"suffixes : list-like, default is (\"_x\", \"_y\")\n",
" A length-2 sequence where each element is optionally a string\n",
" indicating the suffix to add to overlapping column names in\n",
" `left` and `right` respectively. Pass a value of `None` instead\n",
" of a string to indicate that the column name from `left` or\n",
" `right` should be left as-is, with no suffix. At least one of the\n",
" values must not be None.\n",
"copy : bool, default True\n",
" If False, avoid copy if possible.\n",
"indicator : bool or str, default False\n",
" If True, adds a column to the output DataFrame called \"_merge\" with\n",
" information on the source of each row. The column can be given a different\n",
" name by providing a string argument. The column will have a Categorical\n",
" type with the value of \"left_only\" for observations whose merge key only\n",
" appears in the left DataFrame, \"right_only\" for observations\n",
" whose merge key only appears in the right DataFrame, and \"both\"\n",
" if the observation's merge key is found in both DataFrames.\n",
"\n",
"validate : str, optional\n",
" If specified, checks if merge is of specified type.\n",
"\n",
" * \"one_to_one\" or \"1:1\": check if merge keys are unique in both\n",
" left and right datasets.\n",
" * \"one_to_many\" or \"1:m\": check if merge keys are unique in left\n",
" dataset.\n",
" * \"many_to_one\" or \"m:1\": check if merge keys are unique in right\n",
" dataset.\n",
" * \"many_to_many\" or \"m:m\": allowed, but does not result in checks.\n",
"\n",
"Returns\n",
"-------\n",
"DataFrame\n",
" A DataFrame of the two merged objects.\n",
"\n",
"See Also\n",
"--------\n",
"merge_ordered : Merge with optional filling/interpolation.\n",
"merge_asof : Merge on nearest keys.\n",
"DataFrame.join : Similar method using indices.\n",
"\n",
"Examples\n",
"--------\n",
">>> df1 = pd.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'],\n",
"... 'value': [1, 2, 3, 5]})\n",
">>> df2 = pd.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'],\n",
"... 'value': [5, 6, 7, 8]})\n",
">>> df1\n",
" lkey value\n",
"0 foo 1\n",
"1 bar 2\n",
"2 baz 3\n",
"3 foo 5\n",
">>> df2\n",
" rkey value\n",
"0 foo 5\n",
"1 bar 6\n",
"2 baz 7\n",
"3 foo 8\n",
"\n",
"Merge df1 and df2 on the lkey and rkey columns. The value columns have\n",
"the default suffixes, _x and _y, appended.\n",
"\n",
">>> df1.merge(df2, left_on='lkey', right_on='rkey')\n",
" lkey value_x rkey value_y\n",
"0 foo 1 foo 5\n",
"1 foo 1 foo 8\n",
"2 foo 5 foo 5\n",
"3 foo 5 foo 8\n",
"4 bar 2 bar 6\n",
"5 baz 3 baz 7\n",
"\n",
"Merge DataFrames df1 and df2 with specified left and right suffixes\n",
"appended to any overlapping columns.\n",
"\n",
">>> df1.merge(df2, left_on='lkey', right_on='rkey',\n",
"... suffixes=('_left', '_right'))\n",
" lkey value_left rkey value_right\n",
"0 foo 1 foo 5\n",
"1 foo 1 foo 8\n",
"2 foo 5 foo 5\n",
"3 foo 5 foo 8\n",
"4 bar 2 bar 6\n",
"5 baz 3 baz 7\n",
"\n",
"Merge DataFrames df1 and df2, but raise an exception if the DataFrames have\n",
"any overlapping columns.\n",
"\n",
">>> df1.merge(df2, left_on='lkey', right_on='rkey', suffixes=(False, False))\n",
"Traceback (most recent call last):\n",
"...\n",
"ValueError: columns overlap but no suffix specified:\n",
" Index(['value'], dtype='object')\n",
"\n",
">>> df1 = pd.DataFrame({'a': ['foo', 'bar'], 'b': [1, 2]})\n",
">>> df2 = pd.DataFrame({'a': ['foo', 'baz'], 'c': [3, 4]})\n",
">>> df1\n",
" a b\n",
"0 foo 1\n",
"1 bar 2\n",
">>> df2\n",
" a c\n",
"0 foo 3\n",
"1 baz 4\n",
"\n",
">>> df1.merge(df2, how='inner', on='a')\n",
" a b c\n",
"0 foo 1 3\n",
"\n",
">>> df1.merge(df2, how='left', on='a')\n",
" a b c\n",
"0 foo 1 3.0\n",
"1 bar 2 NaN\n",
"\n",
">>> df1 = pd.DataFrame({'left': ['foo', 'bar']})\n",
">>> df2 = pd.DataFrame({'right': [7, 8]})\n",
">>> df1\n",
" left\n",
"0 foo\n",
"1 bar\n",
">>> df2\n",
" right\n",
"0 7\n",
"1 8\n",
"\n",
">>> df1.merge(df2, how='cross')\n",
" left right\n",
"0 foo 7\n",
"1 foo 8\n",
"2 bar 7\n",
"3 bar 8\n",
"\u001b[0;31mSource:\u001b[0m \n",
"\u001b[0;34m@\u001b[0m\u001b[0mSubstitution\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"\\nleft : DataFrame or named Series\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m@\u001b[0m\u001b[0mAppender\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_merge_doc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindents\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;32mdef\u001b[0m \u001b[0mmerge\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDataFrame\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0mSeries\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDataFrame\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0mSeries\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhow\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mMergeHow\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"inner\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mon\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mIndexLabel\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_on\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mIndexLabel\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_on\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mIndexLabel\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_index\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbool\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_index\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbool\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msort\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbool\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msuffixes\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mSuffixes\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m\"_x\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"_y\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbool\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mindicator\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0mbool\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mvalidate\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mDataFrame\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_df\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_validate_operand\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mleft\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_df\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_validate_operand\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mright\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhow\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"cross\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0m_cross_merge\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_df\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_df\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mon\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mon\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_on\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mleft_on\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_on\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mright_on\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_index\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mleft_index\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_index\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mright_index\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msort\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msort\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msuffixes\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msuffixes\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mindicator\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mindicator\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mvalidate\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mvalidate\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mop\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_MergeOperation\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_df\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_df\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhow\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhow\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mon\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mon\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_on\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mleft_on\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_on\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mright_on\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mleft_index\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mleft_index\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mright_index\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mright_index\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msort\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msort\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msuffixes\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msuffixes\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mindicator\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mindicator\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mvalidate\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mvalidate\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mop\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_result\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mFile:\u001b[0m /opt/anaconda3/envs/zeel_py310/lib/python3.10/site-packages/pandas/core/reshape/merge.py\n",
"\u001b[0;31mType:\u001b[0m function"
]
}
],
"source": [
"pd.merge??"
]
},
{
"cell_type": "code",
"execution_count": 163,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"- type:Image
- id:LANDSAT/LC08/C02/T1_TOA/LC08_148044_20230115
- version:1728577061133366
- CLOUD_COVER:0.04
- CLOUD_COVER_LAND:0.04
- COLLECTION_CATEGORY:T1
- COLLECTION_NUMBER:2
- DATA_SOURCE_ELEVATION:GLS2000
- DATA_SOURCE_TIRS_STRAY_LIGHT_CORRECTION:TIRS
- DATE_ACQUIRED:2023-01-15
- DATE_PRODUCT_GENERATED:1675122294000
- DATUM:WGS84
- EARTH_SUN_DISTANCE:0.9836383
- ELLIPSOID:WGS84
- GEOMETRIC_RMSE_MODEL:7.591
- GEOMETRIC_RMSE_MODEL_X:5.31
- GEOMETRIC_RMSE_MODEL_Y:5.425
- GEOMETRIC_RMSE_VERIFY:4.289
- GRID_CELL_SIZE_PANCHROMATIC:15
- GRID_CELL_SIZE_REFLECTIVE:30
- GRID_CELL_SIZE_THERMAL:30
- GROUND_CONTROL_POINTS_MODEL:685
- GROUND_CONTROL_POINTS_VERIFY:186
- GROUND_CONTROL_POINTS_VERSION:5
- IMAGE_QUALITY_OLI:9
- IMAGE_QUALITY_TIRS:9
- K1_CONSTANT_BAND_10:774.8853
- K1_CONSTANT_BAND_11:480.8883
- K2_CONSTANT_BAND_10:1321.0789
- K2_CONSTANT_BAND_11:1201.1442
- LANDSAT_PRODUCT_ID:LC08_L1TP_148044_20230115_20230130_02_T1
- LANDSAT_SCENE_ID:LC81480442023015LGN00
- MAP_PROJECTION:UTM
- NADIR_OFFNADIR:NADIR
- ORIENTATION:NORTH_UP
- PANCHROMATIC_LINES:15661
- PANCHROMATIC_SAMPLES:15341
- PROCESSING_LEVEL:L1TP
- PROCESSING_SOFTWARE_VERSION:LPGS_16.2.0
- RADIANCE_ADD_BAND_1:-64.88466
- RADIANCE_ADD_BAND_10:0.1
- RADIANCE_ADD_BAND_11:0.1
- RADIANCE_ADD_BAND_2:-66.44268
- RADIANCE_ADD_BAND_3:-61.22636
- RADIANCE_ADD_BAND_4:-51.62952
- RADIANCE_ADD_BAND_5:-31.59469
- RADIANCE_ADD_BAND_6:-7.85731
- RADIANCE_ADD_BAND_7:-2.64833
- RADIANCE_ADD_BAND_8:-58.4304
- RADIANCE_ADD_BAND_9:-12.34792
- RADIANCE_MULT_BAND_1:0.012977
- RADIANCE_MULT_BAND_10:0.0003342
- RADIANCE_MULT_BAND_11:0.0003342
- RADIANCE_MULT_BAND_2:0.013289
- RADIANCE_MULT_BAND_3:0.012245
- RADIANCE_MULT_BAND_4:0.010326
- RADIANCE_MULT_BAND_5:0.0063189
- RADIANCE_MULT_BAND_6:0.0015715
- RADIANCE_MULT_BAND_7:0.00052967
- RADIANCE_MULT_BAND_8:0.011686
- RADIANCE_MULT_BAND_9:0.0024696
- REFLECTANCE_ADD_BAND_1:-0.1
- REFLECTANCE_ADD_BAND_2:-0.1
- REFLECTANCE_ADD_BAND_3:-0.1
- REFLECTANCE_ADD_BAND_4:-0.1
- REFLECTANCE_ADD_BAND_5:-0.1
- REFLECTANCE_ADD_BAND_6:-0.1
- REFLECTANCE_ADD_BAND_7:-0.1
- REFLECTANCE_ADD_BAND_8:-0.1
- REFLECTANCE_ADD_BAND_9:-0.1
- REFLECTANCE_MULT_BAND_1:2e-05
- REFLECTANCE_MULT_BAND_2:2e-05
- REFLECTANCE_MULT_BAND_3:2e-05
- REFLECTANCE_MULT_BAND_4:2e-05
- REFLECTANCE_MULT_BAND_5:2e-05
- REFLECTANCE_MULT_BAND_6:2e-05
- REFLECTANCE_MULT_BAND_7:2e-05
- REFLECTANCE_MULT_BAND_8:2e-05
- REFLECTANCE_MULT_BAND_9:2e-05
- REFLECTIVE_LINES:7831
- REFLECTIVE_SAMPLES:7671
- REQUEST_ID:1631847_00022
- RESAMPLING_OPTION:CUBIC_CONVOLUTION
- ROLL_ANGLE:-0.001
- SATURATION_BAND_1:N
- SATURATION_BAND_2:N
- SATURATION_BAND_3:N
- SATURATION_BAND_4:N
- SATURATION_BAND_5:N
- SATURATION_BAND_6:N
- SATURATION_BAND_7:Y
- SATURATION_BAND_8:N
- SATURATION_BAND_9:N
- SCENE_CENTER_TIME:05:33:07.2544160Z
- SENSOR_ID:OLI_TIRS
- SPACECRAFT_ID:LANDSAT_8
- STATION_ID:LGN
- SUN_AZIMUTH:148.67360104
- SUN_ELEVATION:39.17034349
- TARGET_WRS_PATH:148
- TARGET_WRS_ROW:44
- THERMAL_LINES:7831
- THERMAL_SAMPLES:7671
- TIRS_SSM_MODEL:FINAL
- TIRS_SSM_POSITION_STATUS:ESTIMATED
- TRUNCATION_OLI:UPPER
- UTM_ZONE:43
- WRS_PATH:148
- WRS_ROW:44
- WRS_TYPE:2
- system:asset_size:1223935931
- type:LinearRing
- 0:72.31883641964504
- 1:22.52056460806495
- 0:72.29786773945534
- 1:22.42936978641094
- 0:72.29790667636928
- 1:22.42736139148
- 0:72.30336790848062
- 1:22.426188648118245
- 0:72.91869001515637
- 1:22.30172835792067
- 0:73.56730118878409
- 1:22.167716185850985
- 0:74.09737210807053
- 1:22.056060171921665
- 0:74.0993441010931
- 1:22.056071041671355
- 0:74.10397180462448
- 1:22.07490056623611
- 0:74.1329028941469
- 1:22.19375917371582
- 0:74.338430292183
- 1:23.033751135411748
- 0:74.47374505900434
- 1:23.582190648182443
- 0:74.52477957148619
- 1:23.788055785032157
- 0:74.52361975586437
- 1:23.788584893320223
- 0:73.58117794062672
- 1:23.982739409188408
- 0:72.7016330176871
- 1:24.15813876032298
- 0:72.69921791350811
- 1:24.158102347091965
- 0:72.60125718541295
- 1:23.739508350574084
- 0:72.50666704989243
- 1:23.333219126751594
- 0:72.41253287124782
- 1:22.926903337749174
- 0:72.31883641964504
- 1:22.52056460806495
- system:index:LC08_148044_20230115
- system:time_end:1673760787254
- system:time_start:1673760787254
"
],
"text/plain": [
""
]
},
"execution_count": 163,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"first_item\n",
"ee_object = geemap.gdf_to_ee(first_item)\n",
"image = dataset.toList(true_color_432.size()).get(1)\n",
"image = ee.Image(image)\n",
"image"
]
},
{
"cell_type": "code",
"execution_count": 232,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d5625c7aabcf4d92a42515ca045ef758",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[27.0, 72.0], controls=(WidgetControl(options=['position', 'transparent_bg'], widget=SearchDataGUI(…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import geemap\n",
"Map = geemap.Map(center=(27.0, 72.0), zoom=17)\n",
"\n",
"wmts_url = \"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/1.0.0\"\n",
"\n",
"Map.add_tile_layer(\"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/default028mm/MapServer/tile/56450/{z}/{y}/{x}\")\n",
"Map"
]
},
{
"cell_type": "code",
"execution_count": 249,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 249,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import geemap.foliumap as geemap\n",
"Map = geemap.Map(center=(27.0, 72.0), zoom=17)\n",
"\n",
"wmts_url = \"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/1.0.0\"\n",
"\n",
"Map.add_tile_layer(\"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/56450/{z}/{y}/{x}\")\n",
"Map"
]
},
{
"cell_type": "code",
"execution_count": 268,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ad7f77aad13a49ce9cc3518d296d1138",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[27.0, 72.0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import leafmap\n",
"Map = leafmap.Map(center=(27.0, 72.0), zoom=17)\n",
"Map.split_map(\"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/10/{z}/{y}/{x}\", \"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/56450/{z}/{y}/{x}\")\n",
"Map"
]
},
{
"cell_type": "code",
"execution_count": 277,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "67487913ce194912975217073b4e6912",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"GridspecLayout(children=(Output(layout=Layout(grid_area='widget001')), Output(layout=Layout(grid_area='widget0…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import leafmap.leafmap as leafmap\n",
"\n",
"layers = [\"ROADMAP\", \"HYBRID\"]\n",
"leafmap.linked_maps(rows=1, cols=2, height=\"400px\", layers=layers)"
]
},
{
"cell_type": "code",
"execution_count": 204,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import xml.etree.ElementTree as ET\n",
"import requests\n",
"\n",
"# WMTS capabilities URL\n",
"wmts_url = \"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/1.0.0/WMTSCapabilities.xml\"\n",
"\n",
"# Get the XML content\n",
"response = requests.get(wmts_url)\n",
"root = ET.fromstring(response.content)"
]
},
{
"cell_type": "code",
"execution_count": 208,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of layers: 175\n"
]
}
],
"source": [
"import xml.etree.ElementTree as ET\n",
"import requests\n",
"\n",
"# WMTS capabilities URL\n",
"wmts_url = \"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/1.0.0/WMTSCapabilities.xml\"\n",
"\n",
"# Fetch the XML content\n",
"response = requests.get(wmts_url)\n",
"root = ET.fromstring(response.content)\n",
"\n",
"# Define namespaces\n",
"namespace = {\n",
" 'wmts': 'https://www.opengis.net/wmts/1.0',\n",
" 'ows': 'https://www.opengis.net/ows/1.1'\n",
"}\n",
"\n",
"# Extract mapping of layer identifiers to their ResourceURL templates\n",
"layer_mapping = {}\n",
"\n",
"# Find all Layer elements\n",
"for layer in root.findall('.//wmts:Layer', namespace):\n",
" identifier = layer.find('ows:Identifier', namespace).text\n",
" title = layer.find('ows:Title', namespace).text\n",
" resource_url_elem = layer.find('wmts:ResourceURL', namespace)\n",
"\n",
" if resource_url_elem is not None:\n",
" resource_template = resource_url_elem.get('template')\n",
" layer_mapping[identifier] = {\n",
" 'title': title,\n",
" 'resource_template': resource_template\n",
" }\n",
"\n",
"# Display the extracted layer mapping\n",
"print(f\"Number of layers: {len(layer_mapping)}\")"
]
},
{
"cell_type": "code",
"execution_count": 240,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b822840dfb914ba7b3b96695f6def7f5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/175 [00:00, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from tqdm.notebook import tqdm\n",
"import re\n",
"map_dict = {}\n",
"for layer_id, details in tqdm(layer_mapping.items()):\n",
" # print(f\"Identifier: {layer_id}\")\n",
" # print(f\"Title: {details['title']}\")\n",
" # print(f\"Resource Template: {details['resource_template']}\")\n",
" date = re.findall(f\"World Imagery \\(Wayback (.*)\\)\", details['title'])[0]\n",
" url = details['resource_template']\n",
" url = url.replace(\"{TileMatrixSet}\", \"GoogleMapsCompatible\")\n",
" url = url.replace(\"{TileMatrix}\", \"{z}\")\n",
" url = url.replace(\"{TileRow}\", \"{y}\")\n",
" url = url.replace(\"{TileCol}\", \"{x}\")\n",
" map_dict[date] = url\n",
"\n",
"import json\n",
"with open(\"wayback_imagery.json\", \"w\") as f:\n",
" json.dump(map_dict, f)"
]
},
{
"cell_type": "code",
"execution_count": 264,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"{'2024-10-10': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/56450/{z}/{y}/{x}',\n",
" '2024-09-19': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/20337/{z}/{y}/{x}',\n",
" '2024-08-15': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/32553/{z}/{y}/{x}',\n",
" '2024-06-27': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/39767/{z}/{y}/{x}',\n",
" '2024-06-06': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/12428/{z}/{y}/{x}',\n",
" '2024-05-09': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/52930/{z}/{y}/{x}',\n",
" '2024-03-28': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/13968/{z}/{y}/{x}',\n",
" '2024-03-07': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/60013/{z}/{y}/{x}',\n",
" '2024-02-08': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/37965/{z}/{y}/{x}',\n",
" '2024-01-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/41468/{z}/{y}/{x}',\n",
" '2023-12-07': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/56102/{z}/{y}/{x}',\n",
" '2023-11-01': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/12457/{z}/{y}/{x}',\n",
" '2023-10-11': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/1034/{z}/{y}/{x}',\n",
" '2023-08-31': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/64776/{z}/{y}/{x}',\n",
" '2023-08-10': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/17632/{z}/{y}/{x}',\n",
" '2023-06-29': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/47963/{z}/{y}/{x}',\n",
" '2023-06-13': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/25982/{z}/{y}/{x}',\n",
" '2023-05-03': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/46399/{z}/{y}/{x}',\n",
" '2023-04-05': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/37890/{z}/{y}/{x}',\n",
" '2023-03-15': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/44873/{z}/{y}/{x}',\n",
" '2023-02-23': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/57965/{z}/{y}/{x}',\n",
" '2023-01-11': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11475/{z}/{y}/{x}',\n",
" '2022-12-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/45134/{z}/{y}/{x}',\n",
" '2022-11-02': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/7110/{z}/{y}/{x}',\n",
" '2022-10-12': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/44988/{z}/{y}/{x}',\n",
" '2022-09-21': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/47471/{z}/{y}/{x}',\n",
" '2022-08-31': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/45441/{z}/{y}/{x}',\n",
" '2022-08-10': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/17825/{z}/{y}/{x}',\n",
" '2022-07-20': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/13851/{z}/{y}/{x}',\n",
" '2022-06-29': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/4905/{z}/{y}/{x}',\n",
" '2022-06-08': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/44710/{z}/{y}/{x}',\n",
" '2022-05-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/5314/{z}/{y}/{x}',\n",
" '2022-04-27': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/16245/{z}/{y}/{x}',\n",
" '2022-04-06': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/48232/{z}/{y}/{x}',\n",
" '2022-03-16': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/10321/{z}/{y}/{x}',\n",
" '2022-02-24': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/10312/{z}/{y}/{x}',\n",
" '2022-02-02': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/26083/{z}/{y}/{x}',\n",
" '2022-01-12': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/42663/{z}/{y}/{x}',\n",
" '2021-12-21': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/26120/{z}/{y}/{x}',\n",
" '2021-11-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/48624/{z}/{y}/{x}',\n",
" '2021-11-03': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/42403/{z}/{y}/{x}',\n",
" '2021-10-13': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/16749/{z}/{y}/{x}',\n",
" '2021-09-22': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/51313/{z}/{y}/{x}',\n",
" '2021-09-01': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/47568/{z}/{y}/{x}',\n",
" '2021-08-11': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/51423/{z}/{y}/{x}',\n",
" '2021-07-21': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/8432/{z}/{y}/{x}',\n",
" '2021-06-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/13534/{z}/{y}/{x}',\n",
" '2021-06-09': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/48376/{z}/{y}/{x}',\n",
" '2021-05-19': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/15423/{z}/{y}/{x}',\n",
" '2021-04-28': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/27659/{z}/{y}/{x}',\n",
" '2021-04-08': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/6863/{z}/{y}/{x}',\n",
" '2021-03-17': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/5359/{z}/{y}/{x}',\n",
" '2021-02-24': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/9812/{z}/{y}/{x}',\n",
" '2021-01-13': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/1049/{z}/{y}/{x}',\n",
" '2020-12-16': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/29260/{z}/{y}/{x}',\n",
" '2020-11-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/20753/{z}/{y}/{x}',\n",
" '2020-10-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/119/{z}/{y}/{x}',\n",
" '2020-09-23': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/19187/{z}/{y}/{x}',\n",
" '2020-09-02': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/9181/{z}/{y}/{x}',\n",
" '2020-08-12': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/6049/{z}/{y}/{x}',\n",
" '2020-07-22': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/9549/{z}/{y}/{x}',\n",
" '2020-07-01': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/18289/{z}/{y}/{x}',\n",
" '2020-06-10': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11135/{z}/{y}/{x}',\n",
" '2020-05-20': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/32645/{z}/{y}/{x}',\n",
" '2020-04-29': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/15045/{z}/{y}/{x}',\n",
" '2020-04-08': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/26751/{z}/{y}/{x}',\n",
" '2020-03-23': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/16062/{z}/{y}/{x}',\n",
" '2020-02-20': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/8495/{z}/{y}/{x}',\n",
" '2020-01-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/21485/{z}/{y}/{x}',\n",
" '2020-01-08': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/23001/{z}/{y}/{x}',\n",
" '2019-12-12': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/4756/{z}/{y}/{x}',\n",
" '2019-10-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11060/{z}/{y}/{x}',\n",
" '2019-10-09': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11351/{z}/{y}/{x}',\n",
" '2019-09-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/9892/{z}/{y}/{x}',\n",
" '2019-08-28': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/30442/{z}/{y}/{x}',\n",
" '2019-08-07': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/17216/{z}/{y}/{x}',\n",
" '2019-07-17': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/16681/{z}/{y}/{x}',\n",
" '2019-06-26': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/645/{z}/{y}/{x}',\n",
" '2019-06-05': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/12576/{z}/{y}/{x}',\n",
" '2019-05-15': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/9598/{z}/{y}/{x}',\n",
" '2019-04-24': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/18063/{z}/{y}/{x}',\n",
" '2019-04-03': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/18691/{z}/{y}/{x}',\n",
" '2019-03-13': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/4383/{z}/{y}/{x}',\n",
" '2019-02-21': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/17677/{z}/{y}/{x}',\n",
" '2019-01-31': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/25944/{z}/{y}/{x}',\n",
" '2019-01-09': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/6036/{z}/{y}/{x}',\n",
" '2018-12-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/23448/{z}/{y}/{x}',\n",
" '2018-11-29': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/239/{z}/{y}/{x}',\n",
" '2018-11-07': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/3201/{z}/{y}/{x}',\n",
" '2018-10-17': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/18820/{z}/{y}/{x}',\n",
" '2018-09-26': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/14426/{z}/{y}/{x}',\n",
" '2018-09-06': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/2168/{z}/{y}/{x}',\n",
" '2018-08-15': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/1858/{z}/{y}/{x}',\n",
" '2018-07-25': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/14829/{z}/{y}/{x}',\n",
" '2018-06-27': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11334/{z}/{y}/{x}',\n",
" '2018-06-06': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/8249/{z}/{y}/{x}',\n",
" '2018-05-16': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/32337/{z}/{y}/{x}',\n",
" '2018-04-25': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/1296/{z}/{y}/{x}',\n",
" '2018-04-11': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/20399/{z}/{y}/{x}',\n",
" '2018-03-28': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/7072/{z}/{y}/{x}',\n",
" '2018-03-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/8255/{z}/{y}/{x}',\n",
" '2018-02-23': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/13067/{z}/{y}/{x}',\n",
" '2018-01-31': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/10768/{z}/{y}/{x}',\n",
" '2018-01-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/13045/{z}/{y}/{x}',\n",
" '2018-01-08': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/13161/{z}/{y}/{x}',\n",
" '2017-11-16': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/25521/{z}/{y}/{x}',\n",
" '2017-10-25': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/23264/{z}/{y}/{x}',\n",
" '2017-10-04': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/15212/{z}/{y}/{x}',\n",
" '2017-09-13': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/18358/{z}/{y}/{x}',\n",
" '2017-08-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/25379/{z}/{y}/{x}',\n",
" '2017-08-10': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/14035/{z}/{y}/{x}',\n",
" '2017-07-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/3319/{z}/{y}/{x}',\n",
" '2017-06-27': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/4073/{z}/{y}/{x}',\n",
" '2017-06-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/14765/{z}/{y}/{x}',\n",
" '2017-05-31': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/14342/{z}/{y}/{x}',\n",
" '2017-05-17': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/20365/{z}/{y}/{x}',\n",
" '2017-05-03': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/784/{z}/{y}/{x}',\n",
" '2017-04-19': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/1052/{z}/{y}/{x}',\n",
" '2017-03-29': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/5205/{z}/{y}/{x}',\n",
" '2017-03-15': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/29387/{z}/{y}/{x}',\n",
" '2017-02-27': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/31026/{z}/{y}/{x}',\n",
" '2017-02-08': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/27946/{z}/{y}/{x}',\n",
" '2017-01-25': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/9486/{z}/{y}/{x}',\n",
" '2017-01-11': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/577/{z}/{y}/{x}',\n",
" '2016-12-20': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/18966/{z}/{y}/{x}',\n",
" '2016-12-07': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/6678/{z}/{y}/{x}',\n",
" '2016-11-16': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/21750/{z}/{y}/{x}',\n",
" '2016-10-25': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/4222/{z}/{y}/{x}',\n",
" '2016-10-12': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/13770/{z}/{y}/{x}',\n",
" '2016-09-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/6984/{z}/{y}/{x}',\n",
" '2016-08-31': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/9175/{z}/{y}/{x}',\n",
" '2016-08-11': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/23601/{z}/{y}/{x}',\n",
" '2016-07-20': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/5097/{z}/{y}/{x}',\n",
" '2016-07-06': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/13240/{z}/{y}/{x}',\n",
" '2016-06-13': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11509/{z}/{y}/{x}',\n",
" '2016-05-11': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/8551/{z}/{y}/{x}',\n",
" '2016-04-28': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/5769/{z}/{y}/{x}',\n",
" '2016-04-20': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/388/{z}/{y}/{x}',\n",
" '2016-03-16': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/19085/{z}/{y}/{x}',\n",
" '2016-03-02': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/20443/{z}/{y}/{x}',\n",
" '2016-02-17': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11262/{z}/{y}/{x}',\n",
" '2016-02-04': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/6354/{z}/{y}/{x}',\n",
" '2016-01-13': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/3515/{z}/{y}/{x}',\n",
" '2015-12-16': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/28163/{z}/{y}/{x}',\n",
" '2015-11-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/8781/{z}/{y}/{x}',\n",
" '2015-10-28': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11092/{z}/{y}/{x}',\n",
" '2015-10-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/10850/{z}/{y}/{x}',\n",
" '2015-09-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/3630/{z}/{y}/{x}',\n",
" '2015-09-16': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/1431/{z}/{y}/{x}',\n",
" '2015-09-02': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/30584/{z}/{y}/{x}',\n",
" '2015-08-19': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/28219/{z}/{y}/{x}',\n",
" '2015-07-08': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/24007/{z}/{y}/{x}',\n",
" '2015-06-24': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11952/{z}/{y}/{x}',\n",
" '2015-05-13': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/19930/{z}/{y}/{x}',\n",
" '2015-04-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/23880/{z}/{y}/{x}',\n",
" '2015-04-15': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/9203/{z}/{y}/{x}',\n",
" '2015-03-25': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/2730/{z}/{y}/{x}',\n",
" '2015-03-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/15084/{z}/{y}/{x}',\n",
" '2015-02-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/10443/{z}/{y}/{x}',\n",
" '2015-01-21': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/20222/{z}/{y}/{x}',\n",
" '2014-12-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/5844/{z}/{y}/{x}',\n",
" '2014-12-18': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/14720/{z}/{y}/{x}',\n",
" '2014-12-03': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/23383/{z}/{y}/{x}',\n",
" '2014-11-12': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/30195/{z}/{y}/{x}',\n",
" '2014-10-29': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11019/{z}/{y}/{x}',\n",
" '2014-10-01': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/22692/{z}/{y}/{x}',\n",
" '2014-09-17': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/25586/{z}/{y}/{x}',\n",
" '2014-07-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/5232/{z}/{y}/{x}',\n",
" '2014-07-02': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/3026/{z}/{y}/{x}',\n",
" '2014-06-25': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/11033/{z}/{y}/{x}',\n",
" '2014-06-11': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/31144/{z}/{y}/{x}',\n",
" '2014-05-14': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/16513/{z}/{y}/{x}',\n",
" '2014-04-30': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/19819/{z}/{y}/{x}',\n",
" '2014-03-26': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/4230/{z}/{y}/{x}',\n",
" '2014-02-20': 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/WMTS/1.0.0/GoogleMapsCompatible/MapServer/tile/10/{z}/{y}/{x}'}"
]
},
"execution_count": 264,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"map_dict"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6a87c6af055444be8d9f304293e5287f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"GridspecLayout(children=(Output(layout=Layout(grid_area='widget001')), Output(layout=Layout(grid_area='widget0…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import leafmap.leafmap as leafmap\n",
"\n",
"layers = [\"Esri.WorldTopoMap\", \"OpenTopoMap\"]\n",
"leafmap.linked_maps(rows=1, cols=2, height=\"400px\", layers=layers)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1ce50feee5594597a06e1de0b80600b1",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[45.8107, 8.6288], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoo…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from ipyleaflet import Map, TileLayer, WidgetControl\n",
"from ipywidgets import SelectionSlider\n",
"\n",
"# Prepare a slider widget to navigate the version history of the basemap\n",
"# There doesn't seem to be any pattern between timeId and basemap date, so just a few couples manually extracted from\n",
"# https://wayback.maptiles.arcgis.com/arcgis/rest/services/world_imagery/mapserver/wmts/1.0.0/wmtscapabilities.xml\n",
"date_timeId_mapping = [('2016-01-13', 3515),\n",
" ('2017-01-11', 577),\n",
" ('2018-01-08', 13161),\n",
" ('2019-01-09', 6036),\n",
" ('2020-01-08', 23001),\n",
" ('2021-01-13', 1049),\n",
" ('2022-01-12', 42663),\n",
" ('2023-01-11', 11475)]\n",
"\n",
"# Date slider widget\n",
"wayback_slider = SelectionSlider(\n",
" options=date_timeId_mapping,\n",
" value=3515,\n",
" description='Date',\n",
" disabled=False,\n",
" continuous_update=True,\n",
" orientation='horizontal',\n",
" readout=True\n",
")\n",
"time_control = WidgetControl(widget=wayback_slider, position='topright')\n",
"\n",
"# Connect tile layer (wayback, not yet defined) with slider value\n",
"def on_date_change(*args):\n",
" wayback.url = 'https://wayback.maptiles.arcgis.com/arcgis/rest/services/world_imagery/wmts/1.0.0/default028mm/mapserver/tile/%d/{z}/{y}/{x}' % wayback_slider.value\n",
" wayback.redraw()\n",
" \n",
"wayback_slider.observe(on_date_change, 'value')\n",
"\n",
"# Prepare map, tilelayer and draw it\n",
"m = Map(center=(45.8107, 8.6288), zoom=16, scroll_wheel_zoom=True)\n",
"wayback = TileLayer(url='https://wayback.maptiles.arcgis.com/arcgis/rest/services/world_imagery/wmts/1.0.0/default028mm/mapserver/tile/3515/{z}/{y}/{x}')\n",
"m.add_layer(wayback)\n",
"m.add_control(time_control)\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "zeel_py310",
"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.10.15"
}
},
"nbformat": 4,
"nbformat_minor": 2
}