Spaces:
Sleeping
Sleeping
Commit
·
773572e
1
Parent(s):
e048ea0
Upload gee_interactive_map.ipynb
Browse files
notebooks/gee_interactive_map.ipynb
CHANGED
@@ -1,13 +1,5 @@
|
|
1 |
{
|
2 |
"cells": [
|
3 |
-
{
|
4 |
-
"attachments": {},
|
5 |
-
"cell_type": "markdown",
|
6 |
-
"metadata": {},
|
7 |
-
"source": [
|
8 |
-
"# Cargar TerraClimate y geometria de México"
|
9 |
-
]
|
10 |
-
},
|
11 |
{
|
12 |
"cell_type": "code",
|
13 |
"execution_count": 1,
|
@@ -63,23 +55,6 @@
|
|
63 |
"# Etiquetar date_month y date_year como prop de la imagen\n",
|
64 |
"img_coll_pdsi_tag_month_year = img_coll_pdsi.map(create_month_year)#.map(lambda img: img.clip(geom_mexico))\n",
|
65 |
"\n",
|
66 |
-
"\"\"\"\n",
|
67 |
-
"# Crear una ImageCollection con n Images de a 12 bandas cada una.\n",
|
68 |
-
"# n -> numero de años que tenga la ImageCollection\n",
|
69 |
-
"# 12 bandas -> 1 banda = 1 mes\n",
|
70 |
-
"list_new_collection_by_year = ee.List.sequence(img_coll_start_year, img_coll_end_year)\\\n",
|
71 |
-
" .map(\n",
|
72 |
-
" lambda element: img_coll_pdsi_tag_month_year\\\n",
|
73 |
-
" .filter(ee.Filter.eq(\"date_year\", element))\\\n",
|
74 |
-
" .toBands()\\\n",
|
75 |
-
" .set({\"date_year\": element})\\\n",
|
76 |
-
" .rename(list(map(lambda x: '0'+str(x) if x <=9 else str(x), range(1,13))))\n",
|
77 |
-
" )\n",
|
78 |
-
"\n",
|
79 |
-
"final_data_img_coll = ee.ImageCollection.fromImages(list_new_collection_by_year)\n",
|
80 |
-
"img_coll_2_geemap = final_data_img_coll.toBands()\"\"\"\n",
|
81 |
-
"\n",
|
82 |
-
"\n",
|
83 |
"labels_dates = list()\n",
|
84 |
"for year in range(1958,2023):\n",
|
85 |
" for month in list(map(lambda x: '0'+str(x) if x <= 9 else str(x), range(1,13))):\n",
|
@@ -88,8 +63,7 @@
|
|
88 |
"\n",
|
89 |
"mapVisParamsPDSI = dict(min = -5, max = 5, palette = [\"FB322C\", \"FFFFFF\", \"039DAB\"])\n",
|
90 |
"\n",
|
91 |
-
"\n",
|
92 |
-
"Mapa = geemap.Map(basemap = \"CartoDB.DarkMatter\")\n",
|
93 |
"Mapa.center_object(geom_mexico, 5)\n",
|
94 |
"Mapa.add_time_slider(img_coll_pdsi_tag_month_year, mapVisParamsPDSI,\n",
|
95 |
" layer_name = \"Índice de Severidad de Sequía de Palmer\",\n",
|
|
|
1 |
{
|
2 |
"cells": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
"execution_count": 1,
|
|
|
55 |
"# Etiquetar date_month y date_year como prop de la imagen\n",
|
56 |
"img_coll_pdsi_tag_month_year = img_coll_pdsi.map(create_month_year)#.map(lambda img: img.clip(geom_mexico))\n",
|
57 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
"labels_dates = list()\n",
|
59 |
"for year in range(1958,2023):\n",
|
60 |
" for month in list(map(lambda x: '0'+str(x) if x <= 9 else str(x), range(1,13))):\n",
|
|
|
63 |
"\n",
|
64 |
"mapVisParamsPDSI = dict(min = -5, max = 5, palette = [\"FB322C\", \"FFFFFF\", \"039DAB\"])\n",
|
65 |
"\n",
|
66 |
+
"Mapa = geemap.Map(center=(22, -100), zoom=4, height='800px', basemap = \"CartoDB.DarkMatter\")\n",
|
|
|
67 |
"Mapa.center_object(geom_mexico, 5)\n",
|
68 |
"Mapa.add_time_slider(img_coll_pdsi_tag_month_year, mapVisParamsPDSI,\n",
|
69 |
" layer_name = \"Índice de Severidad de Sequía de Palmer\",\n",
|