{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Example plot using heat maps\n\nCompare MET temperature and RH using a heatmap\nand scatter plot.\n\nAuthor: Adam Theisen\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nfrom arm_test_data import DATASETS\n\nimport act\n\n# Read MET data in from the test data area\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# Create a DistributionDisplay object to compare fields\ndisplay = act.plotting.DistributionDisplay(ds, subplot_shape=(1, 2), figsize=(12, 5))\n\n# Plot a heatmap and scatter plot up of RH vs Temperature\n# Set the number of bins for the x-axis to 25 and y to 20\ntitle = 'Heatmap of MET RH vs Temp'\ndisplay.plot_heatmap(\n 'temp_mean', 'rh_mean', x_bins=25, y_bins=20, threshold=0, subplot_index=(0, 0), set_title=title\n)\n\n# Plot the scatter plot and shade by wind_speed\ntitle = 'Scatter plot of MET RH vs Temp'\ndisplay.plot_scatter('temp_mean', 'rh_mean', subplot_index=(0, 1), set_title=title, m_field='time')\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 }