def _load_dataset(dataset_config_data): """""" if dataset_config_data['data_source'] == 'local': if dataset_config_data['file_count'] > 1: logger.error( 'Multi-file datasets are currently not supported. Cancelling load ' 'of the following dataset: {}'.format(dataset_config_data) ) return None return local.load_file(dataset_config_data['path'], dataset_config_data['variable'], **dataset_config_data.get('optional_args', {})) elif dataset_config_data['data_source'] == 'rcmed': return rcmed.parameter_dataset(dataset_config_data['dataset_id'], dataset_config_data['parameter_id'], dataset_config_data['min_lat'], dataset_config_data['max_lat'], dataset_config_data['min_lon'], dataset_config_data['min_lon'], dataset_config_data['start_time'], dataset_config_data['end_time'], **dataset_config_data.get('optional_args', {})) elif dataset_config_data['data_source'] == 'esgf': return esgf.load_dataset(dataset_config_data['dataset_id'], dataset_config_data['variable'], dataset_config_data['esgf_username'], dataset_config_data['esgf_password'], **dataset_config_data.get('optional_args', {})) elif dataset_config_data['data_source'] == 'dap': return dap.load(dataset_config_data['url'], dataset_config_data['variable'], **dataset_config_data('optional_args', {}))
def _load_dataset(dataset_config_data): """""" if dataset_config_data['data_source'] == 'local': if dataset_config_data['file_count'] > 1: logger.error( 'Multi-file datasets are currently not supported. Cancelling load ' 'of the following dataset: {}'.format(dataset_config_data)) return None return local.load_file(dataset_config_data['path'], dataset_config_data['variable'], **dataset_config_data.get('optional_args', {})) elif dataset_config_data['data_source'] == 'rcmed': return rcmed.parameter_dataset( dataset_config_data['dataset_id'], dataset_config_data['parameter_id'], dataset_config_data['min_lat'], dataset_config_data['max_lat'], dataset_config_data['min_lon'], dataset_config_data['min_lon'], dataset_config_data['start_time'], dataset_config_data['end_time'], **dataset_config_data.get('optional_args', {})) elif dataset_config_data['data_source'] == 'esgf': return esgf.load_dataset( dataset_config_data['dataset_id'], dataset_config_data['variable'], dataset_config_data['esgf_username'], dataset_config_data['esgf_password'], **dataset_config_data.get('optional_args', {})) elif dataset_config_data['data_source'] == 'dap': return dap.load(dataset_config_data['url'], dataset_config_data['variable'], **dataset_config_data('optional_args', {}))
def setUpClass(cls): cls.url = 'http://test.opendap.org/opendap/data/ncml/agg/dated/'\ 'CG2006158_120000h_usfc.nc' cls.name = 'foo' cls.dataset = dap.load(cls.url, 'CGusfc', name=cls.name) '''
def setUpClass(cls): cls.url = 'http://test.opendap.org/opendap/data/ncml/agg/dated/'\ 'CG2006158_120000h_usfc.nc' cls.name = 'foo' ''' The following exception handling should be removed once the opendap servers are working fine. The following code was added to fix the build temporarily More information - https://github.com/apache/climate/pull/419 ''' try : cls.dataset = dap.load(cls.url, 'CGusfc', name=cls.name) # The tests will be skipped if any exception is raised except Exception as e: raise unittest.SkipTest(e) '''
def setUpClass(cls): cls.url = 'http://test.opendap.org/opendap/data/ncml/agg/dated/'\ 'CG2006158_120000h_usfc.nc' cls.name = 'foo' ''' The following exception handling should be removed once the opendap servers are working fine. The following code was added to fix the build temporarily More information - https://github.com/apache/climate/pull/419 ''' try: cls.dataset = dap.load(cls.url, 'CGusfc', name=cls.name) # The tests will be skipped if any exception is raised except Exception as e: raise unittest.SkipTest(e) '''
class test_dap(unittest.TestCase): dataset = dap.load('http://test.opendap.org/dap/data/nc/sst.mnmean.nc.gz', 'sst') def test_dataset_is_returned(self): self.assertTrue(isinstance(self.dataset, Dataset)) def test_correct_lat_shape(self): self.assertEquals(len(self.dataset.lats), 89) def test_correct_lon_shape(self): self.assertEquals(len(self.dataset.lons), 180) def test_correct_time_shape(self): self.assertEquals(len(self.dataset.times), 1857) def test_valid_date_conversion(self): start = dt.datetime(1854, 1, 1) self.assertTrue(start == self.dataset.times[0])
def setup_class(self): self.dataset = dap.load('http://test.opendap.org/dap/data/nc/sst.mnmean.nc.gz', 'sst', name='foo')
def setUpClass(cls): cls.url = 'http://test.opendap.org/opendap/data/ncml/agg/dated/'\ 'CG2006158_120000h_usfc.nc' cls.name = 'foo' cls.dataset = dap.load(cls.url, 'CGusfc', name=cls.name)
def setup_class(self): self.url = 'http://test.opendap.org/opendap/data/ncml/agg/dated/CG2006158_120000h_usfc.nc' self.name = 'foo' self.dataset = dap.load(self.url, 'CGusfc', name=self.name)
def setup_class(self): self.url = 'http://test.opendap.org/dap/data/nc/sst.mnmean.nc.gz' self.name = 'foo' self.dataset = dap.load(self.url, 'sst', name=self.name)
def setup_class(self): dataset = dap.load( 'http://test.opendap.org/dap/data/nc/sst.mnmean.nc.gz', 'sst')