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_api_info()[source]

Return information about the package

Returns

The o3api package info

Return type

dict

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

Retrieve data to produce tco3_return plot

Parameters

kwargs – provided in the API call parameters

Returns

JSON document with data points

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

Retrieve data to produce tco3_zm plot

Parameters

kwargs – provided in the API call parameters

Returns

JSON document with data points

o3api.api.get_data_types()[source]

Get list of plot types with available data

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

Retrieve data to produce vmro3_zm plot

Parameters

kwargs – provided in the API call parameters

Returns

JSON document with data points

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

Return information about the Ozone model

Returns

Info about the Ozone model

Return type

dict

o3api.api.get_models_info()[source]

Return dictionary of available models with the meta info

Returns

The dictionary of available models

Return type

dict

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

Return the list of available Ozone models

Returns

The list of available models

Return type

list

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

Returning plot style for selected models and plot type

o3api.api.get_plot_types()[source]

Get list of the provided plot methods

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

Main plotting routine

Parameters
  • data – data to plot

  • ckwargs – dictionary for curve plotting (e.g. color, style)

  • kwargs – provided in the API call parameters

Returns

PDF plot

o3api.api.plot_json(data, ckwargs, **kwargs)[source]

Plotting routine returning JSON points

Parameters
  • data – data ready for plotting

  • ckwargs – dictionary for curve plotting (e.g. color, style)

  • kwargs – provided in the API call parameters

Returns

JSON document with data points and styles for plotting

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

Plot tco3_return

Parameters

kwargs – provided in the API call parameters

Returns

Either PDF plot or JSON document

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

Plot tco3_zm

Parameters

kwargs – provided in the API call parameters

Returns

Either PDF plot or JSON document

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

Plot vmro3_zm

Parameters

kwargs – 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_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

to_pd_dataframe(ds, model)[source]

Convert xarray variable to pandas dataframe (faster method?)

Parameters
  • ds – xarray dataset

  • model – The model to process for self.plot_type

:return dataset as pandas dataframe :rtype: pandas dataframe

to_pd_series(ds, model)[source]

Convert xarray variable to pandas series

Parameters
  • ds – xarray dataset

  • model – The model to process for self.plot_type

:return dataset as pandas series :rtype: pandas series

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 one datafile

Parameters

model – The model to process

Returns

xarray dataset

Return type

xarray.Dataset

get_mfdataset(model)[source]

Load data from the datafile list

Parameters

model – The model to process

Returns

xarray dataset

Return type

xarray.Dataset

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

Subclass of DataSelection to calculate tco3_zm

get_ensemble_for_plot(models)[source]

Build the ensemble of tco3_zm models for plotting, include reference

Parameters

models – Models to process for tco3_zm

Returns

ensemble of models, including the reference, as pd.DataFrame

Return type

pd.DataFrame

get_ensemble_shifted(data)[source]

Shift tco3_zm data to reference year

Parameters

data – data to process as pd.DataFrame

Returns

shifted data points for plotting

Return type

pd.DataFrame

get_ensemble_smoothed(models, smooth_win)[source]

Smooth tco3_zm data using boxcar

Parameters

models – Models to process for tco3_return

Returns

smoothed data points

Return type

pd.DataFrame

get_ensemble_stats(data)[source]

Calculate Mean, Std, Median for tco3_zm data

Parameters

data – data to process as pd.DataFrame

Returns

updated pd.DateFrame with stats columns

Return type

pd.DataFrame

get_ensemble_yearly(models)[source]

Rebin tco3_zm data for yearly entries

Parameters

models – Models to process for tco3_return

Returns

yearly data points

Return type

pd.DataFrame

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_raw_data_pd(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

pd.DataFrame

get_raw_ensemble_pd(models)[source]

Build the ensemble of tco3_zm models

Parameters

models – Models to process for tco3_zm

Returns

ensemble of models as pd.DataFrame

Return type

pd.DataFrame

get_ref_value()[source]

Get reference value for the reference year

Returns

reference value (tco3_zm at reference year)

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

Subclass of ProcessForTCO3 to calculate tco3_return

get_ensemble_for_plot(models)[source]

Build the ensemble of tco3_return points for plotting

Parameters

models – Models to process for tco3_zm

Returns

ensemble of models, including the mean, as pd.DataFrame

Return type

pd.DataFrame

get_return_years(data)[source]

Calculate return year for every model

Parameters

data – data to process

Returns

return years for models

Return type

pd.DataFrame

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

plothelpers

O3as help functions to create figures:

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

Cleansing models from empty entries, spaces, and quotes

Parameters

kwargs – The provided in the API call parameters

Returns

models cleansed 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.get_plot_info_html(**kwargs)[source]

Generate info text (HTML) for the plot

Parameters

kwargs – The provided in the API call parameters

Returns

information text (HTML) with legal info, parameters etc

Return type

string

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

Generate info text for the plot

Parameters

kwargs – The provided in the API call parameters

Returns

information text with legal info, parameters etc

Return type

string

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

Get plot parameters

Parameters

kwargs – The provided in the API call parameters

Returns

plot_params with added input parameters

Return type

string

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