def read_data(datasets, measurements, geobox, resampling=Resampling.nearest, **kwargs): if not hasattr(datasets, "__iter__"): datasets = [datasets] datasets = datacube.Datacube.group_datasets(datasets, 'solar_day') set_default_rio_config(aws=dict(aws_unsigned=True), cloud_defaults=True) data = datacube.Datacube.load_data( datasets, geobox, measurements=measurements, fuse_func=kwargs.get('fuse_func', None)) # maintain compatibility with functions not expecting the data to have a time dimension return data.squeeze(dim='time', drop=True)
def test_rio_env_via_config(): ee = activate_from_config() assert ee is not None # Second call should not change anything assert activate_from_config() is None set_default_rio_config(aws=None, cloud_defaults=True) # config change should activate new env ee = activate_from_config() assert ee is not None assert 'GDAL_DISABLE_READDIR_ON_OPEN' in ee deactivate_rio_env() assert get_rio_env() == {}
middleware = FlaskMiddleware(app, exporter=jaegerExporter) _LOG.info("Opencensus tracing enabled") # If invoked using Gunicorn, link our root logger to the gunicorn logger # this will mean the root logs will be captured and managed by the gunicorn logger # allowing you to set the gunicorn log directories and levels for logs # produced by this application _LOG.setLevel(logging.getLogger('gunicorn.error').getEffectiveLevel()) if os.environ.get("prometheus_multiproc_dir", False): from datacube_ows.metrics.prometheus import setup_prometheus setup_prometheus(app) _LOG.info("Prometheus metrics enabled") if os.environ.get("AWS_DEFAULT_REGION"): set_default_rio_config(aws=dict(aws_unsigned=True, region_name="auto"), cloud_defaults=True) else: set_default_rio_config() _LOG.warning( "Environment variable $AWS_DEFAULT_REGION not set. (This warning can be ignored if all data is stored locally.)" ) class SupportedSvcVersion(object): def __init__(self, service, version, router, exception_class): self.service = service.lower() self.service_upper = service.upper() self.version = version self.version_parts = version.split(".") assert len(self.version_parts) == 3 self.router = router