{ "cells": [ { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "# Station catalog\n", "\n", "This site provides an overview of available solar radiation monitoring stations worldwide and metadata of the stations.\n", "\n", "The table is also available to download in CSV form: {download}`SolarStationsOrg-station-catalog.csv`" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "editable": true, "scrolled": true, "slideshow": { "slide_type": "" }, "tags": [ "full-width", "remove-input" ] }, "outputs": [ { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "
Station full nameAbbreviationStateCountryContinentLatitudeLongitudeElevationTime periodNetworkOwnerCommentData availabilityTierInstrumentComponentsKoeppen Geiger classificationKoeppen Geiger climate zone
Loading... (need help?)
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import pandas as pd\n", "import json\n", "import kgcPy2\n", "from unidecode import unidecode\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", "with open('../country_by_continent.json') as f:\n", " country_by_continent = json.load(f)\n", "\n", "stations['Continent'] = stations['Country'].map(country_by_continent)\n", "\n", "stations['Koeppen Geiger classification'] = stations.apply(lambda x: kgcPy2.lookupCZ(x['Latitude'], x['Longitude']), axis=1)\n", "\n", "kg_climates = {'A': 'Tropical', 'B': 'Dry', 'C': 'Temperate', 'D': 'Continental', 'E': 'Polar', 'O': 'Ocean'}\n", "\n", "stations['Koeppen Geiger climate zone'] = stations['Koeppen Geiger classification'].apply(lambda x: kg_climates[x[0]])\n", "\n", "# Write file containing all columns, linked to above\n", "stations.to_csv('./SolarStationsOrg-station-catalog.csv', index=False)\n", "\n", "# Format station name as hyperlinks if URL is available.\n", "# Do this after the new CSV is written, since we don't want HTML in that.\n", "for index, row in stations.iterrows():\n", " if row['URL'].startswith('http'):\n", " stations.loc[index, 'Station full name'] = f'{row[\"Station full name\"]}'\n", "\n", "del stations['URL'] # Remove the URL column to avoid cluttering the site\n", "\n", "# Reorder station columns\n", "old_column_order = list(stations.columns)\n", "old_column_order.remove('Continent')\n", "new_column_order = old_column_order[:4] + ['Continent'] + old_column_order[4:]\n", "stations = stations[new_column_order]\n", "\n", "# Show table with stations (all rows)\n", "show(stations, scrollY=\"700px\", scrollX=True, scrollCollapse=True, paging=False, classes=\"display\", order=[[0, \"asc\"]],\n", " columnDefs=[{\"className\": \"dt-left\", \"targets\": \"_all\"}], maxBytes=0,\n", ")" ] }, { "cell_type": "code", "execution_count": null, "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": 4 }