コード例 #1
0
class TestHfrRadialDataHandler(PyonTestCase):

    _hfr_data_handler = None
    _var_list = ['LOND', 'LATD', 'VELU', 'VELV', 'VFLG', 'ESPC', 'ETMP', 'MAXV', 'MINV',
                 'ERSC', 'ERTC', 'XDST', 'YDST', 'RNGE', 'BEAR', 'VELO', 'HEAD', 'SPRC']

    def setUp(self):
        self._hfr_data_handler = HfrRadialDataHandler(data_source='test_data/RDLi_SEAB_2011_08_24_1600.ruv')
        pass

    def tearDown(self):
        self._hfr_data_handler = None
        pass

    def test_get_attributes(self):
        attributes = self._hfr_data_handler.get_attributes()
        #make sure attributes match up here?

    def test_get_attribute(self):
        attributes = self._hfr_data_handler.get_attributes()
        for key in attributes.keys():
            attr_value = self._hfr_data_handler.get_attribute(key)

    def test_get_variables(self):
        variables = self._hfr_data_handler.get_variables()
        #make sure variables match up here?

    def test_acquire_data(self):
        variables = self._var_list
        data_iter = self._hfr_data_handler.acquire_data()
        for vn, slice_, rng, data in data_iter:
            self.assertTrue(vn in variables)
            variables.pop(variables.index(vn))
            self.assertTrue(isinstance(slice_, tuple))
            self.assertTrue(isinstance(rng, tuple))
            self.assertTrue(isinstance(data, numpy.ndarray))
コード例 #2
0
    def setUp(self):

        self._datasets = {}

        file = self._create_tst_data_set('base')

        ext_ds = ExternalDataset(name="base", dataset_description=DatasetDescription(), update_description=UpdateDescription(), contact=ContactInformation())
        ext_ds.dataset_description.parameters["dataset_path"] = file
        ext_ds.dataset_description.parameters["temporal_dimension"] = 'time'

        self._datasets['base'] = HfrRadialDataHandler(data_source=file, ext_dataset=ext_ds)

        file = self._create_tst_data_set('mod_gatt')

        ext_ds = ExternalDataset(name="mod_gatt", dataset_description=DatasetDescription(), update_description=UpdateDescription(), contact=ContactInformation())
        ext_ds.dataset_description.parameters["dataset_path"] = file
        ext_ds.dataset_description.parameters["temporal_dimension"] = 'time'
        self._datasets['mod_gatt'] = HfrRadialDataHandler(data_source=file, ext_dataset=ext_ds)

        file = self._create_tst_data_set('new_gatt')

        ext_ds = ExternalDataset(name="new_gatt", dataset_description=DatasetDescription(), update_description=UpdateDescription(), contact=ContactInformation())
        ext_ds.dataset_description.parameters["dataset_path"] = file
        ext_ds.dataset_description.parameters["temporal_dimension"] = 'time'

        self._datasets['new_gatt'] = HfrRadialDataHandler(data_source=file, ext_dataset=ext_ds)

        file = self._create_tst_data_set('mod_var')

        ext_ds = ExternalDataset(name="mod_var", dataset_description=DatasetDescription(), update_description=UpdateDescription(), contact=ContactInformation())
        ext_ds.dataset_description.parameters["dataset_path"] = file
        ext_ds.dataset_description.parameters["temporal_dimension"] = 'time'
        self._datasets['mod_var'] = HfrRadialDataHandler(data_source=file, ext_dataset=ext_ds)

        file = self._create_tst_data_set('new_var')

        ext_ds = ExternalDataset(name="new_var", dataset_description=DatasetDescription(), update_description=UpdateDescription(), contact=ContactInformation())
        ext_ds.dataset_description.parameters["dataset_path"] = file
        ext_ds.dataset_description.parameters["temporal_dimension"] = 'time'
        self._datasets['new_var'] = HfrRadialDataHandler(data_source=file, ext_dataset=ext_ds)

        file = self._create_tst_data_set('mod_varatt')

        ext_ds = ExternalDataset(name="mod_varatt", dataset_description=DatasetDescription(), update_description=UpdateDescription(), contact=ContactInformation())
        ext_ds.dataset_description.parameters["dataset_path"] = file
        ext_ds.dataset_description.parameters["temporal_dimension"] = 'time'
        self._datasets['mod_varatt'] = HfrRadialDataHandler(data_source=file, ext_dataset=ext_ds)

        #file = 'http://marine.rutgers.edu/cool/maracoos/codar/ooi/radials/ASSA/RDLi_ASSA_2012_02_09_1100.ruv    '
        #ext_ds = ExternalDataset(name="remote", dataset_description=DatasetDescription(), update_description=UpdateDescription(), contact=ContactInformation())
        #ext_ds.dataset_description.parameters["dataset_path"] = file
        #ext_ds.dataset_description.parameters["temporal_dimension"] = 'time'
        #self._datasets['remote'] = HfrRadialDataHandler(data_source=file, ext_dataset=ext_ds)

        pass
コード例 #3
0
 def setUp(self):
     self._hfr_data_handler = HfrRadialDataHandler(data_source='test_data/RDLi_SEAB_2011_08_24_1600.ruv')
     pass