intake_erddap.TableDAPReader

class intake_erddap.TableDAPReader(*args, metadata: dict | None = None, output_instance: str | None = None, **kwargs)[source]

Creates a Data Reader for an ERDDAP TableDAP Dataset.

Parameters:
  • server (str) –

    URL to the ERDDAP service. Example: "https://coastwatch.pfeg.noaa.gov/erddap"

    Note

    Do not include a trailing slash.

  • dataset_id (str) – The dataset identifier from ERDDAP.

  • variables (list of str, optional) – A list of variables to retrieve from the dataset.

  • constraints (dict, optional) – A mapping of conditions and constraints. Example: {"time>=": "2022-01-02T12:00:00Z", "lon>": -140, "lon<": 0}

  • metadata (dict, optional) – Additional metadata to include with the reader passed from the catalog.

  • erddap_client (type, optional) – A class that implements an interface like erdappy’s ERDDAP class. The reader will rely on this client to interface with ERDDAP for most requests.

  • http_client (module or object, optional) – An object or module that implements an HTTP Client similar to request’s interface. The reader will use this object to make HTTP requests to ERDDAP in some cases.

  • mask_failed_qartod (bool, False) – WARNING ALPHA FEATURE. If True and *_qc_agg columns associated with data columns are available, data values associated with QARTOD flags other than 1 and 2 will be nan’ed out. Has not been thoroughly tested.

  • dropna (bool, False.) – WARNING ALPHA FEATURE. If True, rows with data columns of nans will be dropped from data frame. Has not been thoroughly tested.

  • cache_kwargs (dict, optional) – WARNING ALPHA FEATURE. If you want to have the data you access stored locally in a cache, use this keyword to input a dictionary of keywords. The cache is set up using fsspec’s simple cache. Example configuration is cache_kwargs=dict(cache_storage="/tmp/fnames/", same_names=True).

Examples

Readers are normally returned from a catalog object, but a Reader can be instantiated directly:

>>> reader = TableDAPReader("https://erddap.senors.axds.co/erddap",
... "gov_usgs_waterdata_441759103261203")

Getting a pandas DataFrame from the reader:

>>> ds = reader.read()

Once the dataset object has been instantiated, the dataset’s full metadata is available in the reader.

>>> reader.metadata
{'info_url': 'https://erddap.sensors.axds.co/erddap/info/gov_usgs_waterdata_404513098181201...',
'catalog_dir': '',
'variables': {'time': {'_CoordinateAxisType': 'Time',
'actual_range': [1430828100.0, 1668079800.0],
'axis': 'T',
'ioos_category': 'Time',
'long_name': 'Time',
'standard_name': 'time',
'time_origin': '01-JAN-1970 00:00:00',
'units': 'seconds since 1970-01-01T00:00:00Z'},
    ...
Attributes:
data

The BaseData this reader depends on, if it has one

func_doc
token

Token is computed from all non-_ attributes and then cached.

transform

Methods

__call__(*args, **kwargs)

New version of this instance with altered arguments

apply(func, *args[, output_instance])

Make a pipeline by applying a function to this reader's output

data_cols(df)

Columns that are not axes, coordinates, nor qc_agg columns.

discover(**kwargs)

Part of the data

doc()

Doc associated with loading function

from_dict(data)

Recreate instance from the results of to_dict()

get_client(server, protocol, dataset_id, ...)

Return an initialized ERDDAP Client.

output_doc()

Doc associated with output type

pprint()

Produce nice text formatting of the instance's contents

qname()

package.module:class name of this class, makes str for import_name

read(*args, **kwargs)

Produce data artefact

run_dropna(df)

Drop nan rows based on the data columns.

run_mask_failed_qartod(df)

Nan data values for which corresponding qc_agg columns is not equal to 1 or 2.

to_cat([name])

Create a Catalog containing on this reader

to_dict()

Dictionary representation of the instances contents

to_entry()

Create an entry version of this, ready to be inserted into a Catalog

to_reader([outtype, reader])

Make a different reader for the data used by this reader

auto_pipeline

check_imports

tab_completion_fixer

__init__(*args, metadata: dict | None = None, output_instance: str | None = None, **kwargs)

Methods

__init__(*args[, metadata, output_instance])

apply(func, *args[, output_instance])

Make a pipeline by applying a function to this reader's output

auto_pipeline(outtype[, avoid])

check_imports()

data_cols(df)

Columns that are not axes, coordinates, nor qc_agg columns.

discover(**kwargs)

Part of the data

doc()

Doc associated with loading function

from_dict(data)

Recreate instance from the results of to_dict()

get_client(server, protocol, dataset_id, ...)

Return an initialized ERDDAP Client.

output_doc()

Doc associated with output type

pprint()

Produce nice text formatting of the instance's contents

qname()

package.module:class name of this class, makes str for import_name

read(*args, **kwargs)

Produce data artefact

run_dropna(df)

Drop nan rows based on the data columns.

run_mask_failed_qartod(df)

Nan data values for which corresponding qc_agg columns is not equal to 1 or 2.

tab_completion_fixer(item)

to_cat([name])

Create a Catalog containing on this reader

to_dict()

Dictionary representation of the instances contents

to_entry()

Create an entry version of this, ready to be inserted into a Catalog

to_reader([outtype, reader])

Make a different reader for the data used by this reader

Attributes

data

The BaseData this reader depends on, if it has one

func

function name for loading data

func_doc

docstring origin if not from func

implements

datatype(s) this applies to

imports

top-level packages required to use this

optional_imports

packages that might be required by some options

other_funcs

function names to recognise when matching user calls

output_instance

type the reader produces

token

Token is computed from all non-_ attributes and then cached.

transform