solarwindpy.core.base
Contains in situ data Base and Core classes.
This module provides abstract base classes for handling in situ data in solar wind physics applications.
Classes
|
Base class for objects backed by a |
|
Base class for all |
- class Core[source]
Bases:
ABCBase class for all
solarwindpyobjects.The class sets up logging, unit definitions, and physical constants. It provides a common interface that all other core objects inherit from.
- logger
Logger instance associated with the object.
- Type:
- units
Conversion factors used throughout the package.
- Type:
- constants
Collection of physical constants.
- Type:
- data
Container for the underlying data.
- Type:
- property logger: Logger
Logger instance for this object.
- Returns:
Logger instance.
- Return type:
- property units: Units
Units conversion factors.
- Returns:
Units conversion instance.
- Return type:
uc.Units
- 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
- class Base(data: DataFrame)[source]
Bases:
CoreBase 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 underlyingDataFramestructure.- 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:
- property units: Units
Units conversion factors.
- Returns:
Units conversion instance.
- Return type:
uc.Units