DigitalEncoding#

settings activitysim.core.configuration.DigitalEncoding#

Digital encoding instructions for skim tables.

These encoding instructions are used to digitally encode data prior to writing that data back to disk in the zarr file format.

See Digital Encoding documentation for details.

New in version 1.2.

Fields:
  • bitwidth (int)

  • by_dict (Union[int, bool])

  • joint_dict (str)

  • max_value (Union[int, float])

  • min_value (Union[int, float])

  • missing_value (Any)

  • name (str)

  • offset (Union[int, float])

  • regex (str)

  • scale (Union[int, float])

field bitwidth: int = 16#

Number of bits to use in encoded integers, either 8, 16 or 32.

For basic fixed point encoding, it is usually sufficient to simply define the target bitwidth, and the missing value if applicable. The other necessary parameters can then be inferred from the data.

field by_dict: Union[int, bool] = None#

Encode by dictionary, using a bitwidth from {8, 16, 32}, or True.

If given, all arguments other settings for this data are ignored. If given as True, the bitwidth setting is not ignored, but everything else still is.

field joint_dict: str = None#

The name of the joint dictionary for this group.

This must be a unique name for this set of skims, and a new array will be added to the Dataset with this name. It will be an integer- type array indicating the position of each element in the jointly encoded dictionary.

If the joint_dict name is given, then all other instructions in this DigitalEncoding are ignored, except regex.

field max_value: Union[int, float] = None#

Explicitly give the maximum value represented in the array. If not given, it is inferred from the data. It is useful to give these values if the array does not necessarily include all the values that might need to be inserted later.

field min_value: Union[int, float] = None#

Explicitly give the minimum value represented in the array. If not given, it is inferred from the data. It is useful to give these values if the array does not necessarily include all the values that might need to be inserted later.

field missing_value: Any = None#

Use this value to indicate “missing” values.

For float variables, it is possible to use NaN to represent missing values, but other data types do not have a native missing value, so it will need to be given explicitly.

field name: str = None#

The name of an individual matrix skim to encode.

Use this setting to encode specific individual skims. To encode a group of related skims with the same encoding, or together with a joint encoding, use regex instead. You cannot specify both name and regex at the same time.

field offset: Union[int, float] = None#

An explicitly defined offset factor.

The offset factor can be inferred from the min and max values if not provided.

field regex: str = None#

A regular expression for matching skim matrix names.

All skims with names that match under typical regular expression rules for Python will be processed using the rules defined in this DigitalEncoding instruction. To encode one specific skim, use name instead. You cannot specify both name and regex at the same time.

field scale: Union[int, float] = None#

An explicitly defined scaling factor.

The scaling factor can be inferred from the min and max values if not provided.