podpac.data.H5PY

class podpac.data.H5PY(**kwargs)[source]

Bases: podpac.core.data.file.DatasetSource

Create a DataSource node using h5py.

source

Path to the h5py file

Type

str

dataset

The h5py file object used to read the file

Type

h5py.File

native_coordinates

The coordinates of the data source.

Type

Coordinates

file_mode

Default is ‘r’. The mode used to open the HDF5 file. Options are r, r+, w, w- or x, a (see h5py.File).

Type

str, optional

data_key

data key, default ‘data’

Type

str, int

lat_key

latitude coordinates key, default ‘lat’

Type

str, int

lon_key

longitude coordinates key, default ‘lon’

Type

str, int

time_key

time coordinates key, default ‘time’

Type

str, int

alt_key

altitude coordinates key, default ‘alt’

Type

str, int

crs

Coordinate reference system of the coordinates

Type

str

cf_time

decode CF datetimes

Type

bool

cf_units

units, when decoding CF datetimes

Type

str

cf_calendar

calendar, when decoding CF datetimes

Type

str

Alternative Constructors

from_definition(definition)

Create podpac Node from a dictionary definition.

from_json(s)

Create podpac Node from a JSON definition.

Methods

__init__(**kwargs)

Do not overwrite me

attrs([key])

Dataset or group key for which attributes will be summarized.

close_dataset()

Closes the file.

create_output_array(coords[, data])

Initialize an output data array

eval(coordinates[, output])

Evaluates this node using the supplied coordinates.

eval_group(group)

Evaluate the node for each of the coordinates in the group.

find_coordinates()

Get the available native coordinates for the Node.

from_url(url)

Create podpac Node from a WMS/WCS request.

get_alt()

Get the native altitude coordinates from the dataset.

get_cache(key[, coordinates])

Get cached data for this node.

get_data(coordinates, coordinates_index)

This method must be defined by the data source implementing the DataSource class.

get_lat()

Get the native latitude coordinates from the dataset.

get_lon()

Get the native longitude coordinates from the dataset.

get_native_coordinates()

The coordinates of the data source.

get_time()

Get the native time coordinates from the dataset, decoding datetimes if requested.

has_cache(key[, coordinates])

Check for cached data for this node.

init()

load(path)

Create podpac Node from file.

put_cache(data, key[, coordinates, overwrite])

Cache data for this node.

rem_cache(key[, coordinates, mode])

Clear cached data for this node.

save(path)

Write node to file.

Attributes

alt_key

A trait for unicode strings.

available_keys

base_definition

Base node definition for DatasetSource nodes.

base_ref

Default reference/name in node definitions

cache_ctrl

A trait whose value must be an instance of a specified class.

cache_output

A boolean (True, False) trait.

cache_update

A boolean (True, False) trait.

cf_calendar

A trait for unicode strings.

cf_time

A boolean (True, False) trait.

cf_units

A trait for unicode strings.

coordinate_index_type

An enum whose value must be in a given sequence.

crs

A trait for unicode strings.

data_key

A trait for unicode strings.

dataset

A trait which allows any value.

definition

Full node definition.

dims

An instance of a Python list.

dtype

A trait which allows any value.

file_mode

A trait for unicode strings.

hash

interpolation

A trait type representing a Union type.

interpolation_class

Get the interpolation class currently set for this data source.

interpolators

Return the interpolators selected for the previous node evaluation interpolation.

json

definition for this node in json format

json_pretty

lat_key

A trait for unicode strings.

lon_key

A trait for unicode strings.

nan_vals

An instance of a Python list.

native_coordinates

A trait whose value must be an instance of a specified class.

output

A trait for unicode strings.

output_keys

An instance of a Python list.

outputs

An instance of a Python list.

pipeline

Deprecated.

source

A trait for unicode strings.

style

A trait whose value must be an instance of a specified class.

time_key

A trait for unicode strings.

units

A trait for unicode strings.

Members

__init__(**kwargs)

Do not overwrite me

attrs(key='/')[source]

Dataset or group key for which attributes will be summarized.

property available_keys
close_dataset()[source]

Closes the file.

dims

An instance of a Python list.

file_mode

A trait for unicode strings.

get_data(coordinates, coordinates_index)[source]

This method must be defined by the data source implementing the DataSource class. When data source nodes are evaluated, this method is called with request coordinates and coordinate indexes. The implementing method can choose which input provides the most efficient method of getting data (i.e via coordinates or via the index of the coordinates).

Coordinates and coordinate indexes may be strided or subsets of the source data, but all coordinates and coordinate indexes will match 1:1 with the subset data.

This method may return a numpy array, an xarray DaraArray, or a podpac UnitsDataArray. If a numpy array or xarray DataArray is returned, podpac.data.DataSource.evaluate() will cast the data into a UnitsDataArray using the requested source coordinates. If a podpac UnitsDataArray is passed back, the podpac.data.DataSource.evaluate() method will not do any further processing. The inherited Node method create_output_array can be used to generate the template UnitsDataArray in your DataSource. See podpac.Node.create_output_array() for more details.

Parameters
  • coordinates (podpac.Coordinates) – The coordinates that need to be retrieved from the data source using the coordinate system of the data source

  • coordinates_index (List) – A list of slices or a boolean array that give the indices of the data that needs to be retrieved from the data source. The values in the coordinate_index will vary depending on the coordinate_index_type defined for the data source.

Returns

A subset of the returned data. If a numpy array or xarray DataArray is returned, the data will be cast into UnitsDataArray using the returned data to fill values at the requested source coordinates.

Return type

np.ndarray, xr.DataArray, podpac.UnitsDataArray