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) cphd_file_types[the_type] = valid_entries def generic_io_test(instance, test_file, reader_type_string, reader_type): assert isinstance(instance, unittest.TestCase) reader = None with instance.subTest( msg='establish reader for type {} and file {}'.format( reader_type_string, test_file)): reader = open_phase_history(test_file) instance.assertTrue(reader is not None, msg='Returned None, so opening failed.')
import numpy import json import unittest import sarpy.io.DEM.geoid as geoid from tests import parse_file_entry test_file = None geoid_files = [] this_loc = os.path.abspath(__file__) file_reference = os.path.join(os.path.split(this_loc)[0], 'geoid.json') # specifies file locations if os.path.isfile(file_reference): with open(file_reference, 'r') as fi: the_files = json.load(fi) test_file = parse_file_entry(the_files.get('test_file', None)) for entry in the_files.get('geoid_files', []): the_file = parse_file_entry(entry) if the_file is not None: geoid_files.append(the_file) def generic_geoid_test(instance, test_file, geoid_file): assert isinstance(instance, unittest.TestCase) _, gname = os.path.split(geoid_file) if gname.lower().startswith('egm84'): zcol = 2 elif gname.lower().startswith('egm96'): zcol = 3 else: