diff --git a/source/index.rst b/source/index.rst index f4d8bd8..4374b11 100644 --- a/source/index.rst +++ b/source/index.rst @@ -57,3 +57,4 @@ This project uses many open-source software packages, including: pages/tmy-vs-single pages/numerical-precision pages/2300-artifact + pages/variables diff --git a/source/pages/variables.ipynb b/source/pages/variables.ipynb new file mode 100644 index 0000000..a31fa8d --- /dev/null +++ b/source/pages/variables.ipynb @@ -0,0 +1,389 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "341b7567-ade5-47fb-9798-7f45c7e19b59", + "metadata": {}, + "source": [ + "# Variables\n", + "\n", + "This page documents several aspects of the variables available via the PSM3 API endpoints, including:\n", + "\n", + "- What variables are available at each endpoint?\n", + "- What are the request and response names for each variable?\n", + "- What units are the variable values in?" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "e8049d34-b90c-4f8f-ae9e-76458ff334c0", + "metadata": {}, + "outputs": [], + "source": [ + "import pvlib\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "3ed5de9c-d935-4989-b5b0-a47b77261611", + "metadata": {}, + "outputs": [], + "source": [ + "cases = [('TMY', 'tmy', 60), ('Hourly', 2020, 60), ('5-minute', 2020, 5)]" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "63a7dda0-9ae0-49af-926d-d68335311a60", + "metadata": {}, + "outputs": [], + "source": [ + "units = {}\n", + "presence = {}\n", + "for label, dataset, interval in cases:\n", + " df, meta = pvlib.iotools.get_psm3(40, -80, 'DEMO_KEY', 'assessingsolar@gmail.com',\n", + " names=dataset, interval=interval,\n", + " attributes=[], # a trick to get all variables\n", + " map_variables=False, leap_day=True)\n", + " columns = df.columns[5:] # drop timestamp columns\n", + " for column in columns:\n", + " units[column] = meta.get(column + \" Units\", \"?\")\n", + " presence[label] = {column: '✓' for column in columns}" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "d40ddf73-86a5-4442-9156-fe837308879b", + "metadata": {}, + "outputs": [], + "source": [ + "# TODO: once pvlib 0.9.5 is released with pvlib #1648,\n", + "# determine this mapping dynamically instead of hardcoding it\n", + "\n", + "column_map = {\n", + " 'Clearsky DHI': 'clearsky_dhi',\n", + " 'Clearsky DNI': 'clearsky_dni',\n", + " 'Clearsky GHI': 'clearsky_ghi',\n", + " 'Cloud Type': 'cloud_type',\n", + " 'DHI': 'dhi',\n", + " 'DNI': 'dni',\n", + " 'Dew Point': 'dew_point',\n", + " 'Fill Flag': 'fill_flag',\n", + " 'GHI': 'ghi',\n", + " 'Global Horizontal UV Irradiance (280-400nm)': 'ghuv-280-400',\n", + " 'Global Horizontal UV Irradiance (295-385nm)': 'ghuv-295-385',\n", + " 'Precipitable Water': 'total_precipitable_water',\n", + " 'Pressure': 'surface_pressure',\n", + " 'Relative Humidity': 'relative_humidity',\n", + " 'Solar Zenith Angle': 'solar_zenith_angle',\n", + " 'Surface Albedo': 'surface_albedo',\n", + " 'Temperature': 'air_temperature',\n", + " 'Wind Direction': 'wind_direction',\n", + " 'Wind Speed': 'wind_speed'\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "f2439f4a-ff3e-4d63-9dd2-621e4119de6a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " | Response Name | \n", + "Request Name | \n", + "Units | \n", + "TMY | \n", + "Hourly | \n", + "5-minute | \n", + "
---|---|---|---|---|---|---|
0 | \n", + "Dew Point | \n", + "dew_point | \n", + "c | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
1 | \n", + "DHI | \n", + "dhi | \n", + "w/m2 | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
2 | \n", + "DNI | \n", + "dni | \n", + "w/m2 | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
3 | \n", + "GHI | \n", + "ghi | \n", + "w/m2 | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
4 | \n", + "Surface Albedo | \n", + "surface_albedo | \n", + "N/A | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
5 | \n", + "Pressure | \n", + "surface_pressure | \n", + "mbar | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
6 | \n", + "Temperature | \n", + "air_temperature | \n", + "c | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
7 | \n", + "Wind Direction | \n", + "wind_direction | \n", + "Degrees | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
8 | \n", + "Wind Speed | \n", + "wind_speed | \n", + "m/s | \n", + "✓ | \n", + "✓ | \n", + "✓ | \n", + "
9 | \n", + "Clearsky DHI | \n", + "clearsky_dhi | \n", + "w/m2 | \n", + "\n", + " | ✓ | \n", + "✓ | \n", + "
10 | \n", + "Clearsky DNI | \n", + "clearsky_dni | \n", + "w/m2 | \n", + "\n", + " | ✓ | \n", + "✓ | \n", + "
11 | \n", + "Clearsky GHI | \n", + "clearsky_ghi | \n", + "w/m2 | \n", + "\n", + " | ✓ | \n", + "✓ | \n", + "
12 | \n", + "Cloud Type | \n", + "cloud_type | \n", + "? | \n", + "\n", + " | ✓ | \n", + "✓ | \n", + "
13 | \n", + "Fill Flag | \n", + "fill_flag | \n", + "? | \n", + "\n", + " | ✓ | \n", + "✓ | \n", + "
14 | \n", + "Relative Humidity | \n", + "relative_humidity | \n", + "% | \n", + "\n", + " | ✓ | \n", + "✓ | \n", + "
15 | \n", + "Solar Zenith Angle | \n", + "solar_zenith_angle | \n", + "Degree | \n", + "\n", + " | ✓ | \n", + "✓ | \n", + "
16 | \n", + "Precipitable Water | \n", + "total_precipitable_water | \n", + "cm | \n", + "\n", + " | ✓ | \n", + "✓ | \n", + "
17 | \n", + "Global Horizontal UV Irradiance (280-400nm) | \n", + "ghuv-280-400 | \n", + "? | \n", + "\n", + " | ✓ | \n", + "\n", + " |
18 | \n", + "Global Horizontal UV Irradiance (295-385nm) | \n", + "ghuv-295-385 | \n", + "? | \n", + "\n", + " | ✓ | \n", + "\n", + " |