properties.py 1.61 KB
Newer Older
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""


"""
import glob
import os
import io
import pandas as pd


# Supported formats, sources and internal data models -------------------------
schema_path = os.path.join(os.path.dirname(__file__),'schemas','lib')
15
supported_data_models = [ os.path.basename(x).split(".")[0] for x in glob.glob(schema_path + '/*/*.json') if os.path.basename(x).split(".")[0] == os.path.dirname(x).split("/")[-1]]
iregon's avatar
iregon committed
16
supported_sources = [pd.io.parsers.TextFileReader, io.StringIO]
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

# Data types ------------------------------------------------------------------
numpy_integers = ['int8','int16','int32','int64','uint8','uint16','uint32','uint64']
numpy_floats = ['float16','float32','float64']
numeric_types = numpy_integers.copy()
numeric_types.extend(numpy_floats)

object_types = ['str','object','key','datetime']

data_types = object_types.copy()
data_types.extend(numpy_integers)
data_types.extend(numpy_floats)

pandas_dtypes = {}
for dtype in object_types:
    pandas_dtypes[dtype] = 'object'
pandas_dtypes.update({ x:x for x in numeric_types })

# ....and how they are managed
data_type_conversion_args = {}
for dtype in numeric_types:
    data_type_conversion_args[dtype] = ['scale','offset']
data_type_conversion_args['str'] = ['disable_white_strip']
40
data_type_conversion_args['object'] = ['disable_white_strip']
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
41
data_type_conversion_args['key'] = ['disable_white_strip']
42
data_type_conversion_args['datetime'] = ['datetime_format']
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
43 44 45

# Misc ------------------------------------------------------------------------
tol = 1E-10
iregon's avatar
iregon committed
46
dummy_level = '_SECTION_'
iregon's avatar
iregon committed
47
# Length of reports in initial read
48
MAX_FULL_REPORT_WIDTH = 100000