Workflow 4: Searching and plotting#

In this short tutorial we’ll show how to retrieve some data and create a simple plot using one of our plotting functions.


Let’s search for all the methane data from Tacolneston

from openghg.client import search

ch4_results = search(site="tac", species="ch4")

If we want to take a look at the data from the 185m inlet we can first retrieve the data from the object store and then create a quick timeseries plot. See the SearchResults object documentation for more information.

data_185m = ch4_results.retrieve(inlet="185m")

NOTE: the plots created below may not show up on the online documentation version of this notebook.


You can make some simple changes to the plot using arguments

data_185m.plot_timeseries(title="Methane at Tacolneston", xlabel="Time", ylabel="Conc.", units="ppm")

Plot all the data#

We can also retrieve all the data, get a list of ObsData objects.

all_ch4_tac = ch4_results.retrieve_all()

Then we can use the plot_timeseries function from the plotting submodule to compare measurements from different inlets. This creates a Plotly plot that should be interactive and and responsive, even with relatively large amounts of data.

from openghg.plotting import plot_timeseries

plot_timeseries(data=all_ch4_tac, units="ppb")

Compare different sites#

We can easily compare data from different sites by doing a quick search to see what’s available

ch4_data = search(species="ch4")

Then we refine our search to only retrieve the inlets we want

lower_inlets = search(species="ch4", inlet=["42m", "54m"])

Then we can retrieve all the data and make a plot.

lower_inlet_data = lower_inlets.retrieve_all()
plot_timeseries(data=lower_inlet_data, title="Comparing CH4 measurements at Tacolneston and Bilsdale")