def test_variable_names(self): expected_band_names = [ 'B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B10', 'B11', 'B12', 'viewZenithMean', 'viewAzimuthMean', 'sunZenithAngles', 'sunAzimuthAngles' ] sentinel_hub = SentinelHub(session=SessionMock({ 'get': { 'https://services.sentinel-hub.com/api/v1/process/dataset/S2L2A/bands': { 'data': expected_band_names } } })) self.assertEqual(expected_band_names, sentinel_hub.band_names('S2L2A')) sentinel_hub.close()
def info(datasets: List[str] = None): """ Print SentinelHub metadata info. If DATASETS (names of datasets) are not present, the list of available dataset names are returned. Otherwise, the the variables of the given datasets are returned. """ from xcube_sh.sentinelhub import SentinelHub sentinel_hub = SentinelHub() import json if not datasets: response = dict(datasets=sentinel_hub.dataset_names) else: response = dict() for dataset_name in datasets: band_names = sentinel_hub.band_names(dataset_name) bands = dict() for band_name in band_names: bands[band_name] = sentinel_hub.METADATA.dataset_band(dataset_name, band_name, default={}) response[dataset_name] = bands print(json.dumps(response, indent=2))