Пример #1
0
 def publications(self) -> Optional[List[Publication]]:
     """Get or sets the list of relevant publications referencing and describing the
     data."""
     return map_opt(
         lambda pubs: [Publication.from_dict(pub) for pub in pubs],
         self._get_property(PUBLICATIONS_PROP, List[Dict[str, Any]]),
     )
Пример #2
0
 def values(self, v: Optional[List[MappingObject]]) -> None:
     self._set_property(
         VALUES_PROP,
         map_opt(
             lambda values: [mapping_obj.to_dict() for mapping_obj in values], v
         ),
     )
Пример #3
0
 def providers(self) -> Optional[List["Provider_Type"]]:
     """Get or set a list of the object's providers."""
     return utils.map_opt(
         lambda providers:
         [pystac.Provider.from_dict(d) for d in providers],
         self._get_field("providers", List[Dict[str, Any]]),
     )
Пример #4
0
 def variables(self, v: Optional[Dict[str, Variable]]) -> None:
     self._set_property(
         VARIABLES_PROP,
         map_opt(
             lambda variables:
             {k: var.to_dict()
              for k, var in variables.items()}, v),
     )
Пример #5
0
 def bands(self) -> Optional[List[RasterBand]]:
     """Get or sets a list of :class:`~pystac.Band` objects that represent
     the available bands.
     """
     return map_opt(
         lambda bands: [RasterBand(b) for b in bands],
         self.summaries.get_list(BANDS_PROP),
     )
Пример #6
0
 def frequency_band(self) -> FrequencyBand:
     """Gets or sets a FrequencyBand for the item."""
     return get_required(
         map_opt(lambda x: FrequencyBand(x),
                 self._get_property(FREQUENCY_BAND_PROP, str)),
         self,
         FREQUENCY_BAND_PROP,
     )
Пример #7
0
 def unpublished(self, v: Optional[RangeSummary[datetime]]) -> None:
     self._set_summary(
         UNPUBLISHED_PROP,
         map_opt(
             lambda s: RangeSummary(datetime_to_str(s.minimum),
                                    datetime_to_str(s.maximum)),
             v,
         ),
     )
Пример #8
0
 def expires(self, v: Optional[RangeSummary[datetime]]) -> None:
     self._set_summary(
         EXPIRES_PROP,
         map_opt(
             lambda s: RangeSummary(datetime_to_str(s.minimum),
                                    datetime_to_str(s.maximum)),
             v,
         ),
     )
Пример #9
0
    def label_classes(self) -> Optional[List[LabelClasses]]:
        """Get or sets the summary of :attr:`LabelExtension.label_classes` values
        for this Collection.
        """

        return map_opt(
            lambda classes: [LabelClasses(c) for c in classes],
            self.summaries.get_list(CLASSES_PROP),
        )
Пример #10
0
 def publications(self, v: Optional[List[Publication]]) -> None:
     self._set_property(
         PUBLICATIONS_PROP,
         map_opt(lambda pubs: [pub.to_dict() for pub in pubs], v))
     if v is not None:
         for pub in v:
             pub_link = pub.get_link()
             if pub_link is not None:
                 self.obj.add_link(pub_link)
Пример #11
0
 def anx_datetime(self, v: Optional[RangeSummary[Datetime]]) -> None:
     self._set_summary(
         ANX_DATETIME_PROP,
         map_opt(
             lambda s: RangeSummary(datetime_to_str(s.minimum),
                                    datetime_to_str(s.maximum)),
             v,
         ),
     )
Пример #12
0
    def bands(self) -> Optional[List[Band]]:
        """Get or sets the summary of :attr:`EOExtension.bands` values
        for this Collection.
        """

        return map_opt(
            lambda bands: [Band(b) for b in bands],
            self.summaries.get_list(BANDS_PROP),
        )
Пример #13
0
 def polarizations(self) -> List[Polarization]:
     """Gets or sets a list of polarizations for the item."""
     return get_required(
         map_opt(
             lambda values: [Polarization(v) for v in values],
             self._get_property(POLARIZATIONS_PROP, List[str]),
         ),
         self,
         POLARIZATIONS_PROP,
     )
Пример #14
0
    def expires(self) -> Optional[RangeSummary[datetime]]:
        """Get or sets the summary of :attr:`TimestampsExtension.expires` values
        for this Collection.
        """

        return map_opt(
            lambda s: RangeSummary(str_to_datetime(s.minimum),
                                   str_to_datetime(s.maximum)),
            self.summaries.get_range(EXPIRES_PROP),
        )
