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.0.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

ellipsisAI-0.0.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ellipsisAI-0.0.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.6.9

File hashes

Hashes for ellipsisAI-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e47316410b70f1baf325abbb5e47174230db4c306c019ae1e61390dba2abce32
MD5 af6ca63a64d4702da1e50b5609fe2aaa
BLAKE2b-256 8edefa1bea00ff5b4246cb50a62e4570918944b3c301ab52974d49e7e9bfcd49

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ellipsisAI-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.6.9

File hashes

Hashes for ellipsisAI-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 66139f2cc0ac2a7a5e9264fb972c9842e4b737f70e435fad5e28a4ae28c118c4
MD5 3769fe93422ec05f6709222bdf1c265d
BLAKE2b-256 c766cd427beb047193950baea1e18aad7398229c38781e08203598e692336915

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