コード例 #1
0
ファイル: scientific.py プロジェクト: duckontheweb/pystac
 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
ファイル: file.py プロジェクト: stac-utils/pystac
 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
ファイル: common_metadata.py プロジェクト: stac-utils/pystac
 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
ファイル: sar.py プロジェクト: duckontheweb/pystac
 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
ファイル: label.py プロジェクト: stac-utils/pystac
    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
ファイル: scientific.py プロジェクト: duckontheweb/pystac
 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
ファイル: sat.py プロジェクト: stac-utils/pystac
 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
ファイル: eo.py プロジェクト: duckontheweb/pystac
    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
ファイル: sar.py プロジェクト: duckontheweb/pystac
 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
ファイル: file.py プロジェクト: stac-utils/pystac
 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
ファイル: common_metadata.py プロジェクト: stac-utils/pystac
    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
ファイル: eo.py プロジェクト: duckontheweb/pystac
 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
ファイル: eo.py プロジェクト: duckontheweb/pystac
 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
ファイル: sat.py プロジェクト: stac-utils/pystac
 def orbit_state(self, v: Optional[OrbitState]) -> None:
     self._set_property(ORBIT_STATE_PROP, map_opt(lambda x: x.value, v))
コード例 #23
0
ファイル: eo.py プロジェクト: duckontheweb/pystac
 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
ファイル: pointcloud.py プロジェクト: stac-utils/pystac
 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
ファイル: sat.py プロジェクト: stac-utils/pystac
 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
ファイル: sat.py プロジェクト: stac-utils/pystac
 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
ファイル: sat.py プロジェクト: stac-utils/pystac
 def anx_datetime(self, v: Optional[Datetime]) -> None:
     self._set_property(ANX_DATETIME_PROP, map_opt(datetime_to_str, v))
コード例 #28
0
ファイル: sat.py プロジェクト: stac-utils/pystac
 def anx_datetime(self) -> Optional[Datetime]:
     return map_opt(str_to_datetime,
                    self._get_property(ANX_DATETIME_PROP, str))
コード例 #29
0
ファイル: pointcloud.py プロジェクト: stac-utils/pystac
 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
ファイル: label.py プロジェクト: stac-utils/pystac
 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))