Пример #15
0
    def unpublished(self) -> Optional[RangeSummary[datetime]]:
        """Get or sets the summary of :attr:`TimestampsExtension.unpublished` values
        for this Collection.
        """

        return map_opt(
            lambda s: RangeSummary(str_to_datetime(s.minimum),
                                   str_to_datetime(s.maximum)),
            self.summaries.get_range(UNPUBLISHED_PROP),
        )
Пример #16
0
    def expires(self) -> Optional[datetime]:
        """Gets or sets a datetime object that represents the date and time the
        corresponding data expires (is not valid any longer).

        'Unpublished' has a different meaning depending on where it is used. If
        available in the asset properties, it refers to the timestamps valid for the
        actual data linked to the Asset Object. If it comes from the Item properties,
        it refers to to the timestamp valid for the metadata.
        """
        return map_opt(str_to_datetime, self._get_property(EXPIRES_PROP, str))
Пример #17
0
    def published(self) -> Optional[datetime]:
        """Gets or sets a datetime object that represents the date and time that the
        corresponding data was published the first time.

        'Published' has a different meaning depending on where it is used. If available
        in the asset properties, it refers to the timestamps valid for the actual data
        linked to the Asset Object. If it comes from the Item properties, it refers to
        timestamp valid for the metadata.
        """
        return map_opt(str_to_datetime,
                       self._get_property(PUBLISHED_PROP, str))
Пример #18
0
 def values(self) -> Optional[List[MappingObject]]:
     """Get or sets the list of :class:`~MappingObject` instances that lists the
     values that are in the file and describe their meaning. See the
     :stac-ext:`Mapping Object <file#mapping-object>` docs for an example. If given,
     at least one array element is required."""
     return map_opt(
         lambda values: [
             MappingObject.from_dict(mapping_obj) for mapping_obj in values
         ],
         self._get_property(VALUES_PROP, List[Dict[str, Any]]),
     )
Пример #19
0
    def updated(self) -> Optional[Datetime]:
        """Get or set the metadata file's update date. All datetime attributes have
        setters that can take either a string or a datetime, but always stores
        the attribute as a string

        Note:
            ``updated`` has a different meaning depending on the type of STAC object.
            On an :class:`~pystac.Item`, it refers to the update time of the
            metadata. On an :class:`~pystac.Asset`, it refers to the update time of
            the actual data linked to in :attr:`Asset.href <pystac.Asset.href`.
        """
        return utils.map_opt(utils.str_to_datetime,
                             self._get_field("updated", str))
Пример #20
0
 def bands(self, v: Optional[List[Band]]) -> None:
     self._set_summary(BANDS_PROP,
                       map_opt(lambda x: [b.to_dict() for b in x], v))
Пример #21
0
 def _get_bands(self) -> Optional[List[Band]]:
     return map_opt(
         lambda bands: [Band(b) for b in bands],
         self._get_property(BANDS_PROP, List[Dict[str, Any]]),
     )
Пример #22
0
 def orbit_state(self, v: Optional[OrbitState]) -> None:
     self._set_property(ORBIT_STATE_PROP, map_opt(lambda x: x.value, v))
Пример #23
0
 def bands(self, v: Optional[List[Band]]) -> None:
     self._set_property(
         BANDS_PROP, map_opt(lambda bands: [b.to_dict() for b in bands], v))
Пример #24
0
 def statistics(self) -> Optional[List[Statistic]]:
     return map_opt(
         lambda stats: [Statistic(d) for d in stats],
         self.summaries.get_list(STATISTICS_PROP),
     )
Пример #25
0
 def orbit_state(self) -> Optional[OrbitState]:
     """Get or sets an orbit state of the object."""
     return map_opt(lambda x: OrbitState(x),
                    self._get_property(ORBIT_STATE_PROP, str))
Пример #26
0
 def anx_datetime(self) -> Optional[RangeSummary[Datetime]]:
     return map_opt(
         lambda s: RangeSummary(str_to_datetime(s.minimum),
                                str_to_datetime(s.maximum)),
         self.summaries.get_range(ANX_DATETIME_PROP),
     )
Пример #27
0
 def anx_datetime(self, v: Optional[Datetime]) -> None:
     self._set_property(ANX_DATETIME_PROP, map_opt(datetime_to_str, v))
Пример #28
0
 def anx_datetime(self) -> Optional[Datetime]:
     return map_opt(str_to_datetime,
                    self._get_property(ANX_DATETIME_PROP, str))
Пример #29
0
 def statistics(self, v: Optional[List[Statistic]]) -> None:
     self._set_summary(
         STATISTICS_PROP,
         map_opt(lambda stats: [s.to_dict() for s in stats], v),
     )
Пример #30
0
 def label_classes(self, v: Optional[List[LabelClasses]]) -> None:
     self._set_summary(
         CLASSES_PROP,
         map_opt(lambda classes: [c.to_dict() for c in classes], v))