__init__.py 539 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from os.path import basename

from kis_tools.gris.headers.wcs_generators.gris import GrisWCSGenerator, GrisIFUWCSGenerator


class NoWCSGeneratorError(object):
    """Raise if no wcs generator matches an input"""


def get_wcs_generator(infile):
    filename = basename(infile)
    if filename.startswith("gris_"):
        return GrisWCSGenerator(infile)
    elif filename.startswith("gris-ifu_"):
        return GrisIFUWCSGenerator(infile)
    raise NoWCSGeneratorError(f"Could not determine correct WCS generator for {infile}")
    pass