{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Calculating Weighting Functions\n", "\n", "In this example we calculate weighting functions for ozone using SASKTRAN-Disco. Refer to SASKTRAN-Disco's documentation page for more documentation." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import numpy as np\n", "import sasktran as sk\n", "import sasktran.disco.interface as do\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Setup the sk.Geometry\n", "geometry = sk.NadirGeometry()\n", "\n", "tempo = sk.Geodetic()\n", "tempo.from_lat_lon_alt(0, -100, 35786000)\n", "\n", "geometry.from_lat_lon(lats=52.131638, lons=-106.633873, elevations=0,\n", " mjd=57906.843, observer=tempo\n", ")\n", "\n", "# Setup the sk.Atmosphere\n", "atmosphere = sk.Atmosphere()\n", "atmosphere['rayleigh'] = sk.Species(sk.Rayleigh(), sk.MSIS90())\n", "atmosphere['o3'] = sk.Species(sk.O3OSIRISRes(), sk.Labow())\n", "atmosphere['no2'] = sk.Species(sk.NO2OSIRISRes(), sk.Pratmo())\n", "atmosphere.atmospheric_state = sk.MSIS90()\n", "atmosphere.brdf = sk.Kokhanovsky()\n", "\n", "# Construct the engine\n", "engine = do.EngineDO(geometry=geometry, atmosphere=atmosphere, wavelengths=[330])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Configure the weighting function calculation\n", "atmosphere.wf_species = 'o3'" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "rad = engine.calculate_radiance()\n", "\n", "# Plot weighting function\n", "plt.figure()\n", "rad['wf_o3'].isel(wavelength=0).plot(y='altitude')\n", "plt.ylabel('Altitude [m]')\n", "plt.xlabel('dI/dn')\n", "plt.show()" ] } ], "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.8.13" } }, "nbformat": 4, "nbformat_minor": 2 }