Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
config.py 10 KiB
Newer Older
Thomas Vliagkoftis's avatar
Thomas Vliagkoftis committed
import secrets
import numpy as np, pandas as pd, getpass as gt


class Config(secrets.Secrets):

    PUBLIC_SAVE_PATH = f'/eos/jeodpp/data/projects/LEGENT/transfer/{gt.getuser()}/'

    EEA_2013 = {
        'delimiter': '\t',
        'encoding': 'utf-8',
        'year': 2013,
        'column_names': [
            'id',
            'country',
            'oem_group',
            'oem_mh',
            'oem_manufacturer',
            'oem_ms',
            'type_approval_number',
            'type',
            'variant',
            'version',
            'oem_make',
            'commercial_name',
            'vehicle_category_type_approved',
            'registrations',
            'co2_nedc_declared',
            'mass_in_running_order',
            'wheel_base',
            'axle_width_steering_axle',
            'axle_width_other_axle',
            'fuel_type',
            'fuel_mode',
            'engine_capacity',
            'engine_max_power',
            'electric_energy_consumption',
            'eco_innovative_technology',
            'eco_co2_reduction_nedc'
        ]
    }

    EEA_2014 = {
        'delimiter': '\t',
        'encoding': 'utf-8',
        'year': 2014,
        'column_names': [
            'id',
            'country',
            'oem_group',
            'oem_mh',
            'oem_manufacturer',
            'oem_ms',
            'type_approval_number',
            'type',
            'variant',
            'version',
            'oem_make',
            'commercial_name',
            'vehicle_category_type_approved',
            'registrations',
            'co2_nedc_declared',
            'mass_in_running_order',
            'wheel_base',
            'axle_width_steering_axle',
            'axle_width_other_axle',
            'fuel_type',
            'fuel_mode',
            'engine_capacity',
            'engine_max_power',
            'electric_energy_consumption',
            'eco_innovative_technology',
            'eco_co2_reduction_nedc'
        ]
    }

    EEA_2015 = {
        'delimiter': '\t',
        'encoding': 'utf-8',
        'year': 2015,
        'column_names': [
            'id',
            'country',
            'oem_group',
            'oem_mh',
            'oem_manufacturer',
            'oem_ms',
            'type_approval_number',
            'type',
            'variant',
            'version',
            'oem_make',
            'commercial_name',
            'vehicle_category_type_approved',
            'registrations',
            'co2_nedc_declared',
            'mass_in_running_order',
            'wheel_base',
            'axle_width_steering_axle',
            'axle_width_other_axle',
            'fuel_type',
            'fuel_mode',
            'engine_capacity',
            'engine_max_power',
            'electric_energy_consumption',
            'eco_innovative_technology',
            'eco_co2_reduction_nedc'
        ]
    }

    EEA_2016 = {
        'delimiter': '\t',
        'encoding': 'utf-16',
        'year': 2016,
        'column_names': [
            'id',
            'country',
            'oem_group',
            'oem_mh',
            'oem_manufacturer',
            'oem_ms',
            'type_approval_number',
            'type',
            'variant',
            'version',
            'oem_make',
            'commercial_name',
            'vehicle_category_type_approved',
            'registrations',
            'co2_nedc_declared',
            'mass_in_running_order',
            'wheel_base',
            'axle_width_steering_axle',
            'axle_width_other_axle',
            'fuel_type',
            'fuel_mode',
            'engine_capacity',
            'engine_max_power',
            'electric_energy_consumption',
            'eco_innovative_technology',
            'eco_co2_reduction_nedc'
        ]
    }

    EEA_2017 = {
        'delimiter': '\t',
        'encoding': 'utf-16',
        'year': 2017,
        'column_names': [
            'id',
            'country',
            'oem_group',
            'vehicle_family_id',
            'oem_mh',
            'oem_manufacturer',
            'oem_ms',
            'type_approval_number',
            'type',
            'variant',
            'version',
            'oem_make',
            'commercial_name',
            'vehicle_category_type_approved',
            'vehicle_category_register',
            'mass_in_running_order',
            'mass_wltp',
            'co2_nedc_declared',
            'co2_wltp_declared',
            'wheel_base',
            'axle_width_steering_axle',
            'axle_width_other_axle',
            'fuel_type',
            'fuel_mode',
            'engine_capacity',
            'engine_max_power',
            'electric_energy_consumption',
            'eco_innovative_technology',
            'eco_co2_reduction_nedc',
            'eco_co2_reduction_wltp',
            'deviation_factor',
            'verification_factor',
            'registrations'
        ]
    }

    EEA_2018 = {
        'delimiter': '\t',
        'encoding': 'utf-8',
        'year': 2018,
        'column_properties': pd.DataFrame([
            ['id', 'ID', np.int32],
            ['country', 'MS', np.object],
            ['oem_group', 'Mp', np.object],
            ['vehicle_family_id', 'VFN', np.object],
            ['oem_mh', 'Mh', np.object],
            ['oem_manufacturer', 'Man', np.object],
            ['oem_ms', 'MMS', np.object],
            ['type_approval_number', 'Tan', np.object],
            ['type', 'T', np.object],
            ['variant', 'Va', np.object],
            ['version', 'Ve', np.object],
            ['oem_make', 'Mk', np.object],
            ['commercial_name', 'Cn', np.object],
            ['vehicle_category_type_approved', 'Ct', np.object],
            ['vehicle_category_register', 'Cr', np.object],
            ['mass_in_running_order', 'm (kg)', np.float16],
            ['mass_wltp', 'Mt', np.float16],
            ['co2_nedc_declared', 'Enedc (g/km)', np.float16],
            ['co2_wltp_declared', 'Ewltp (g/km)', np.float16],
            ['wheel_base', 'W (mm)', np.float16],
            ['axle_width_steering_axle', 'At1 (mm)', np.float16],
            ['axle_width_other_axle', 'At2 (mm)', np.float16],
            ['fuel_type', 'Ft', np.object],
            ['fuel_mode', 'Fm', np.object],
            ['engine_capacity', 'ec (cm3)', np.float16],
            ['engine_max_power', 'ep (KW)', np.float16],
            ['electric_energy_consumption', 'z (Wh/km)', np.float16],
            ['eco_innovative_technology', 'It', np.object],
            ['eco_co2_reduction_nedc', 'Ernedc (g/km)', np.float16],
            ['eco_co2_reduction_wltp', 'Erwltp (g/km)', np.float16],
            ['deviation_factor', 'De', np.float16],
            ['verification_factor', 'Vf', np.float16],
            ['registrations', 'r', np.int32]
        ], columns=['db_names', 'names', 'coltype'])
    }

    EEA_2019 = {
        'delimiter': ',',
        'encoding': 'utf-16',
        'year': 2019,
        'column_names': [
            'id',
            'country',
            'vehicle_family_id',
            'oem_group',
            'oem_mh',
            'oem_manufacturer',
            'oem_ms',
            'type_approval_number',
            'type',
            'variant',
            'version',
            'oem_make',
            'commercial_name',
            'vehicle_category_type_approved',
            'vehicle_category_register',
            'registrations',
            'mass_in_running_order',
            'mass_wltp',
            'co2_nedc_declared',
            'co2_wltp_declared',
            'wheel_base',
            'axle_width_steering_axle',
            'axle_width_other_axle',
            'fuel_type',
            'fuel_mode',
            'engine_capacity',
            'engine_max_power',
            'electric_energy_consumption',
            'eco_innovative_technology',
            'eco_co2_reduction_nedc',
            'eco_co2_reduction_wltp',
            'deviation_factor',
            'verification_factor',
            'status',
            'year'
        ]
    }

    EEA_2020 = {
        'delimiter': ',',
        'encoding': 'utf-8',
        'year': 2020,
        'column_properties': pd.DataFrame([
            ['id', 'ID', np.int32],
            ['country', 'Country', np.object],
            ['vehicle_family_id', 'VFN', np.object],
            ['oem_group', 'Mp', np.object],
            ['oem_mh', 'Mh', np.object],
            ['oem_manufacturer', 'Man', np.object],
            ['oem_ms', 'MMS', np.object],
            ['type_approval_number', 'Tan', np.object],
            ['type', 'T', np.object],
            ['variant', 'Va', np.object],
            ['version', 'Ve', np.object],
            ['oem_make', 'Mk', np.object],
            ['commercial_name', 'Cn', np.object],
            ['vehicle_category_type_approved', 'Ct', np.object],
            ['vehicle_category_register', 'Cr', np.object],
            ['registrations', 'r', np.int32],
            ['mass_in_running_order', 'm (kg)', np.float16],
            ['mass_wltp', 'Mt', np.float16],
            ['co2_nedc_declared', 'Enedc (g/km)', np.float16],
            ['co2_wltp_declared', 'Ewltp (g/km)', np.float16],
            ['wheel_base', 'W (mm)', np.float16],
            ['axle_width_steering_axle', 'At1 (mm)', np.float16],
            ['axle_width_other_axle', 'At2 (mm)', np.float16],
            ['fuel_type', 'Ft', np.object],
            ['fuel_mode', 'Fm', np.object],
            ['engine_capacity', 'ec (cm3)', np.float16],
            ['engine_max_power', 'ep (KW)', np.float16],
            ['electric_energy_consumption', 'z (Wh/km)', np.float16],
            ['eco_innovative_technology', 'IT', np.object],
            ['eco_co2_reduction_nedc', 'Ernedc (g/km)', np.float16],
            ['eco_co2_reduction_wltp', 'Erwltp (g/km)', np.float16],
            ['deviation_factor', 'De', np.float16],
            ['verification_factor', 'Vf', np.float16],
            ['status', 'Status', np.object],
            ['year', 'year', np.int32],
            ['electric_range', 'Electric range (km)', np.float16]
        ], columns=['db_names', 'names', 'coltype'])
    }