resqpy.olio.dataframe.DataFrame

class resqpy.olio.dataframe.DataFrame(model, uuid=None, df=None, uom_list=None, realization=None, title='dataframe', column_lookup_uuid=None, uom_lookup_uuid=None, extra_metadata=None)[source]

Bases: object

Class for storing and retrieving a pandas dataframe of numerical data as a RESQML property.

Notes

actual values are stored either as z values in a Mesh (Grid2d) object, or as a property on such a mesh when multiple raalizations are in use; a regular Mesh object is created to act as a supporting representation; columns are mapped onto I and rows onto J; if a property is used then the indexable elements are ‘nodes’; column titles are stored in a related StringLookup object, indexed by column number; column units are optionally treated in the same way (uom for the property is generally set to Euc); all values are stored as floats; use the derived TimeTable class if rows relate to steps in a TimeSeries; use the derived RelPerm class if the rows relate to relative permeability data

Methods:

__init__(model[, uuid, df, uom_list, ...])

Create a new Dataframe object from either a previously stored property or a pandas dataframe.

dataframe()

Returns the Dataframe as a pandas DataFrame.

column_uom(col_index)

Returns units of measure for the specified column, or Euc if no units present.

write_hdf5_and_create_xml()

Write dataframe data to hdf5 file and create xml for RESQML objects to represent dataframe.


__init__(model, uuid=None, df=None, uom_list=None, realization=None, title='dataframe', column_lookup_uuid=None, uom_lookup_uuid=None, extra_metadata=None)[source]

Create a new Dataframe object from either a previously stored property or a pandas dataframe.

Parameters
  • model (model.Model) – the model to which the new Dataframe will be attached

  • uuid (uuid.UUID, optional) – the uuid of an existing Grid2dRepresentation object acting as support for a dataframe property (or holding the dataframe as z values)

  • df (pandas.DataFrame, optional) – a dataframe from which the new Dataframe is to be created; if both uuid and df are supplied, realization must not be None and a new realization property will be created

  • uom_list (list of str, optional) – a list holding the units of measure for each column; if present, length of list must match number of columns in df; ignored if uuid is not None

  • realization (int, optional) – if present, the realization number of the RESQML property holding the dataframe

  • title (str, default 'dataframe') – used as the citation title for the Mesh (and property); ignored if uuid is not None

  • column_lookup_uuid (uuid, optional) – if present, the uuid of a string lookup table holding the column names; if present, the contents and order of the table must match the columns in the dataframe; if absent, a new lookup table will be created

  • uom_lookup_uuid (uuid, optional) – if present, the uuid of a string lookup table holding the units of measure for each column; if None and uom_list is present, a new table will be created; if both uom_list and uom_lookup_uuid are present, their contents must match

  • extra_metadata (dict, optional) – if present, a dictionary of extra metadata items, str: str; ignored if uuid is not None

Returns

a newly created Dataframe object

Notes

when initialising from an existing RESQML object, the supporting mesh and its property should have been originally created using this class; when working with ensembles, each object of this class will only handle the data for one realization, though they may share a common support; if both a uuid and a df are provided, a realization number must also be given and the dataframe is used to create a new realization similar to that identified by the uuid

dataframe()[source]

Returns the Dataframe as a pandas DataFrame.

column_uom(col_index)[source]

Returns units of measure for the specified column, or Euc if no units present.

write_hdf5_and_create_xml()[source]

Write dataframe data to hdf5 file and create xml for RESQML objects to represent dataframe.