ocean_data_gateway.readers.local.stations

class ocean_data_gateway.readers.local.stations(kwargs)[source]

Bases: ocean_data_gateway.readers.local.LocalReader

Inherits from LocalReader to search for 1+ stations or dataset_ids.

kw

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

Type

dict

approach

approach is defined as ‘stations’ for this class.

Type

string

Attributes
catalog

Write then open catalog.

dataset_ids

Find dataset_ids for catalog.

meta

Rearrange the individual metadata into a dataframe.

Methods

data()

Read in data for all dataset_ids.

data_by_dataset(dataset_id)

Return the data for a single dataset_id.

meta_by_dataset(dataset_id)

Return the catalog metadata for a single dataset_id.

write_catalog()

Write catalog file.

__init__(kwargs)[source]
Parameters

kwargs (dict) –

Can contain arguments to pass onto the base LocalReader class (catalog_name, parallel, filenames). The dict entries to initialize this class are: * kw: dict, optional

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

Methods

__init__(kwargs)

param kwargs

Can contain arguments to pass onto the base LocalReader class

data()

Read in data for all dataset_ids.

data_by_dataset(dataset_id)

Return the data for a single dataset_id.

meta_by_dataset(dataset_id)

Return the catalog metadata for a single dataset_id.

write_catalog()

Write catalog file.

Attributes

catalog

Write then open catalog.

dataset_ids

Find dataset_ids for catalog.

meta

Rearrange the individual metadata into a dataframe.

property catalog

Write then open catalog.

data()

Read in data for all dataset_ids.

Returns

  • A dictionary with keys of the dataset_ids and values the data of type

  • If `filename` is a csv file (a pandas DataFrame)

  • If `filename` is a netcdf file (an xarray Dataset)

Notes

This is either done in parallel with the multiprocessing library or in serial.

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.

TODO: SHOULD I INCLUDE TIME RANGE?

property dataset_ids

Find dataset_ids for catalog.

Notes

The dataset_ids are read from the catalog, so the catalog is created before this can happen.

property meta

Rearrange the individual metadata into a dataframe.

meta_by_dataset(dataset_id)

Return the catalog metadata for a single dataset_id.

TODO: Should this return intake-style or a row of the metadata dataframe?

write_catalog()

Write catalog file.