Source code for bw_processing.constants

import re
from enum import Enum

import numpy as np

[docs] MAX_SIGNED_32BIT_INT = 2147483647
[docs] MAX_SIGNED_64BIT_INT = 9223372036854775807
# We could try to save space by not storing the columns # `row_index` and `col_index`, and add them after loading from # disk. This saves space, but is MUCH slower, as modifying # a structured array requires a copy. So, for example, on # EXIOBASE, it takes ~218 ms to load the technosphere, # but -687ms to append two columns.
[docs] UNCERTAINTY_DTYPE = [ ("uncertainty_type", np.uint8), ("loc", np.float32), ("scale", np.float32), ("shape", np.float32), ("minimum", np.float32), ("maximum", np.float32), ("negative", bool), ]
[docs] INDICES_DTYPE = [("row", np.int64), ("col", np.int64)]
[docs] NAME_RE = re.compile(r"^[\w\-\.]*$")
[docs] DEFAULT_LICENSES = [ { "name": "ODC-PDDL-1.0", "path": "http://opendatacommons.org/licenses/pddl/", "title": "Open Data Commons Public Domain Dedication and License v1.0", } ]
[docs] class MatrixSerializeFormat(str, Enum): """ Enum with the serializing formats for the vectors and matrices. """
[docs] NUMPY = "numpy" # numpy .npy format
[docs] PARQUET = "parquet" # Apache .parquet format
# FILE EXTENSIONS
[docs] NUMPY_SERIALIZE_FORMAT_EXTENSION = ".npy"
[docs] NUMPY_SERIALIZE_FORMAT_NAME = "npy"
[docs] PARQUET_SERIALIZE_FORMAT_EXTENSION = ".parquet"
[docs] PARQUET_SERIALIZE_FORMAT_NAME = "pqt"