Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _single_band(self, **kwargs):
if "bands" not in kwargs:
kwargs["bands"] = [0]
arr = self._read(self, **kwargs)
return arr[0,:,:]
class WV03_VNIR(WorldViewImage):
pass
class WV02(WorldViewImage):
pass
class WV01(WorldViewImage):
class WV01Driver(RDADaskImageDriver):
image_option_support = ["proj", "gsd", "band_type", "correctionType", "dtype"]
__image_option_defaults__ = {"band_type": "pan", "correctionType": "DN", "dtype": None}
__Driver__ = WV01Driver
class WV04(WorldViewImage):
@property
def _rgb_bands(self):
return [2,1,0]
def _ndvi_bands(self):
return [1,3]
from gbdxtools.images.base import RDABaseImage
from gbdxtools.images.drivers import RDADaskImageDriver
from gbdxtools.images.util.image import reproject_params
from gbdxtools.rda.interface import RDA
rda = RDA()
class ModisDriver(RDADaskImageDriver):
image_option_support = ["proj"]
__image_option_defaults__ = {"proj": None}
class Modis(RDABaseImage):
"""
Dask based access to Modis images backed by rda Graphs.
Args:
catalog_id (str): The Catalog ID for the modis image.
"""
__Driver__ = ModisDriver
@property
def _id(self):
return self.__rda_id__
import os
from gbdxtools.images.base import RDABaseImage
from gbdxtools.images.drivers import RDADaskImageDriver
from gbdxtools.rda.util import ortho_params
from gbdxtools.rda.interface import RDA
rda = RDA()
class RadarsatDriver(RDADaskImageDriver):
image_option_support = ["calibration", "proj"]
__image_option_defaults__ = {"calibration": "uncalibrated", "proj": "EPSG:4326"}
class Radarsat(RDABaseImage):
"""
Dask based access to Radarsat images backed by rda Graphs.
Args:
catID (str): The Radarsat record from the Radarsat Catalog Item
calibration (str): Data calibration. Options are 'uncalibrated' (default), 'beta0', 'sigma0' or 'gamma'.
proj (str): EPSG code for the resulting image.
gsd (str): Resolution for the resulting image.
"""
__Driver__ = RadarsatDriver
from gbdxtools.images.drivers import RDADaskImageDriver
from gbdxtools.rda.interface import RDA
from gbdxtools.rda.error import IncompatibleOptions
from gbdxtools.rda.util import ortho_params
rda = RDA()
band_types = {
'MS': 'multispectral',
'ms': 'multispectral',
'Panchromatic': 'panchromatic',
'Pan': 'panchromatic',
'pan': 'panchromatic',
'thermal': 'thermal'
}
class IkonosDriver(RDADaskImageDriver):
image_option_support = ["proj", "gsd", "band_type", "pansharpen"]
__image_option_defaults__ = {"gsd": None, "band_type": "MS", "pansharpen": False}
class IkonosImage(RDABaseImage):
"""
Dask based access to ikonos images backed by RDA Graphs.
"""
__Driver__ = IkonosDriver
@property
def _record(self):
return self.__rda_id__
@property
def _spec(self):
return self.options["band_type"]
from gbdxtools.images.base import RDABaseImage
from gbdxtools.images.drivers import RDADaskImageDriver
from gbdxtools.rda.util import reproject_params
from gbdxtools.rda.interface import RDA
rda = RDA()
from shapely.geometry import box
class DemDriver(RDADaskImageDriver):
image_option_support = ["proj", "bbox"]
__image_option_defaults__ = {"bbox": None}
class DemImage(RDABaseImage):
''' Image class for Digital Elevation Model (DEM) data from the NED/SRTM dataset.
This class has no Catalog IDs and is created by passing an AOI. It shares most of the same methods as CatalogImage objects.
Args:
aoi (list): list of coordinate in BBOX format
proj (str): (optional) EPSG string of projection reproject to. Native projection is "EPSG:4326" (WGS84)
Example:
>>> dem = DemImage(aoi=[5.279, 60.358, 5.402, 60.419])'''
__Driver__ = DemDriver
def _rgb_bands(self):
return [2,1,0]
@property
def _ndvi_bands(self):
return [1,3]
@classmethod
def _build_graph(cls, prefix, spec="10m", proj=None, **kwargs):
sentinel2 = rda.Sentinel2Template(sentinelId=prefix, sentinelProductSpec=spec, nodeId="Sentinel2Read")
if proj is not None:
sentinel2 = sentinel2(nodeId="Reproject", **reproject_params(proj))
return sentinel2
class Sentinel1Driver(RDADaskImageDriver):
image_option_support = ["polarization", "proj"]
__image_option_defaults__ = {"polarization": "VH", "proj": None}
class Sentinel1(RDABaseImage):
"""
Dask based access to Sentinel1 images backed by rda Graphs.
Args:
catID (str): The Sentinel CatalogID from the Sentinel1 Catalog Item
polarization (str): The Polarization type. Defaults to 'VH' (default), 'VV', 'HH', or 'VV'
proj (str): EPSG code for the resulting image.
"""
__Driver__ = Sentinel1Driver
@property
from gbdxtools.images.base import RDABaseImage
from gbdxtools.images.drivers import RDADaskImageDriver
from gbdxtools.images.util.image import reproject_params
from gbdxtools.rda.interface import RDA
rda = RDA()
class Sentinel2Driver(RDADaskImageDriver):
image_option_support = ["spec", "proj"]
__image_option_defaults__ = {"spec": "10m", "proj": None}
class Sentinel2(RDABaseImage):
"""
Dask based access to Sentinel2 images backed by rda Graphs.
Args:
prefix (str): The Sentinel data location from Catalog metadata item 'bucketPrefix'
spec (str): Sensor group to use, values are '10m' (default), '20m', and '60m'
proj (str): EPSG code for the resulting image, defaults to EPSG:4326 (WGS 84 Lat/Lon)
"""
__Driver__ = Sentinel2Driver
@property
from gbdxtools.images.drivers import RDADaskImageDriver
from gbdxtools.images.util.image import reproject_params
from gbdxtools.rda.error import IncompatibleOptions
from gbdxtools.rda.interface import RDA
rda = RDA()
band_types = {
'MS': 'multispectral',
'ms': 'multispectral',
'Panchromatic': 'panchromatic',
'Pan': 'panchromatic',
'pan': 'panchromatic',
'thermal': 'thermal'
}
class LandsatDriver(RDADaskImageDriver):
__default_options__ = {}
image_option_support = ["band_type", "proj", "pansharpen"]
__image_option_defaults__ = {"band_type": "MS", "proj": None, "pansharpen": False}
class LandsatImage(RDABaseImage):
"""
Dask based access to landsat image backed by rda Graphs.
"""
__Driver__ = LandsatDriver
@property
def _id(self):
return self.__rda_id__
@property
def _spec(self):