o3api reference

If you are looking for information on a specific function, class or method, this part of the documentation is for you.

api

O3as REST API methods:

o3api.api.get_metadata(*args, **kwargs)[source]

Return information about the package

Returns

The o3api package info

Return type

dict

o3api.api.get_model_info(*args, **kwargs)[source]

Return information about the Ozone model

Returns

Info about the Ozone model

Return type

dict

o3api.api.list_models(*args, **kwargs)[source]

Return the list of available Ozone models

Returns

The list of available models

Return type

dict

o3api.api.plot(*args, **kwargs)[source]

Main plotting routine

Parameters

kwargs – The provided in the API call parameters

Returns

Either PDF plot or JSON document

plots

O3as helper classes to extact data for plotting:

class o3api.plots.DataSelection(plot_type, **kwargs)[source]

Class to perform data selection, based on Dataset.

Parameters
  • begin – Year to start data scanning from

  • end – Year to finish data scanning

  • month – Month(s) to select, if not a whole year

  • lat_min – Minimum latitude to define the range (-90..90)

  • lat_max – Maximum latitude to define the range (-90..90)

get_1980slice(model)[source]

Function to select the slice for 1980 (reference year)

Parameters

model – The model to process

Returns

xarray dataset selected according to the time and latitude

Return type

xarray

get_dataslice(model)[source]

Function to select the slice of data according to the time and latitude requested

Parameters

model – The model to process

Returns

xarray dataset selected according to the time and latitude

Return type

xarray

class o3api.plots.Dataset(plot_type, **kwargs)[source]

Base Class to initialize the dataset

Parameters

plot_type – The plot type (e.g. tco3_zm, vmro3_zm, …)

get_dataset(model)[source]

Load data from the datafile list

Parameters

model – The model to process

Returns

xarray dataset

Return type

xarray

class o3api.plots.ProcessForTCO3(**kwargs)[source]

Subclass of DataSelection to calculate tco3_zm

get_plot_data(model)[source]

Plot tco3_zm data applying a smoothing function (boxcar) :param model: The model to process for tco3_zm :return: ready for plotting data :rtype: pandas series (pd.Series)

get_raw_data(model)[source]

Process the model to get tco3_zm raw data

Parameters

model – The model to process for tco3_zm

Returns

raw data points in preparation for plotting

Return type

pandas series (pd.Series)

get_ref1980(model)[source]

Process the model to get tco3_zm reference for 1980

Parameters

model – The model to process for tco3_zm

Returns

xarray dataset for 1980

Return type

xarray

class o3api.plots.ProcessForTCO3Return(**kwargs)[source]

Subclass of DataSelection to calculate tco3_return

get_plot_data(model)[source]

Process the model to get tco3_return data for plotting

Parameters

model – The model to process for tco3_return

Returns

xarray dataset for plotting

Return type

xarray

class o3api.plots.ProcessForVMRO3(**kwargs)[source]

Subclass of DataSelection to calculate vmro3_zm

get_plot_data(model)[source]

Process the model to get vmro3_zm data for plotting

Parameters

model – The model to process for vmro3_zm

Returns

xarray dataset for plotting

Return type

xarray

o3api.plots.set_data_processing(plot_type, **kwargs)[source]

Function to inizialize proper class for data processing

Parameters

plot_type – The plot type (e.g. tco3_zm, vmro3_zm, …)

Returns

object corresponding to the plot type

plothelpers

O3as help functions to create figures:

o3api.plothelpers.clean_models(**kwargs)[source]

Clean models from empty entries, spaces, and quotes

Parameters

kwargs – The provided in the API call parameters

Returns

models cleaned from empty entries, spaces, quotes

Return type

list

o3api.plothelpers.get_date_range(ds)[source]

Return the range of dates in the provided dataset

Parameters

ds – xarray dataset to check

Returns

date_min, date_max

o3api.plothelpers.get_periodicity(pd_time)[source]

Calculate periodicity in the provided data

Parameters

pd_time (pandas DatetimeIndex) – The time period

Returns

Calculated periodicity as the number of points per year

Return type

int

o3api.plothelpers.set_figure_attr(fig, **kwargs)[source]

Configure the figure attributes

Parameters
  • fig – Figure instance

  • kwargs – The provided in the API call parameters

Returns

none

o3api.plothelpers.set_filename(**kwargs)[source]

Set file name

Parameters

kwargs – The provided in the API call parameters

Returns

file_name with added input parameters (no extension given!)

Return type

string

o3api.plothelpers.set_plot_title(**kwargs)[source]

Set plot title

Parameters

kwargs – The provided in the API call parameters

Returns

plot_title with added input parameters

Return type

string