larch.Dataset.from_omx_3d

larch.Dataset.from_omx_3d

classmethod Dataset.from_omx_3d(omx, index_names=('otaz', 'dtaz', 'time_period'), indexes=None, *, time_periods=None, time_period_sep='__', max_float_precision=32)[source]

Create a Dataset from an OMX file with an implicit third dimension.

Parameters
  • omx (openmatrix.File or larch.OMX) – An OMX-format file, opened for reading.

  • index_names (tuple, default ("otaz", "dtaz", "time_period")) – Should be a tuple of length 3, giving the names of the three dimensions. The first two names are the native dimensions from the open matrix file, the last is the name of the implicit dimension that is created by parsing array names.

  • indexes (str, optional) – The name of a ‘lookup’ in the OMX file, which will be used to populate the coordinates for the two native dimensions. Or, specify “one-based” or “zero-based” to assume sequential and consecutive numbering starting with 1 or 0 respectively.

  • time_periods (list-like, required keyword argument) – A list of index values from which the third dimension is constructed for all variables with a third dimension.

  • time_period_sep (str, default "__" (double underscore)) – The presence of this separator within the name of any table in the OMX file indicates that table is to be considered a page in a three dimensional variable. The portion of the name preceding the first instance of this separator is the name of the resulting variable, and the portion of the name after the first instance of this separator is the label of the position for this page, which should appear in time_periods.

  • max_float_precision (int, default 32) – When loading, reduce all floats in the OMX file to this level of precision, generally to save memory if they were stored as double precision but that level of detail is unneeded in the present application.

Returns

Dataset