# Path: gbdxtools/images/base.py
# class RDABaseImage(RDAImage):
#     __rda_id__ = None
#     def __new__(cls, rda_id=None, **kwargs):
#         cls = cls.__Driver__(rda_id=rda_id, **kwargs).drive(cls, **kwargs)
#         self = super(RDABaseImage, cls).__new__(cls, cls.__driver__.payload, **kwargs)
#         return self.__post_new_hook__(**kwargs)
# 
#     def __post_new_hook__(self, **kwargs):
#         return self.aoi(**kwargs)
# 
#     @property
#     def options(self):
#         return self.__driver__.options
# 
#     @property
#     def _graph(self):
#         return self.__driver__.graph
# 
# Path: gbdxtools/images/drivers/base.py
# class RDADaskImageDriver(RDADriverInterface, metaclass=OptionParserFactory):
#     __default_options__ = RDA_DEFAULT_OPTIONS
#     __image_option_defaults__ = {}
#     image_option_support = []
# 
#     def __init__(self, rda_id=None, **kwargs):
#         self.rda_id = rda_id
#         options = kwargs.get("rda_options")
#         if not options:
#             options = self.parse_options(kwargs)
#             options = self.configure_options(options._asdict())
#         self._options = options
#         self._graph = None
#         self._payload = None
# 
#     def parse_options(self, inputs):
#         options = self.parser(**{opt: inputs[opt] for opt in self.image_option_support if opt in inputs})
#         return options
# 
#     @property
#     def options(self):
#         if not self._options:
#             raise DriverConfigurationError("Image options not provided")
#         if isinstance(self._options, dict):
#             return self._options
#         return self._options._asdict()
# 
#     @property
#     def graph(self):
#         if not self._graph:
#             raise DriverConfigurationError("Image graph not configured")
#         return self._graph
# 
#     @classmethod
#     def configure_options(cls, options):
#         return options
# 
#     @property
#     def payload(self):
#         return self.graph
# 
#     @payload.setter
#     def payload(self, payload):
#         self._payload = payload
# 
#     def build_payload(self, target):
#         # build_graph should always return an rda graph / dask meta
#         graph = target._build_graph(self.rda_id, **self.options)
#         self._graph = graph
# 
#     def drive(self, target, **kwargs):
#         if not self.rda_id:
#             rda_id = getattr(target, "__rda_id__", None)
#             if not rda_id:
#                 raise AttributeError("RDA Image ID not provided")
#             self.rda_id = rda_id
#         target.__driver__ = self
#         target.__rda_id__ = self.rda_id
#         target.__supported_options__ = self.image_option_support
#         target.__default_options__ = self.default_options
#         self.build_payload(target)
#         return target
# 
# Path: gbdxtools/images/util/image.py
# def reproject_params(proj):
#     _params = {}
#     if proj is not None:
#         _params["SourceSRSCode"] = "EPSG:4326"
#         _params["DestSRSCode"] = proj
#     return _params
# 
# Path: gbdxtools/rda/interface.py
# class RDA(object):
#     def __getattr__(self, name, **kwargs):
#         return Op(name=name, interface=Auth(), **kwargs)


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
        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
    def _id(self):
        return self.__rda_id__

    @property
    def _spec(self):
        return self.options["spec"]

    @property
    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



# Path: gbdxtools/images/base.py
# class RDABaseImage(RDAImage):
#     __rda_id__ = None
#     def __new__(cls, rda_id=None, **kwargs):
#         cls = cls.__Driver__(rda_id=rda_id, **kwargs).drive(cls, **kwargs)
#         self = super(RDABaseImage, cls).__new__(cls, cls.__driver__.payload, **kwargs)
#         return self.__post_new_hook__(**kwargs)
# 
#     def __post_new_hook__(self, **kwargs):
#         return self.aoi(**kwargs)
# 
#     @property
#     def options(self):
#         return self.__driver__.options
# 
#     @property
#     def _graph(self):
#         return self.__driver__.graph
# 
# Path: gbdxtools/images/drivers/base.py
# class RDADaskImageDriver(RDADriverInterface, metaclass=OptionParserFactory):
#     __default_options__ = RDA_DEFAULT_OPTIONS
#     __image_option_defaults__ = {}
#     image_option_support = []
# 
#     def __init__(self, rda_id=None, **kwargs):
#         self.rda_id = rda_id
#         options = kwargs.get("rda_options")
#         if not options:
#             options = self.parse_options(kwargs)
#             options = self.configure_options(options._asdict())
#         self._options = options
#         self._graph = None
#         self._payload = None
# 
#     def parse_options(self, inputs):
#         options = self.parser(**{opt: inputs[opt] for opt in self.image_option_support if opt in inputs})
#         return options
# 
#     @property
#     def options(self):
#         if not self._options:
#             raise DriverConfigurationError("Image options not provided")
#         if isinstance(self._options, dict):
#             return self._options
#         return self._options._asdict()
# 
#     @property
#     def graph(self):
#         if not self._graph:
#             raise DriverConfigurationError("Image graph not configured")
#         return self._graph
# 
#     @classmethod
#     def configure_options(cls, options):
#         return options
# 
#     @property
#     def payload(self):
#         return self.graph
# 
#     @payload.setter
#     def payload(self, payload):
#         self._payload = payload
# 
#     def build_payload(self, target):
#         # build_graph should always return an rda graph / dask meta
#         graph = target._build_graph(self.rda_id, **self.options)
#         self._graph = graph
# 
#     def drive(self, target, **kwargs):
#         if not self.rda_id:
#             rda_id = getattr(target, "__rda_id__", None)
#             if not rda_id:
#                 raise AttributeError("RDA Image ID not provided")
#             self.rda_id = rda_id
#         target.__driver__ = self
#         target.__rda_id__ = self.rda_id
#         target.__supported_options__ = self.image_option_support
#         target.__default_options__ = self.default_options
#         self.build_payload(target)
#         return target
# 
# Path: gbdxtools/images/util/image.py
# def reproject_params(proj):
#     _params = {}
#     if proj is not None:
#         _params["SourceSRSCode"] = "EPSG:4326"
#         _params["DestSRSCode"] = proj
#     return _params
# 
# Path: gbdxtools/rda/interface.py
# class RDA(object):
#     def __getattr__(self, name, **kwargs):
#         return Op(name=name, interface=Auth(), **kwargs)


# Path: gbdxtools/images/sentinel.py
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

        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
    def _id(self):
        return self.__rda_id__

    @property
    def _spec(self):
        return self.options["spec"]

    @property
    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):