Esempio n. 1
0
def delete_product(
        product_id,
        add_namespace=False,
        cascade=True,
        i_am_absolutely_sure=False):
    """ WARNING: THIS DELETES THE PRODUCT AND ALL IMAGERY
    """
    if i_am_absolutely_sure:
        resp=Catalog().remove_product(
            product_id, 
            add_namespace=add_namespace, 
            cascade=cascade )
        return resp
    else:
        print(f'DO YOU REALLY WANT TO DELETE {product_id}?')
        return False
Esempio n. 2
0
 def setUp(self):
     self.instance = Catalog()
Esempio n. 3
0
from descarteslabs.client.services.raster import Raster
from descarteslabs.client.services.catalog import Catalog
from descarteslabs.client.services.metadata import Metadata

raster = Raster()
catalog = Catalog()
metadata = Metadata()

id_ = '5151d2825f5e29ff129f86d834946363ff3f7e57:modis:09:CREFL_v2_test:2017-01-01-1835_11N_07_MO_09_v2'
scene_meta = metadata.get(id_)
r, meta = raster.ndarray(id_, bands=['red'])

p = catalog.add_product('test_nda_upload',
                        description="Test uploading georeferenced ndarrays",
                        title="Test ndarray upload")

band_spec = meta['bands'][0]['description']
catalog.add_band(
    p['data']['id'],
    'red',
    srcband=1,
    jpx_layer=0,
    **{
        k: v
        for k, v in band_spec.items()
        if k not in ['product', 'id', 'name', 'read', 'owner', 'owner_type']
    })

catalog.upload_ndarray(r,
                       p['data']['id'],
                       id_[41:],
Esempio n. 4
0
 def setUp(self):
     self.instance = Catalog()
     # product_id = 'test_product:{}'.format(md5(str(randint(0, 2**32))).hexdigest())
     # self.instance = Catalog()
     # self.product = {
     #     'title': 'Test Product',
     #     'description': 'A test product',
     #     'native_bands': ['red'],
     #     'orbit': 'sun-synchronous',
     # }
     # self.band = {
     #     'name': 'red',
     #     'wavelength_min': 700,
     #     'wavelength_max': 750,
     #     'srcfile': 0,
     #     'srcband': 1,
     #     'jpx_layer': 1,
     #     'dtype': 'Byte',
     #     'data_range': [0, 255],
     #     'nbits': 8,
     #     'type': 'spectral',
     # }
     # self.image = {
     #     'bucket': 'dl-storage-{}-data'.format(descartes_auth.namespace),
     #     'directory': 'sub_path',
     #     'files': ['/path/to/file.jp2'],
     #     'geometry': {
     #         "type": "Polygon",
     #         "coordinates": [
     #             [
     #                 [
     #                     68.961181640625,
     #                     50.17689812200107,
     #                     0.0
     #                 ],
     #                 [
     #                     70.15869140625,
     #                     50.17689812200107,
     #                     0.0
     #                 ],
     #                 [
     #                     70.15869140625,
     #                     50.80593472676908,
     #                     0.0
     #                 ],
     #                 [
     #                     68.961181640625,
     #                     50.80593472676908,
     #                     0.0
     #                 ],
     #                 [
     #                     68.961181640625,
     #                     50.17689812200107,
     #                     0.0
     #                 ]
     #             ]
     #         ]
     #     }
     # }
     # r = self.instance.add_product(product_id, **self.product)
     # self.product_id = r['data']['id']
     pass
 def setUp(self):
     self.url = "http://www.example.com/metadata/v1/catalog"
     self.instance = Catalog(url=self.url)
     self.match_url = re.compile(self.url)