Skip to main content

Package to use Ellipsis Drive for AI

Project description

This package is meant to help you run models on Ellipsis Drive content. It should be used in combination with the ellipsis package.

Install

pip install ellipsisAI

Example

import ellipsisAI as ai
import ellipsis as el

blockId = '170aadad-8eaa-4509-9c0e-c1536d58a1fe'
captureId = "633b4b9f-d939-4c4a-8d90-0e9fceb64b83"
targetBlockId = "066458f4-f018-4f49-a1f0-dedfa71b3368"
temp_folder = 'YOUR_PATH'

#login to get a authentication token
token = el.logIn('YOUR_USERNAME','YOUR_PASSWORD')

#retrieve the zoom and bounds of the capture you wish to classify
classificationZoom = ai.getZoom(blockId, captureId, token)
bounds = ai.getBounds(blockId, captureId, token)


#we create a dummy model. We use the identity function mapping an image to itself. We use the getTleData function to retirve the image for the given input tile ofthe model.
def model(tile):
    image = ai.getTileData(blockId, captureId, tile, token)
    return(image)

#apply the model on the given bounds on the given zoomlevel
ai.applyModel(model, bounds, targetBlockId, classificationZoom, token, temp_folder)

Functions

getZoom

getZoom(blockId, captureId, token)

This function retrieves the max zoomlevel of the specified capture. The result can be used as classificationgZoom argument in the applyModel or getTiles function.

Name Description
blockId The id of the block the capture is in
captureId The id of the capture
token Your token

getBounds

getBounds(blockId, captureId, token)

This function retrieves the bounds of the specified capture. The result can be used as bounds argument in the applyModel function.

Name Description
blockId The id of the block the capture is in
captureId The id of the capture
token Your token

applyModel

applyModel(model, bounds, targetBlockId, classificationZoom, token, temp_folder, visualizationId = None, targetNoDataValue = 0, targetStartDate = None, targetEndDate = None)

This function applies the given model on all tiles of zoomlevel classificationZoom withing the specified bounds. The results will be written in a new capture of the specified target block.

Name Description
model A function mapping mapping a tile object to a 3 dimensional numpy array. The dimensions of the numpy array should be independent of the tile id. A tile object is a dictionary with keys 'tileX', 'tileY' and 'zoom' as integers.
bounds A shapely polygon or multipolygon indicating the region you wish to classify
targetBlockId The id of the block to write the result to
classificationZoom The zoomlevel of the tiles you wish to use for the model input as integer.
token Your token
temp_folder A path where temporary files can be written
visualizationId visualization to use as input, if not given original raster is used
targetNoDataValue Which number of the model output to interpret as transparent
targetStartDate datetime object with date to use for the capture to which the results will be written. Defaults to current date
targetEndDate datetime object with date to use for the capture to which the results will be written. Defaults to targetStartDate

getTileData

getTileData(blockId, captureId, tile, token, visualizationId = None, downsampleFactor = 1 )

This function retrieves data for the given tile as numpy array. This function can be used within your model function te retireve relevant data for the given tile.

Name Description
blockId the id of the block to get data from
captureId the id of the capture to get data from
tile A dictionary with keys tileX, tileY and zoom as int
token Your token
visualizationId The id of the visualization you wish to retrieve. If not given raw data is used
downsampleFactor A factor with which to downsample the data. Default 1 (no downsampling)

getTiles

getTiles(bounds, classificationZoom)

This function covers a given bounds with tiles of the given zoomlevel. You can use the result to get tile arguments for the getTileData function

Name Description
bounds A shapely polygon or multipolygon
classificationZoom The zoomlevel of the tiles to cover with as int

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ellipsisAI-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

ellipsisAI-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file ellipsisAI-0.1.0.tar.gz.

File metadata

  • Download URL: ellipsisAI-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for ellipsisAI-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e6c7ead72d8e2d1a9c3e45d95095b7c8dd20e01fc7d0866192d342180195c22c
MD5 dedd8419afa7079e8e6c9c0a4edd998f
BLAKE2b-256 daa788a4b63eb77be60dc7332db30459b64867b2056a799f2e00c1f69f281d38

See more details on using hashes here.

File details

Details for the file ellipsisAI-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ellipsisAI-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for ellipsisAI-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c146542c6df126934fc7f8ff7ec536a56775cbf9bc6e6da8822b6451a751abd
MD5 169ec359eed49fe07597714734f9ca65
BLAKE2b-256 8013636711fda1fe36fabe41f3c6716ac32f31bc06be8880541cb473c5e3edc1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page