'has_antenna': 'has_antenna.cphd', 'bistatic': 'bistatic.cphd', } TEST_FILE_PATHS = {} TEST_FILE_ROOT = os.environ.get('SARPY_TEST_PATH', None) if TEST_FILE_ROOT is not None: for name_key, path_value in TEST_FILE_NAMES.items(): the_file = os.path.join(TEST_FILE_ROOT, 'cphd', path_value) if os.path.isfile(the_file): TEST_FILE_PATHS[name_key] = the_file GOOD_CPHD = TEST_FILE_PATHS.get('simple', None) BISTATIC_CPHD = TEST_FILE_PATHS.get('bistatic', None) ANTENNA_CPHD = TEST_FILE_PATHS.get('has_antenna', None) DEFAULT_SCHEMA = get_schema_path(version='1.0.1') def make_elem(tag, text=None, children=None, namespace=None, attributes=None, **attrib): """ Creates described element. Creates the Element with tag name, text, and attributes given. Attributes can be specified as either a dictionary or keyword arguments. Parameters ---------- tag : str A string that will become the tag name. text : None|str|float|int A string that will become the text in the element. (Default: ``None``) children : lxml.etree.ElementTree
import logging import os import json import tempfile import unittest import numpy.testing from sarpy.io.phase_history.cphd import CPHDReader, CPHDReader0_3, CPHDReader1_0, CPHDWriter1_0 from sarpy.io.phase_history.converter import open_phase_history import sarpy.consistency.cphd_consistency from sarpy.io.phase_history.cphd_schema import get_schema_path from tests import parse_file_entry DEFAULT_SCHEMA = get_schema_path('1.0.1') cphd_file_types = {} this_loc = os.path.abspath(__file__) file_reference = os.path.join( os.path.split(this_loc)[0], 'cphd_file_types.json') # specifies file locations if os.path.isfile(file_reference): with open(file_reference, 'r') as fi: the_files = json.load(fi) for the_type in the_files: valid_entries = [] for entry in the_files[the_type]: the_file = parse_file_entry(entry) if the_file is not None: valid_entries.append(the_file)