{ "cells": [ { "cell_type": "markdown", "id": "fb3b7263-bc04-4d6d-93d3-055d8f912c2f", "metadata": {}, "source": [ "# ESMAP\n", "\n", "The [Energy Sector Management Assistance Program (ESMAP)](http://www.esmap.org/) is an energy assistance program administered by the World Bank. The program aims to support low- and middle-income countries to achieve environmentally sustainable energy solutions. This is achieved through numerous initiatives, which include renewable energy resource mapping.\n", "\n", "Outcomes of the program include the [Global Solar Atlas](https://globalsolaratlas.info), a series of maps of annual irradiance covering the entire world.\n", "\n", "Additionally, ESMAP has also commissioned several short-term in-situ measurement campaigns of irradiance in Africa and Asia. These campaigns include both Tier 1 and 2 stations and typically have a duration of 1-2 years. The data from these campaigns are freely available at https://energydata.info." ] }, { "cell_type": "code", "execution_count": 6, "id": "997aff4b-4e41-4538-a335-4d2168505991", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "remove-cell" ] }, "outputs": [ { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import pandas as pd\n", "from itables import init_notebook_mode, show\n", "init_notebook_mode(all_interactive=True)\n", "\n", "# Load stations\n", "solarstations = pd.read_csv('../solarstations.csv', dtype={'Tier': str}).fillna('')\n", "esmap_stations = pd.read_csv('../esmap_stations.csv', dtype={'Tier': str}).fillna('')\n", "stations = pd.concat([solarstations, esmap_stations], axis='rows', ignore_index=True)\n", "\n", "stations = stations[stations['Network'].str.contains('ESMAP')].reset_index()" ] }, { "cell_type": "code", "execution_count": 17, "id": "6922dc1e-0cb4-4ac3-b4ba-d0928d78cfd5", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "remove-input" ] }, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import folium\n", "from folium import plugins\n", "import folium_legend\n", "\n", "EsriImagery = \"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}\"\n", "EsriAttribution = \"Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community\"\n", "\n", "# Create Folium map\n", "m = folium.Map(\n", " location=[10, 45],\n", " zoom_start=3, min_zoom=1, max_bounds=True,\n", " control_scale=True, # Adds distance scale in lower left corner\n", " tiles='openstreetmap',\n", ")\n", "\n", "def station_status(time_period):\n", " if time_period.endswith('-'):\n", " return 'Active'\n", " color = '#008000' # Green for active stations\n", " elif (time_period == '') | time_period.endswith('?'):\n", " return 'Unknown'\n", " else:\n", " return 'Inactive'\n", "\n", "stations['Status'] = stations['Time period'].map(station_status)\n", "\n", "status_dict = {\n", " 'Active': '#008000', # Green for active stations\n", " 'Unknown': '#3186cc', # Blue for stations with unknown status\n", " 'Inactive': '#ff422b', # Red for inactive stations\n", "}\n", "\n", "stations['Color'] = stations['Status'].map(status_dict)\n", "\n", "# Add each station to the map\n", "for index, row in stations.iterrows():\n", " folium.CircleMarker(\n", " location=[row['Latitude'], row['Longitude']],\n", " popup=row['Station full name'] + ' - ' + str(row['State']) + ' ' + row['Country'],\n", " tooltip=row['Abbreviation'],\n", " radius=5, color=row['Color'],\n", " fill_color=row['Color'], fill=True).add_to(m)\n", "\n", "folium.raster_layers.TileLayer(EsriImagery, name='World imagery', attr=EsriAttribution, show=False).add_to(m)\n", "folium.LayerControl(position='topright').add_to(m)\n", "\n", "# Additional options and plugins\n", "# Note it's not possible to change the position of the scale\n", "#plugins.MiniMap(toggle_display=True, zoom_level_fixed=3, minimized=True, position='bottomright').add_to(m) # Add minimap to the map\n", "plugins.Fullscreen(position='bottomright').add_to(m) # Add full screen button to map\n", "folium.LatLngPopup().add_to(m) # Show latitude/longitude when clicking on the map\n", "# plugins.LocateControl(position='topright').add_to(m) # Add button for your position\n", "# plugins.MeasureControl(position='topleft').add_to(m) # Add distance length measurement tool\n", "\n", "# Create legend\n", "legend = folium_legend.make_legend(status_dict.keys(), status_dict.values(), title=\"Station status\")\n", "m.get_root().html.add_child(legend) # Add Legend to map\n", "\n", "# Show the map\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "cb0082ae-6a8e-4bce-abd1-e40ae168bf1d", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.4" } }, "nbformat": 4, "nbformat_minor": 5 }