# Path: arsf_envi_reader/envi_header.py
# ENVI_TO_NUMPY_DTYPE = {'1':  numpy.uint8,
#                        '2':  numpy.int16,
#                        '3':  numpy.int32,
#                        '4':  numpy.float32,
#                        '5':  numpy.float64,
#                        '6':  numpy.complex64,
#                        '9':  numpy.complex128,
#                        '12': numpy.uint16,
#                        '13': numpy.uint32,
#                        '14': numpy.int64,
#                        '15': numpy.uint64}
# def find_hdr_file(rawfilename):
# def read_hdr_file(hdrfilename, keep_case=False):
# def write_envi_header(filename, header_dict):


import argparse
import os
import shutil
import sys
from arsf_envi_reader import envi_header

"""

###########################################################
# This file has been created by ARSF Data Analysis Node and
# is licensed under the GPL v3 Licence. A copy of this
# licence is available to download with this file.
###########################################################

from __future__ import print_function


def copy_header_dict_items(source_header_dict, target_header_dict, keys):
    """
    Copy selected keys from source header to target. Replacing if they exist
    """
    for key in keys:
        try:
            target_header_dict[key] = source_header_dict[key]
            print("Copied {}".format(key))
        except KeyError:
            print("Could not find {}. Skipping".format(key),file=sys.stderr)

def run_copy_header(sourceheader, targetheader, keys):
    """
    Copy information from sourceheader to targetheader
    for given keys.

    """
    # Read header info to dictionaries

# Path: arsf_envi_reader/envi_header.py
# ENVI_TO_NUMPY_DTYPE = {'1':  numpy.uint8,
#                        '2':  numpy.int16,
#                        '3':  numpy.int32,
#                        '4':  numpy.float32,
#                        '5':  numpy.float64,
#                        '6':  numpy.complex64,
#                        '9':  numpy.complex128,
#                        '12': numpy.uint16,
#                        '13': numpy.uint32,
#                        '14': numpy.int64,
#                        '15': numpy.uint64}
# def find_hdr_file(rawfilename):
# def read_hdr_file(hdrfilename, keep_case=False):
# def write_envi_header(filename, header_dict):


# Path: copy_header_info.py
import argparse
import os
import shutil
import sys
from arsf_envi_reader import envi_header


"""

###########################################################
# This file has been created by ARSF Data Analysis Node and
# is licensed under the GPL v3 Licence. A copy of this
# licence is available to download with this file.
###########################################################

from __future__ import print_function


def copy_header_dict_items(source_header_dict, target_header_dict, keys):
    """
    Copy selected keys from source header to target. Replacing if they exist
    """
    for key in keys:
        try:
            target_header_dict[key] = source_header_dict[key]
            print("Copied {}".format(key))
        except KeyError:
            print("Could not find {}. Skipping".format(key),file=sys.stderr)

def run_copy_header(sourceheader, targetheader, keys):
    """
    Copy information from sourceheader to targetheader
    for given keys.

    """
    # Read header info to dictionaries

    source_header_dict = envi_header.read_hdr_file(args.sourceheader[0],