ocean_data_gateway.readers.erddap.region

class ocean_data_gateway.readers.erddap.region(kwargs)[source]

Bases: ocean_data_gateway.readers.erddap.ErddapReader

Inherits from ErddapReader to search over a region of space and time.

kw

Contains space and time search constraints: min_lon, max_lon, min_lat, max_lat, min_time, max_time.

Type

dict

variables

Variable names if you want to limit the search to those. The variable name or names must be from the list available in odg.all_variables(server) for the specific ERDDAP server and pass the check in odg.check_variables(server, variables).

Type

string or list

criteria

A dictionary describing how to recognize variables by their name and attributes with regular expressions to be used with cf-xarray. It can be local or a URL point to a nonlocal gist. This is required for running QC in Gateway. For example: >>> my_custom_criteria = {“salt”: { … “standard_name”: “sea_water_salinity$|sea_water_practical_salinity$”, … “name”: (?i)sal$|(?i)s.sea_water_practical_salinity$”}}

Type

dict, str, optional

var_def

A dictionary with the same keys as criteria (criteria can have more) that describes QC definitions and units. It should include the variable units, fail_span, and suspect_span. For example: >>> var_def = {“salt”: {“units”: “psu”, … “fail_span”: [-10, 60], “suspect_span”: [-1, 45]}}

Type

dict, optional

approach

approach is defined as ‘region’ for this class.

Type

string

num_variables

Number of variables stored in self.variables. This is set initially and if self.variables is modified, this is updated accordingly. If variables is None, num_variables==0.

Type

int

Attributes
dataset_ids

Find dataset_ids for server.

meta

Rearrange the individual metadata into a dataframe.

Methods

clear()

data([dataset_ids])

Read in data for some or all dataset_ids.

data_by_dataset(dataset_id)

Return the data for a single dataset_id.

find_dataset_id_from_station(station)

Find dataset_id from station name.

get(k[,d])

items()

keys()

Regular dict-like way to return keys.

meta_by_dataset(dataset_id)

Return the catalog metadata for a single dataset_id.

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[,d])

update([E, ]**F)

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values()

Regular dict-like way to return values.

__init__(kwargs)[source]
Parameters

kwargs (dict) –

Can contain arguments to pass onto the base ErddapReader class (known_server, protocol, server, parallel). The dict entries to initialize this class are:

  • kw: dict Contains space and time search constraints: min_lon, max_lon, min_lat, max_lat, min_time, max_time.

  • variables: string or list, optional Variable names if you want to limit the search to those. The variable name or names must be from the list available in odg.all_variables(server) for the specific ERDDAP server and pass the check in odg.check_variables(server, variables).

    Alternatively, if the user inputs criteria, variables can be a list of the keys from criteria.

  • criteria: dict, optional A dictionary describing how to recognize variables by their name and attributes with regular expressions to be used with cf-xarray. It can be local or a URL point to a nonlocal gist. This is required for running QC in Gateway. For example: >>> my_custom_criteria = {“salt”: { … “standard_name”: “sea_water_salinity$|sea_water_practical_salinity$”, … “name”: (?i)sal$|(?i)s.sea_water_practical_salinity$”}}

  • var_def: dict, optional A dictionary with the same keys as criteria (criteria can have more) that describes QC definitions and units. It should include the variable units, fail_span, and suspect_span. For example: >>> var_def = {“salt”: {“units”: “psu”, … “fail_span”: [-10, 60], “suspect_span”: [-1, 45]}}

Methods

__init__(kwargs)

param kwargs

Can contain arguments to pass onto the base ErddapReader class

clear()

data([dataset_ids])

Read in data for some or all dataset_ids.

data_by_dataset(dataset_id)

Return the data for a single dataset_id.

find_dataset_id_from_station(station)

Find dataset_id from station name.

get(k[,d])

items()

keys()

Regular dict-like way to return keys.

meta_by_dataset(dataset_id)

Return the catalog metadata for a single dataset_id.

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[,d])

update([E, ]**F)

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values()

Regular dict-like way to return values.

Attributes

dataset_ids

Find dataset_ids for server.

meta

Rearrange the individual metadata into a dataframe.

_abc_impl = <_abc_data object>
clear()None.  Remove all items from D.
data(dataset_ids=None)

Read in data for some or all dataset_ids.

NOT USED CURRENTLY

Once data is read in for a dataset_ids, it is remembered.

See full documentation in utils.load_data().

data_by_dataset(dataset_id)

Return the data for a single dataset_id.

Returns

Return type

A tuple of (dataset_id, data), where data type is a pandas DataFrame

Notes

Data is read into memory.

property dataset_ids

Find dataset_ids for server.

Notes

The dataset_ids are found by querying the metadata through the ERDDAP server.

The number of dataset_ids can change if a variable is removed from the list of variables and this is rerun.

find_dataset_id_from_station(station)

Find dataset_id from station name.

Parameters

station (string) – Station name for which to search for dataset_id

get(k[, d])D[k] if k in D, else d.  d defaults to None.
items()a set-like object providing a view on D’s items
keys()

Regular dict-like way to return keys.

property meta

Rearrange the individual metadata into a dataframe.

Notes

This should exclude duplicate entries.

meta_by_dataset(dataset_id)

Return the catalog metadata for a single dataset_id.

pop(k[, d])v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()(k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d])D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F)None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values()

Regular dict-like way to return values.