{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Data rose plot\n\nThis is an example of how to display a data rose.\nAs can be seen in the final plot, there are two major\nbullseyes of data, one around 0\u00baC to the Northeast and\nanother around 15\u00baC to the South. This tells us that we\nget lower temperatures when winds are out of the N/NE as\nwould be expected at this location. This can be extended\nto easily review other types of data as well like aerosols\nand fluxes.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from arm_test_data import DATASETS\nfrom matplotlib import pyplot as plt\n\nimport act\n\n# Read in some data with wind speed/direction in the file\nmet_wildcard_list = [\n 'sgpmetE13.b1.20190101.000000.cdf',\n 'sgpmetE13.b1.20190102.000000.cdf',\n 'sgpmetE13.b1.20190103.000000.cdf',\n 'sgpmetE13.b1.20190104.000000.cdf',\n 'sgpmetE13.b1.20190105.000000.cdf',\n 'sgpmetE13.b1.20190106.000000.cdf',\n 'sgpmetE13.b1.20190107.000000.cdf',\n]\nmet_filenames = [DATASETS.fetch(file) for file in met_wildcard_list]\nds = act.io.arm.read_arm_netcdf(met_filenames)\n\n# Set up wind rose display object\ndisplay = act.plotting.WindRoseDisplay(ds, subplot_shape=(2, 3), figsize=(16, 10))\n\n# Plot mean temperature based on wind direction\ndisplay.plot_data(\n 'wdir_vec_mean',\n 'wspd_vec_mean',\n 'temp_mean',\n num_dirs=12,\n plot_type='line',\n subplot_index=(0, 0),\n)\n\n# Plot median temperature based on wind direction\ndisplay.plot_data(\n 'wdir_vec_mean',\n 'wspd_vec_mean',\n 'temp_mean',\n num_dirs=12,\n plot_type='line',\n subplot_index=(0, 1),\n line_plot_calc='median',\n)\n\n# Plot standard deviation of temperature based on wind direction\ndisplay.plot_data(\n 'wdir_vec_mean',\n 'wspd_vec_mean',\n 'temp_mean',\n num_dirs=12,\n plot_type='line',\n subplot_index=(0, 2),\n line_plot_calc='stdev',\n)\n\n# Plot a contour of counts of temperature based on wind direction\ndisplay.plot_data(\n 'wdir_vec_mean',\n 'wspd_vec_mean',\n 'temp_mean',\n num_dirs=12,\n plot_type='contour',\n subplot_index=(1, 0),\n)\n\n# Plot a contour of mean temperature based on wind direction and wind speed\ndisplay.plot_data(\n 'wdir_vec_mean',\n 'wspd_vec_mean',\n 'temp_mean',\n num_dirs=12,\n plot_type='contour',\n contour_type='mean',\n num_data_bins=10,\n clevels=21,\n cmap='rainbow',\n vmin=-5,\n vmax=20,\n subplot_index=(1, 1),\n)\n\n# Plot a boxplot of temperature based on wind direction\ndisplay.plot_data(\n 'wdir_vec_mean',\n 'wspd_vec_mean',\n 'temp_mean',\n num_dirs=12,\n plot_type='boxplot',\n subplot_index=(1, 2),\n)\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 }