def test_coordinates_valid_times_given_toa_brightness_temperature(tmpdir): path = str(tmpdir / "test-navigate-eida50.nc") times = [dt.datetime(2019, 1, 1)] with netCDF4.Dataset(path, "w") as dataset: _eida50(dataset, times) coord = eida50.Coordinates() result = coord.valid_times(path, "toa_brightness_temperature") expect = times assert expect == result
def test_valid_times_given_eida50_toa_brightness_temperature(self): times = [dt.datetime(2019, 1, 1)] with netCDF4.Dataset(self.path, "w") as dataset: writer = Formatter(dataset) writer.define(times) coord = eida50.Coordinates() result = coord.valid_times(self.path, "toa_brightness_temperature") expect = times self.assertEqual(expect, result)
def file_type(cls, paths, file_type): if file_type.lower() == "rdt": coordinates = rdt.Coordinates() elif file_type.lower() == "eida50": coordinates = eida50.Coordinates() elif file_type.lower() == 'griddedforecast': # XXX This needs a "Group" object ... not "paths" return gridded_forecast.Navigator(paths) elif file_type.lower() == "unified_model": coordinates = unified_model.Coordinates() else: raise Exception("Unrecognised file type: '{}'".format(file_type)) return cls(paths, coordinates)
def from_file_type(cls, paths, file_type): if file_type.lower() == "rdt": coordinates = rdt.Coordinates() elif file_type.lower() == "eida50": coordinates = eida50.Coordinates() elif file_type.lower() == 'griddedforecast': # XXX This needs a "Group" object ... not "paths" return gridded_forecast.Navigator(paths) elif file_type.lower() == 'intake': return intake_loader.Navigator() elif file_type.lower() == 'ghrsstl4': return ghrsstl4.Navigator(paths) elif file_type.lower() == "unified_model": coordinates = unified_model.Coordinates() elif file_type.lower() == "saf": coordinates = saf.Coordinates() elif file_type.lower() == "earth_networks": coordinates = earth_networks.Coordinates() else: raise Exception("Unrecognised file type: '{}'".format(file_type)) return cls(paths, coordinates)