#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 
#
# Author(s):
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''
Created on 

@author: 
'''

import logging
import os

from tab.errors import BufrTableError
from tab.tables import TabBelem

logger = logging.getLogger("trollbufr")

"""
##### Description of recognized table format #####


##################################################
"""

_default_table_dir = "%s/.local/share/trollbufr" % (os.getenv('HOME'))
_table_file_names = {
            "A": "datacat.table",
            "B": "",
            "C": "operator.table",
            "D": "",
            "CF": "",
        }
_text_tab_loaded = "Table loaded: '%s'"
_text_file_not_found = "Table not found: '%s'"

def load_tab_a(tables, fname):
    """Load table A (data category) from 'fname' into object Tables."""
	pass

def load_tab_b(tables, fname):
    """Load table B (elements) from 'fname' into object Tables."""
	pass

def load_tab_c(tables, fname):
    """Load table C (operators) from 'fname' into object Tables."""
	pass

def load_tab_d(tables, fname):
    """Load table D (sequences) from 'fname' into object Tables."""
	pass

def load_tab_cf(tables, fname):
    """
    Load table E (code- and flagtables) into object Tables.
    fname is a directory for ecCodes, a file for libDWD.
    """
	pass

def get_file(tabnum, base_path, master, center, subcenter, master_vers, local_vers):
    mp = os.path.join(base_path, "")
    lp = os.path.join(base_path, "", "%05d_%05d" % (center, subcenter))
    if '%' in _table_file_names[tabnum]:
        m = os.path.join(mp, _table_file_names[tabnum] % (master_vers))
        l = os.path.join(lp, _table_file_names[tabnum] % (local_vers))
    else:
        m = os.path.join(mp, _table_file_names[tabnum])
        l = os.path.join(lp, _table_file_names[tabnum])
    return (m, l)

