Skip to content

Commit

Permalink
ENH: Updating example to show how to clean object and plot QC (#455)
Browse files Browse the repository at this point in the history
* ENH: Updating example to show how to clean object and plot QC

* ENH: Updating a little more and adding the file I missed!
  • Loading branch information
AdamTheisen authored May 2, 2022
1 parent 7fa467f commit 243b088
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
37 changes: 37 additions & 0 deletions examples/plot_dqr_qc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
Query the ARM DQR webservice
----------------------------
Simple example for querying the ARM DQR webservice
and plotting up the results
Author: Adam Theisen
"""


from matplotlib import pyplot as plt
import act

# Read in sample AOSMET data
files = act.tests.sample_files.EXAMPLE_AOSMET
obj = act.io.armfiles.read_netcdf(files)

# Query DQR webservice for a specific variable
# As can be seen in the "Plotting QC Flags" example
# a call to obj.clean.cleanup() would normally be needed
# in order to plot up ARM's QC information. In this case
# the call to add DQRs to the QC automatically applies that
# cleanup so you don't have to.
variable = 'temperature_ambient'
obj = act.qc.arm.add_dqr_to_qc(obj, variable=variable)

# Plot data
# Creat Plot Display
display = act.plotting.TimeSeriesDisplay(obj, figsize=(15, 10), subplot_shape=(2,))

# Plot temperature data in top plot
display.plot(variable, subplot_index=(0,))

# Plot QC data
display.qc_flag_block_plot(variable, subplot_index=(1,))
plt.show()
21 changes: 11 additions & 10 deletions examples/plot_qc.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
"""
Query the ARM DQR webservice
----------------------------
Plotting QC Flags
-----------------
Simple example for querying the ARM DQR webservice
and plotting up the results
Simple example for cleaning up a dataset and
plotting the data and its QC flags
Author: Adam Theisen
"""


from matplotlib import pyplot as plt

import act

# Read in sample AOSMET data
files = act.tests.sample_files.EXAMPLE_AOSMET
# Read in sample MET data
files = act.tests.sample_files.EXAMPLE_MET1
obj = act.io.armfiles.read_netcdf(files)

# Query DQR webservice for a specific variable
variable = 'temperature_ambient'
obj = act.qc.arm.add_dqr_to_qc(obj, variable=variable)
# In order to utilize all the ACT QC modules and plot the QC,
# we need to clean up the object to follow CF standards
obj.clean.cleanup()


# Plot data
# Creat Plot Display
variable = 'temp_mean'
display = act.plotting.TimeSeriesDisplay(obj, figsize=(15, 10), subplot_shape=(2,))

# Plot temperature data in top plot
Expand Down

0 comments on commit 243b088

Please sign in to comment.