How to use the descarteslabs.catalog.attributes.ListAttribute function in descarteslabs

To help you get started, we’ve selected a few descarteslabs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github descarteslabs / descarteslabs-python / descarteslabs / catalog / image_upload.py View on Github external
_doc_type = "image_upload"
    _url = "/uploads"

    product_id = Attribute(_mutable=False)
    image_id = Attribute(_mutable=False)
    image = CatalogObjectReference(
        Image, _allow_unsaved=True, _mutable=False, _serializable=True, _sticky=True
    )
    image_upload_options = ImageUploadOptions(_sticky=True)
    resumable_urls = Attribute(_serializable=False)
    status = EnumAttribute(ImageUploadStatus)
    start_datetime = ImmutableTimestamp()
    end_datetime = ImmutableTimestamp()
    job_id = Attribute()
    events = Attribute()
    errors = ListAttribute(UploadError, _mutable=False)

    def __init__(self, **kwargs):
        if kwargs.get("id") is None:
            kwargs["id"] = str(uuid.uuid4())

        super(ImageUpload, self).__init__(**kwargs)

    # override this to interpret 404s as PENDING and to not expect complete object
    # state until new ingest is available
    def reload(self):
        """Reload all attributes from the Descartes Labs catalog.

        Refresh the state of this catalog object from the object in the Descartes Labs
        catalog.  This way you can refresh the status and other attributes.

        Raises
github descarteslabs / descarteslabs-python / descarteslabs / catalog / catalog_base.py View on Github external
_derived_type_switch = None

    _model_classes_by_type_and_derived_type = {}

    class _RequestMethod(str, Enum):
        POST = "post"
        PATCH = "patch"
        PUT = "put"
        GET = "get"

    id = Attribute(_mutable=False, _serializable=False)
    created = ImmutableTimestamp()
    modified = ImmutableTimestamp()
    owners = ListAttribute(Attribute)
    readers = ListAttribute(Attribute)
    writers = ListAttribute(Attribute)
    extra_properties = Attribute()
    tags = ListAttribute(Attribute)

    def __new__(cls, *args, **kwargs):
        return _new_abstract_class(cls, CatalogObject)

    def __init__(self, **kwargs):
        self.delete = self._instance_delete
        self._client = kwargs.pop("client", None) or CatalogClient.get_default_client()

        self._attributes = {}
        self._modified = set()

        self._initialize(
            id=kwargs.pop("id", None),
            saved=kwargs.pop("_saved", False),
github descarteslabs / descarteslabs-python / descarteslabs / catalog / catalog_base.py View on Github external
# Attribute to use to determine the derived type of an instance
    _derived_type_switch = None

    _model_classes_by_type_and_derived_type = {}

    class _RequestMethod(str, Enum):
        POST = "post"
        PATCH = "patch"
        PUT = "put"
        GET = "get"

    id = Attribute(_mutable=False, _serializable=False)
    created = ImmutableTimestamp()
    modified = ImmutableTimestamp()
    owners = ListAttribute(Attribute)
    readers = ListAttribute(Attribute)
    writers = ListAttribute(Attribute)
    extra_properties = Attribute()
    tags = ListAttribute(Attribute)

    def __new__(cls, *args, **kwargs):
        return _new_abstract_class(cls, CatalogObject)

    def __init__(self, **kwargs):
        self.delete = self._instance_delete
        self._client = kwargs.pop("client", None) or CatalogClient.get_default_client()

        self._attributes = {}
        self._modified = set()

        self._initialize(
github descarteslabs / descarteslabs-python / descarteslabs / catalog / image.py View on Github external
# Stored files
    storage_state = EnumAttribute(StorageState)
    files = ListAttribute(File)

    # Image properties
    area = Attribute()
    azimuth_angle = Attribute()
    bits_per_pixel = ListAttribute(Attribute)
    bright_fraction = Attribute()
    cloud_fraction = Attribute()
    alt_cloud_fraction = Attribute()
    processing_pipeline_id = Attribute()
    fill_fraction = Attribute()
    incidence_angle = Attribute()
    reflectance_scale = ListAttribute(Attribute)
    roll_angle = Attribute()
    solar_azimuth_angle = Attribute()
    solar_elevation_angle = Attribute()
    view_angle = Attribute()
    satellite_id = Attribute()

    # Provider info
    provider_id = Attribute()
    provider_url = Attribute()
    preview_url = Attribute()
    preview_file = Attribute()

    @classmethod
    def search(cls, client=None):
        """A search query for all images.
