{ "cells": [ { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "# Station catalog\n", "\n", "This site provides an overview of available solar irradiance monitoring stations worldwide and metadata of the stations.\n", "The metadata fields are further described in the [metadata](station_metadata) section.\n", "\n", "The table is also available to download in CSV form: {download}`SolarStationsOrg-station-catalog.csv`" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "editable": true, "scrolled": true, "slideshow": { "slide_type": "" }, "tags": [ "full-width", "remove-input" ] }, "outputs": [ { "data": { "text/html": [ "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", "\n", "\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", " \n", "\n", "\n", "\n", "\n", "
Station nameAbbreviationStateCountryContinentLatitudeLongitudeElevationTime periodNetworkOwnerCommentData availabilityInstrumentationKoeppen Geiger classificationKoeppen Geiger climate zoneTierGHI_typical_kWh_m2DHI_typical_kWh_m2DNI_typical_kWh_m2
\n", "\n", "
\n", "Loading ITables v2.2.2 from the init_notebook_mode cell...\n", "(need help?)
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import pandas as pd\n", "import numpy as np\n", "import json\n", "import kgcpy\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('../data/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: kgcpy.lookupCZ(x['Latitude'], x['Longitude']), axis=1)\n", "kg_climates = {'A': 'Tropical', 'B': 'Dry', 'C': 'Temperate', 'D': 'Continental', 'E': 'Polar', 'O': 'Ocean'}\n", "stations['Koeppen Geiger climate zone'] = stations['Koeppen Geiger classification'].apply(lambda x: kg_climates[x[0]])\n", "\n", "instrumentation = stations['Instrumentation'].str.split(';', expand=True)\n", "is_tier_1 = (instrumentation=='G').any(axis=1) & (instrumentation=='B').any(axis=1) & (instrumentation=='D').any(axis=1)\n", "stations['Tier'] = 2 - is_tier_1.astype(int)\n", "\n", "annual_irradiance = pd.read_csv('../data/nasa_power_annual_irradiance_global.csv', index_col=[0, 1])\n", "for index, row in stations.iterrows():\n", " lat_round = round(row['Latitude']*2-0.5, 0)/2 + 0.25\n", " lon_round = round(row['Longitude']*2-0.5, 0)/2 + 0.25\n", " try:\n", " stations.loc[index, ['GHI_typical_kWh_m2', 'DHI_typical_kWh_m2', 'DNI_typical_kWh_m2']] = \\\n", " annual_irradiance.loc[(lat_round, lon_round), :]\n", " except KeyError as e:\n", " pass\n", " # Manual add data missing from the climatological file (data retrieved from NASA's webinterface)\n", " if row['Station name'] == 'Funafuti':\n", " stations.loc[index, ['GHI_typical_kWh_m2', 'DHI_typical_kWh_m2', 'DNI_typical_kWh_m2']] = \\\n", " np.array([5.33*365, 2.12*365, 4.37*365]).astype(int)\n", " if row['Station name'] == 'South Pole':\n", " stations.loc[index, ['GHI_typical_kWh_m2', 'DHI_typical_kWh_m2', 'DNI_typical_kWh_m2']] = \\\n", " np.array([3.0*365, 1.38*365, 5.13*365]).astype(int)\n", "\n", "stations = stations[~stations['Instrumentation'].str.contains('G;Ds')] # remove Tier 3 stations\n", "\n", "stations = stations.sort_values('Station name', ignore_index=True)\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 name'] = f'{row[\"Station 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.12.7" } }, "nbformat": 4, "nbformat_minor": 4 }