solarwindpy.core.base.Base

class Base(data: DataFrame)[source]

Bases: Core

Base class for objects backed by a pandas.DataFrame.

Parameters:

data (pandas.DataFrame) – Data used to initialise the object.

Notes

Subclasses override set_data() to validate the underlying DataFrame structure.

__init__(data: DataFrame) None[source]
static mi_tuples(x: Tuple[Tuple[str, ...], ...]) MultiIndex[source]

Create a MultiIndex from tuples with appropriate names.

Parameters:

x (Tuple[Tuple[str, ...], ...]) – Tuples to create MultiIndex from.

Returns:

MultiIndex created from tuples.

Return type:

MI

abstractmethod set_data(new: DataFrame) None[source]

Set new data for the class.

Parameters:

new (pd.DataFrame) – New data to set.

Raises:

ValueError – If the new data is empty.

head()[source]

Return the first few rows of the data.

Returns:

First few rows of the data.

Return type:

pd.DataFrame

tail()[source]

Return the last few rows of the data.

Returns:

Last few rows of the data.

Return type:

pd.DataFrame

property constants: Constants

Physical constants.

Returns:

Physical constants instance.

Return type:

uc.Constants

property data: DataFrame

Underlying DataFrame containing the data.

Returns:

Data with MultiIndex columns.

Return type:

pd.DataFrame

property logger: Logger

Logger instance for this object.

Returns:

Logger instance.

Return type:

logging.Logger

property units: Units

Units conversion factors.

Returns:

Units conversion instance.

Return type:

uc.Units