|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Modelling sun and sky irradiance" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "markdown", |
| 12 | + "metadata": {}, |
| 13 | + "source": [ |
| 14 | + "- This notebook explain how to use astk functions to simulate the natural lighting of a scenesky irradiance for diiferent conditions.\n" |
| 15 | + ] |
| 16 | + }, |
| 17 | + { |
| 18 | + "cell_type": "markdown", |
| 19 | + "metadata": {}, |
| 20 | + "source": [ |
| 21 | + "## Conventions" |
| 22 | + ] |
| 23 | + }, |
| 24 | + { |
| 25 | + "cell_type": "markdown", |
| 26 | + "metadata": {}, |
| 27 | + "source": [ |
| 28 | + " - Radiation fluxes are expressed in terms of irradiance of a horizontal unit placed at earth surface(total energetic flux passing through a square meter of ground). \n", |
| 29 | + " - The standard measurement of radiation at earth surface is the global horizontal irradiance (ghi, W.m-2 i.e. J.m-2.s-1), that captures radiations coming from the sun and from the sky in the shortwave domain (visible light)\n", |
| 30 | + " - The sun contribution is called direct normal irradiance (dni), whereas sky contribution is called diffuse horizontal irradiance (dhi)" |
| 31 | + ] |
| 32 | + }, |
| 33 | + { |
| 34 | + "cell_type": "markdown", |
| 35 | + "metadata": {}, |
| 36 | + "source": [ |
| 37 | + "## Imports and setup location" |
| 38 | + ] |
| 39 | + }, |
| 40 | + { |
| 41 | + "cell_type": "code", |
| 42 | + "execution_count": null, |
| 43 | + "metadata": { |
| 44 | + "scrolled": true |
| 45 | + }, |
| 46 | + "outputs": [], |
| 47 | + "source": [ |
| 48 | + "from openalea.astk.data_access import montpellier_spring_2013\n", |
| 49 | + "from openalea.astk.meteorology.sky_irradiance import sky_irradiance" |
| 50 | + ] |
| 51 | + }, |
| 52 | + { |
| 53 | + "cell_type": "markdown", |
| 54 | + "metadata": {}, |
| 55 | + "source": [ |
| 56 | + "Specify a location on earth:" |
| 57 | + ] |
| 58 | + }, |
| 59 | + { |
| 60 | + "cell_type": "code", |
| 61 | + "execution_count": null, |
| 62 | + "metadata": {}, |
| 63 | + "outputs": [], |
| 64 | + "source": [ |
| 65 | + "Montpellier ={\n", |
| 66 | + "'longitude': 3.87,\n", |
| 67 | + "'latitude': 43.61,\n", |
| 68 | + "'altitude': 56,\n", |
| 69 | + "'timezone': 'Europe/Paris'}" |
| 70 | + ] |
| 71 | + }, |
| 72 | + { |
| 73 | + "cell_type": "markdown", |
| 74 | + "metadata": {}, |
| 75 | + "source": [ |
| 76 | + "## Simulating clear sky conditions" |
| 77 | + ] |
| 78 | + }, |
| 79 | + { |
| 80 | + "cell_type": "code", |
| 81 | + "execution_count": null, |
| 82 | + "metadata": {}, |
| 83 | + "outputs": [], |
| 84 | + "source": [ |
| 85 | + " sky_irr = sky_irradiance(daydate='2000-06-21', **Montpellier)\n", |
| 86 | + " sky_irr" |
| 87 | + ] |
| 88 | + }, |
| 89 | + { |
| 90 | + "cell_type": "markdown", |
| 91 | + "metadata": {}, |
| 92 | + "source": [ |
| 93 | + "## Simulating cloudy conditions" |
| 94 | + ] |
| 95 | + }, |
| 96 | + { |
| 97 | + "cell_type": "code", |
| 98 | + "execution_count": null, |
| 99 | + "metadata": {}, |
| 100 | + "outputs": [], |
| 101 | + "source": [ |
| 102 | + " sky_irr = sky_irradiance(daydate='2000-06-21', attenuation=0.2,**Montpellier)\n", |
| 103 | + " sky_irr" |
| 104 | + ] |
| 105 | + }, |
| 106 | + { |
| 107 | + "cell_type": "markdown", |
| 108 | + "metadata": {}, |
| 109 | + "source": [ |
| 110 | + "## Simulating actual irradiances" |
| 111 | + ] |
| 112 | + }, |
| 113 | + { |
| 114 | + "cell_type": "markdown", |
| 115 | + "metadata": {}, |
| 116 | + "source": [ |
| 117 | + "In general, meteorological conditions are between overcast and clear sky conditions. The cursor between theses two extremes is a function of the ratio between actual irradiance (measured) and clear sky irradiance. " |
| 118 | + ] |
| 119 | + }, |
| 120 | + { |
| 121 | + "cell_type": "markdown", |
| 122 | + "metadata": {}, |
| 123 | + "source": [ |
| 124 | + "get some meteorological data" |
| 125 | + ] |
| 126 | + }, |
| 127 | + { |
| 128 | + "cell_type": "code", |
| 129 | + "execution_count": null, |
| 130 | + "metadata": { |
| 131 | + "scrolled": true |
| 132 | + }, |
| 133 | + "outputs": [], |
| 134 | + "source": [ |
| 135 | + "meteo_db = montpellier_spring_2013()" |
| 136 | + ] |
| 137 | + }, |
| 138 | + { |
| 139 | + "cell_type": "code", |
| 140 | + "execution_count": null, |
| 141 | + "metadata": { |
| 142 | + "scrolled": true |
| 143 | + }, |
| 144 | + "outputs": [], |
| 145 | + "source": [ |
| 146 | + "import pandas\n", |
| 147 | + "when = pandas.date_range(start='2013-05-26', freq='h', periods=25,\n", |
| 148 | + " tz='Europe/Paris')\n", |
| 149 | + "observed = meteo_db.loc[when,'ghi']\n", |
| 150 | + "observed" |
| 151 | + ] |
| 152 | + }, |
| 153 | + { |
| 154 | + "cell_type": "code", |
| 155 | + "execution_count": null, |
| 156 | + "metadata": {}, |
| 157 | + "outputs": [], |
| 158 | + "source": [ |
| 159 | + "sky_irr = sky_irradiance(dates=observed.index, ghi=observed)\n", |
| 160 | + "sky_irr" |
| 161 | + ] |
| 162 | + } |
| 163 | + ], |
| 164 | + "metadata": { |
| 165 | + "kernelspec": { |
| 166 | + "display_name": "Python 3 (ipykernel)", |
| 167 | + "language": "python", |
| 168 | + "name": "python3" |
| 169 | + }, |
| 170 | + "language_info": { |
| 171 | + "codemirror_mode": { |
| 172 | + "name": "ipython", |
| 173 | + "version": 3 |
| 174 | + }, |
| 175 | + "file_extension": ".py", |
| 176 | + "mimetype": "text/x-python", |
| 177 | + "name": "python", |
| 178 | + "nbconvert_exporter": "python", |
| 179 | + "pygments_lexer": "ipython3", |
| 180 | + "version": "3.12.3" |
| 181 | + }, |
| 182 | + "widgets": { |
| 183 | + "application/vnd.jupyter.widget-state+json": { |
| 184 | + "state": {}, |
| 185 | + "version_major": 2, |
| 186 | + "version_minor": 0 |
| 187 | + } |
| 188 | + } |
| 189 | + }, |
| 190 | + "nbformat": 4, |
| 191 | + "nbformat_minor": 4 |
| 192 | +} |
0 commit comments