fips.Block#

class fips.Block(data, name=None, index=None, dtype=None, copy=False)[source]#

Single data block with a named Series and consistent index.

A Block wraps a pandas Series and can be initialized from an existing Series or from raw values.

Blocks are the fundamental building units of fips. Inverse problems can be customized by creating Blocks with specific indices and names to represent different state or observation components relevant to the application.

Parameters:
  • data (pd.Series, Block, or array-like) – Data for the block. If Block, creates a copy.

  • name (str, optional) – Name for the block. If None, uses data.name.

  • index (pd.Index, optional) – Index for the block. If None, uses data.index.

  • dtype (dtype, optional) – Data type to force.

  • copy (bool, default False) – Whether to copy the underlying data.

Attributes

index

Return the index of the underlying data.

name

The name of the underlying Series.

shape

Return the shape of the underlying data.

values

Return the values as a numpy array.

data

The underlying data, which must be numeric and non-NaN.

Methods

copy([deep])

Create a copy of the structure.

from_file(path)

Load object from a pickle file.

reindex(index[, columns, verify_overlap, ...])

Return a new instance with data reindexed to the specified index and columns.

round_index(decimals[, axis, inplace])

Round float indices on the specified axis to given decimals.

to_file(path)

Save object to a pickle file.

to_numpy()

Get the underlying data as a NumPy array.

to_series([add_block_level])

Return the underlying Series data.

to_xarray()

Convert the Block to an xarray DataArray.

xs(key[, axis, level, drop_level])

Cross-select data based on index/column values.