Skip to content

Commit 13dc6f2

Browse files
Merge pull request #58 from Disasters-Learning-Portal/updateEVENTnotebook
update notebook
2 parents c3d056b + 16bf1c5 commit 13dc6f2

File tree

1 file changed

+5
-40
lines changed

1 file changed

+5
-40
lines changed

Jupyterhub/extract_eventname_metadata.ipynb

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@
6868
},
6969
{
7070
"cell_type": "code",
71-
"execution_count": 9,
71+
"execution_count": 31,
7272
"metadata": {},
7373
"outputs": [],
7474
"source": [
75-
"HAZARD = None\n",
76-
"LOCATION = None"
75+
"HAZARD = None #Can be a python list or None\n",
76+
"LOCATION = None #Can be a python list or None"
7777
]
7878
},
7979
{
@@ -83,41 +83,6 @@
8383
"## Import Libraries"
8484
]
8585
},
86-
{
87-
"cell_type": "markdown",
88-
"metadata": {},
89-
"source": [
90-
"## Required Libraries\n",
91-
"\n",
92-
"Before running this notebook, install the required Python libraries:\n",
93-
"\n",
94-
"```bash\n",
95-
"# Install core dependencies\n",
96-
"pip install boto3 rasterio\n",
97-
"\n",
98-
"# Install GDAL (required for COG operations)\n",
99-
"# On macOS with Homebrew:\n",
100-
"brew install gdal\n",
101-
"pip install gdal\n",
102-
"\n",
103-
"# On Ubuntu/Debian:\n",
104-
"sudo apt-get install gdal-bin libgdal-dev\n",
105-
"pip install gdal==$(gdal-config --version)\n",
106-
"\n",
107-
"# On conda:\n",
108-
"conda install -c conda-forge gdal\n",
109-
"\n",
110-
"# Install rio-cogeo for COG validation\n",
111-
"pip install rio-cogeo\n",
112-
"```\n",
113-
"\n",
114-
"**Note:** GDAL can be tricky to install. If you encounter issues, use conda instead of pip for all geospatial libraries:\n",
115-
"\n",
116-
"```bash\n",
117-
"conda install -c conda-forge boto3 rasterio gdal rio-cogeo\n",
118-
"```"
119-
]
120-
},
12186
{
12287
"cell_type": "code",
12388
"execution_count": 10,
@@ -391,8 +356,8 @@
391356
" tags = {\n",
392357
" 'ACTIVATION_EVENT': f\"{event_metadata['year_month']}_{event_metadata['hazard']}_{event_metadata['location']}\",\n",
393358
" 'YEAR_MONTH': event_metadata['year_month'],\n",
394-
" 'HAZARD': HAZARD if HAZARD is not None else event_metadata['hazard'],\n",
395-
" 'LOCATION': LOCATION if LOCATION is not None else event_metadata['location'],\n",
359+
" 'HAZARD': ','.join(HAZARD) if isinstance(HAZARD, list) else (HAZARD or event_metadata['hazard']),\n",
360+
" 'LOCATION': ','.join(LOCATION) if isinstance(LOCATION, list) else (LOCATION or event_metadata['location']),\n",
396361
" 'PROCESSING_DATE': datetime.utcnow().isoformat(),\n",
397362
" 'PROCESSOR': 'S3 GeoTIFF COG Processor v1.0'\n",
398363
" }\n",

0 commit comments

Comments
 (0)