{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Plot SurfRad Data\n\nThis data shows how to read in SurfRad data from the urls and plot\nthe data up in a time series\n\nAuthor: Adam Theisen\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n\nimport act\n\n# Easily download data from SURFRAD\nresults = act.discovery.download_surfrad_data('tbl', startdate='20230601', enddate='20230602')\nprint(results)\n\n# But it's easy enough to read form the URLs as well\nurl = [\n 'https://gml.noaa.gov/aftp/data/radiation/surfrad/Boulder_CO/2023/tbl23008.dat',\n 'https://gml.noaa.gov/aftp/data/radiation/surfrad/Boulder_CO/2023/tbl23009.dat',\n]\nds = act.io.read_surfrad(url)\n\n# Create an ACT TimeSeriesDisplay.\ndisplay = act.plotting.TimeSeriesDisplay(ds, subplot_shape=(2,), figsize=(15, 10))\n\n# Plot different variables from the SURFRAD data\ndisplay.plot('upwelling_global', subplot_index=(0,), label='Upwelling')\ndisplay.plot('downwelling_global', subplot_index=(0,), label='Downwelling')\nplt.legend()\n\ndisplay.plot('net_radiation', subplot_index=(1,), label='Net Radiation')\ndisplay.plot('net_ir', subplot_index=(1,), label='Net IR')\ndisplay.plot('total_net', subplot_index=(1,), label='Total Net')\nplt.legend()\n\nplt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.14.3" } }, "nbformat": 4, "nbformat_minor": 0 }