from numpy import float32
from collections import namedtuple


Var = namedtuple('Var', ['type', 'standard_name', 'name', 'description', 'units'])


database = dict(
    box_temp=Var(
        float32,
        'air_temperature',
        'box_temp',
        'Auxillary Temperature',
        'degC'),
    box_pressure=Var(
        float32,
        'air_pressure',
        'box_pressure',
        'Pressure inside the data logger enclosure',
        'hPa'),
    paro_air_temp_period=Var(
        float32,
        '',
        'paro_air_temp_period',
        '',
        '1'),
    paro_pressure_period=Var(
        float32,
        '',
        'paro_pressure_period',
        '',
        '1'),
    paro_air_temp=Var(
        float32,
        'air_temperature',
        'paro_air_temp',
        '',
        'degC'),
    pressure=Var(
        float32,
        'air_pressure',
        'pressure',
        'Air pressure as measured from the PAROSCI pressure sensor',
        'hPa'),
    paro_cal_sig=Var(
        float32,
        '',
        'paro_cal_sig',
        '',
        ''),
    box_rh=Var(
        float32,
        'relative_humidity',
        'box_rh',
        'Relative humidity inside the data logger enclosure',
        '%'),
    box_air_temp=Var(
        float32,
        'air_temperature',
        'box_air_temp',
        'Air temperature inside the data logger enclosure',
        'degC'),
    air_temp_2=Var(
        float32,
        'air_temperature',
        'air_temp_2',
        'Auxillary air temperature',
        'degC'),
    air_temp_3=Var(
        float32,
        'air_temperature',
        'air_temp_3',
        'Auxillary air temperature',
        'degC'),
    air_temp_4=Var(
        float32,
        'air_temperature',
        'air_temp_4',
        'Auxillary air temperature',
        'degC'),
    air_temp_5=Var(
        float32,
        'air_temperature',
        'air_temp_5',
        'Auxillary air temperature',
        'degC'),
    wind_speed=Var(
        float32,
        'wind_speed',
        'wind_speed',
        'Wind speed',
        'm*s^-1'),
    wind_dir=Var(
        float32,
        'wind_direction',
        'wind_dir',
        'Wind direction',
        'degrees'),
    rh_shield_freq=Var(
        float32,
        '',
        'rh_shield_freq',
        '',
        'hz'),
    rh=Var(
        float32,
        'relative_humidity',
        'rh',
        'Relative humidity',
        '%'),
    air_temp_6_3m=Var(
        float32,
        'air_temperature',
        'air_temp_6_3m',
        'Air temperature 6.3m from tower base',
        'degC'),
    dewpoint=Var(
        float32,
        'dewpoint_temperature',
        'dewpoint',
        'Calculated dewpoint temperature',
        'degC'),
    rtd_shield_freq=Var(
        float32,
        '',
        'rtd_shied_freq',
        '',
        ''),
    air_temp=Var(
        float32,
        'air_temperature',
        'air_temp',
        'Air temperature',
        'degC'),
    solar_flux=Var(
        float32,
        'solar_flux',
        'solar_flux',
        'Solar flux',
        'w*m^-2'),
    precip=Var(
        float32,
        '',
        'precip',
        'Precipitation',
        'mm'),
    accum_precip=Var(
        float32,
        'accumulated_precipitation',
        'accum_precip',
        'Precipitation accumulated since 0Z',
        'mm'),
    altimeter=Var(
        float32,
        '',
        'altimeter',
        '',
        'inHg')
)

met_vars = {'air_temp', 'rh', 'solar_flux', 'pressure', 'precip', 'accum_precip',
            'wind_speed', 'wind_dir'}
engr_vars = set(database.keys()) - met_vars