Пример #1
0
    def metadata(self, dataset, id_list):
        """Request metadata for a given list of scenes.

        Parameters
        ----------
        dataset : str
            LANDSAT_TM_C1, LANDSAT_ETM_C1 or LANDSAT_8_C1.
        id_list : list of str
            List of product id or legacy scene id.

        Returns
        -------
        results : dict
            Results as a dictionnary.
        """
        if is_product_id(id_list[0]):
            id_list = self.lookup(dataset, id_list, inverse=True)
        params = {
            'datasetName': dataset,
            'entityIds': id_list,
            'includeDataAccess': True,
            'includeBrowse': True,
            'includeSpatial': True
        }
        response = self.request('metadata', **params)
        return {item['displayId']: item for item in response}
Пример #2
0
 def download(self, scene_id, output_dir):
     """Download a Landsat scene given its identifier and an output
     directory.
     """
     dataset = guess_dataset(scene_id)
     if is_product_id(scene_id):
         scene_id = self.api.lookup(dataset, [scene_id], inverse=True)[0]
     url = EE_DOWNLOAD_URL.format(folder=EE_FOLDER[dataset], sid=scene_id)
     filename = self._download(url, output_dir, file_size=SIZES[dataset])
     return filename
Пример #3
0
 def download(self, scene_id, output_dir):
     """Download a Landsat scene given its identifier and an output
     directory.
     """
     os.makedirs(output_dir, exist_ok=True)
     dataset = guess_dataset(scene_id)
     if is_product_id(scene_id):
         scene_id = self.api.lookup(dataset, [scene_id], inverse=True)[0]
     url = EE_DOWNLOAD_URL.format(dataset_id=DATASETS[dataset],
                                  scene_id=scene_id)
     filename = self._download(url, output_dir)
     return filename
    def download(self, scene_id, output_dir, data_set=False):
        """Download a Landsat scene given its identifier and an output
        directory.

        override to adjust for donwloading datasets other than landsat
        """
        if not data_set:
            dataset = guess_dataset(scene_id)
            if is_product_id(scene_id):
                scene_id = self.api.lookup(dataset, [scene_id],
                                           inverse=True)[0]
        else:
            dataset = data_set
            scene_id = self.api.lookup(data_set, [scene_id], inverse=True)[0]

        url = EE_DOWNLOAD_URL.format(folder=EE_FOLDER[dataset], sid=scene_id)
        filename = self._download(url, output_dir, dataset)
        return filename
    def generic_download(self, data_set, scene, output_dir, chunk_size=1024):
        """
        wrap around EE download to allow for
        :param data_set:string name of data set being downloaded
        :param scene: scene object generated by search
        :param output_dir:
        :return:
        """

        ### LANDSAT DOWNLOAD ###
        if is_product_id(scene['displayId']):
            filename = self.download(scene['displayId'], output_dir)

        ### NON-LANDSAT ###
        else:
            filename = self.download(scene['displayId'],
                                     output_dir,
                                     data_set=data_set)

        return filename
Пример #6
0
    def metadata(self, dataset, id_list):
        """Request metadata for a given list of scenes.

        Parameters
        ----------
        dataset : str
            LANDSAT_TM_C1, LANDSAT_ETM_C1 or LANDSAT_8_C1.
        id_list : list of str
            List of product id or legacy scene id.

        Returns
        -------
        results : dict
            Results as a dictionnary.
        """
        if is_product_id(id_list[0]):
            id_list = self.lookup(dataset, id_list, inverse=True)
        params = {'datasetName': dataset, 'entityIds': id_list}
        response = self.request('metadata', **params)
        return response['data']