{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Forcing line plots with 2D data and QC\n\nThis is an example of how to use 2 dimentional DataArrays containing\nmultiple 1 dimentional data, including a summary quality control\nplot showing the tests for each 1 dimentional data slice. This\nexample uses the force_line_plot keyword which will force multiple\n1 dimentional plots for each element along the second dimention of\nthe non-time dimention.\n\nAuthor: Ken Kehoe\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nfrom arm_test_data import DATASETS\n\nfrom act.io.arm import read_arm_netcdf\nfrom act.plotting import TimeSeriesDisplay\n\n# Read a data file that has a 2D DataArray of multiple 1D data.\n# The corresponding quality control DataArray is also read in and\n# will be used to make a summary plot of quality control infomation\n# of each assessment category.\nfilename_surf = DATASETS.fetch('nsasurfspecalb1mlawerC1.c1.20160609.080000.nc')\nds = read_arm_netcdf(filename_surf)\n\n# The name of the data variable we wish to plot\nvar_name = 'surface_albedo_mfr_narrowband_10m'\n\n# Create the ACT display object used for plotting. This will have two\n# vertical plots of 800 by 400 pixels.\ndisplay = TimeSeriesDisplay(ds, subplot_shape=(2,), figsize=(8, 2 * 4))\n\n# Create the top plot of data using the force_line_plot option.\n# This will force the plotting to not assume the data are 2D data that\n# would normally be plotted as a 2D plot. Rather for each index into the\n# filter dimention plot a 1D time series plot. Setting labels=True\n# will create a legend using the filter dimention DataArray.\ndisplay.plot(var_name, force_line_plot=True, labels=True)\n\n# Create the bottom plot of summarized quality control by assessment\n# cateory.\ndisplay.qc_flag_block_plot(var_name, subplot_index=(1,))\n\n# Show the plot in a new window.\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 }