예제 #1
0
"""
==================================================
Create Product
==================================================

This example demonstrates how to create a product
in our Catalog and upload an example scene.
"""

from descarteslabs.ext.catalog import catalog
import descarteslabs as dl

# Create a product entry in our Catalog
product = catalog.add_product(
    "simple_image",
    title="Simple Product Creation",
    description=
    "An example of creating a product, adding the visible band range, and ingesting a single scene.",
)

# Maintain the product id to upload scenes
product_id = product['data']['id']

# Add band information to the product
# This is a necessary step, and requires the user
# to know a bit about the data to be ingested
bands = ['red', 'green', 'blue']

i = 0
# Get info from catalog or from file
for band in bands:
    i += 1
"""In this example I will show you how to create a new imagery set
with some custom metadata that you supply. This example builds on the
hello_catalog.py example.
"""

import geojson
import arrow
import os
from time import sleep
import descarteslabs as dl
from descarteslabs.ext.catalog import catalog

product_id = catalog.add_product(
    'building_mask:osm:v1',
    title='OSM Building Mask v1',
    description='Rasterized OSM building footprints from vector data.'
    ' Quality varies regionally. This product has user supplied'
    ' geometry and aquired date.')['data']['id']

band_id = catalog.add_band(
    product_id=product_id,  # id of the product we just created.
    name='footprint',  # this is a unique name to describe what the band encodes.
    jpx_layer=0,
    srcfile=0,
    srcband=1,  # src band is always a 1-based index (counting starts at 1)
    nbits=8,
    dtype='Byte',
    nodata=0,
    data_range=[0, 2**8 - 1],
    type='mask',
)['data']['id']
예제 #3
0
some bands and imagery. We will use the included file `building_mask.tif`
as an example of some imagery you might want to upload with the catalog.
"""

from descarteslabs.ext.catalog import catalog
import descarteslabs as dl
import os
from random import randint
from time import sleep

# First step, create a product, which is a descriptive document you use to
# group related images.

product_id = catalog.add_product(
    'building_mask:osm:v0',
    title='OSM Building Mask',
    description=
    'Rasterized OSM building footprints from vector data. Quality varies regionally'
)['data']['id']

# Next we need to add bands. The core function of a band is to tell us how data
# is encoded in the imagery that you are going to upload. For these building
# masks there is only one file per scene, and each scene has one 8 bit band.

band_id = catalog.add_band(
    product_id=product_id,  # id of the product we just created.
    name='footprint',  # this is a unique name to describe what the band encodes.
    jpx_layer=0,
    srcfile=0,
    srcband=1,  # src band is always a 1-based index (counting starts at 1)
    nbits=8,
    dtype='Byte',
예제 #4
0
"""This example demonstrates how to upload an imagery product where each scene
has more than one data file associated with it. To upload many images at at time
use the `descarteslabs-catalog upload` script.
"""
import os
import descarteslabs as dl
from descarteslabs.ext.catalog import catalog
from time import sleep
import arrow

# As always we will instantiate a product and some bands. If you are not
# familiar with how to do that, refer to the `hello_catalog.py` example first.

product_id = catalog.add_product(
        'building_mask:osm:test_v1',
        title='Multi File OSM Building Mask Test',
        description='Rasterized OSM building footprints from vector data. '
                    'Quality varies regionally. Multi file scene test.'
    )['data']['id']

band0_id = catalog.add_band(
        product_id=product_id,  # id of the product we just created.
        name='footprint_file0',  # this is a unique name to describe what the band encodes.
        jpx_layer=0,
        srcfile=0,
        srcband=1,  # src band is always a 1-based index (counting starts at 1)
        nbits=8,
        dtype='Byte',
        nodata=0,
        data_range=[0, 2**8 - 1],
        type='mask',
    )['data']['id']