github descarteslabs / descarteslabs-python / descarteslabs / catalog / image.py View on Github external
x_pixels = Attribute()
    y_pixels = Attribute()

    # Time dimensions
    acquired = Timestamp()
    acquired_end = Timestamp()
    published = Timestamp()

    # Stored files
    storage_state = EnumAttribute(StorageState)
    files = ListAttribute(File)

    # Image properties
    area = Attribute()
    azimuth_angle = Attribute()
    bits_per_pixel = ListAttribute(Attribute)
    bright_fraction = Attribute()
    cloud_fraction = Attribute()
    alt_cloud_fraction = Attribute()
    processing_pipeline_id = Attribute()
    fill_fraction = Attribute()
    incidence_angle = Attribute()
    reflectance_scale = ListAttribute(Attribute)
    roll_angle = Attribute()
    solar_azimuth_angle = Attribute()
    solar_elevation_angle = Attribute()
    view_angle = Attribute()
    satellite_id = Attribute()

    # Provider info
    provider_id = Attribute()
    provider_url = Attribute()
github descarteslabs / descarteslabs-python / descarteslabs / catalog / image.py View on Github external
# Geo referencing
    geometry = GeometryAttribute()
    cs_code = Attribute()
    projection = Attribute()
    geotrans = Attribute()
    x_pixels = Attribute()
    y_pixels = Attribute()

    # Time dimensions
    acquired = Timestamp()
    acquired_end = Timestamp()
    published = Timestamp()

    # Stored files
    storage_state = EnumAttribute(StorageState)
    files = ListAttribute(File)

    # Image properties
    area = Attribute()
    azimuth_angle = Attribute()
    bits_per_pixel = ListAttribute(Attribute)
    bright_fraction = Attribute()
    cloud_fraction = Attribute()
    alt_cloud_fraction = Attribute()
    processing_pipeline_id = Attribute()
    fill_fraction = Attribute()
    incidence_angle = Attribute()
    reflectance_scale = ListAttribute(Attribute)
    roll_angle = Attribute()
    solar_azimuth_angle = Attribute()
    solar_elevation_angle = Attribute()
    view_angle = Attribute()
github descarteslabs / descarteslabs-python / descarteslabs / catalog / catalog_base.py View on Github external
# Attribute to use to determine the derived type of an instance
    _derived_type_switch = None

    _model_classes_by_type_and_derived_type = {}

    class _RequestMethod(str, Enum):
        POST = "post"
        PATCH = "patch"
        PUT = "put"
        GET = "get"

    id = Attribute(_mutable=False, _serializable=False)
    created = ImmutableTimestamp()
    modified = ImmutableTimestamp()
    owners = ListAttribute(Attribute)
    readers = ListAttribute(Attribute)
    writers = ListAttribute(Attribute)
    extra_properties = Attribute()
    tags = ListAttribute(Attribute)

    def __new__(cls, *args, **kwargs):
        return _new_abstract_class(cls, CatalogObject)

    def __init__(self, **kwargs):
        self.delete = self._instance_delete
        self._client = kwargs.pop("client", None) or CatalogClient.get_default_client()

        self._attributes = {}
        self._modified = set()

        self._initialize(
            id=kwargs.pop("id", None),
github descarteslabs / descarteslabs-python / descarteslabs / catalog / image_upload.py View on Github external
----------
    upload_type : str
        Required: Type of upload job, see :class:`ImageUploadType`.
    image_files : list(str)
        Required: file basenames of the uploaded files.
    overviews : list(int)
        Overview generation control, only used when ``upload_type ==
        ImageUploadType::NDARRAY``.
    overview_resampler : :class:`OverviewResampler`
        Overview resampler method, only used when ``upload_type ==
        ImageUploadType::NDARRAY``.
    """

    upload_type = EnumAttribute(ImageUploadType)
    image_files = ListAttribute(Attribute)
    overviews = ListAttribute(Attribute)
    overview_resampler = EnumAttribute(OverviewResampler)


class UploadError(MappingAttribute):
    """Image upload error data.

    Attributes
    ----------
    stacktrace : str
        Stacktrace from the error generated by the ImageUpload operation.
    error_type: str
        Type of exception triggered.
    component : str
        Component of the upload process that triggered the error.
    component_id : str
        Identifier for the `component` that errored.
github descarteslabs / descarteslabs-python / descarteslabs / catalog / image_upload.py View on Github external
Attributes
    ----------
    upload_type : str
        Required: Type of upload job, see :class:`ImageUploadType`.
    image_files : list(str)
        Required: file basenames of the uploaded files.
    overviews : list(int)
        Overview generation control, only used when ``upload_type ==
        ImageUploadType::NDARRAY``.
    overview_resampler : :class:`OverviewResampler`
        Overview resampler method, only used when ``upload_type ==
        ImageUploadType::NDARRAY``.
    """

    upload_type = EnumAttribute(ImageUploadType)
    image_files = ListAttribute(Attribute)
    overviews = ListAttribute(Attribute)
    overview_resampler = EnumAttribute(OverviewResampler)


class UploadError(MappingAttribute):
    """Image upload error data.

    Attributes
    ----------
    stacktrace : str
        Stacktrace from the error generated by the ImageUpload operation.
    error_type: str
        Type of exception triggered.
    component : str
        Component of the upload process that triggered the error.
    component_id : str