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

pathId = '170aadad-8eaa-4509-9c0e-c1536d58a1fe'
timestampId = "633b4b9f-d939-4c4a-8d90-0e9fceb64b83"
targetPathId = "066458f4-f018-4f49-a1f0-dedfa71b3368"
tempFolder = 'YOUR_PATH'

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

#retrieve the zoom and bounds of the capture you wish to classify
classificationZoom = ai.getReccomendedClassificationZoom(pathId = pathId, timestampId = timestampId, token = token)
bounds = el.path.raster.timestamp.getBounds(pathId, timestampId, 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):
    result = ai.getTileData(pathId = pathId, timestampId = timestampId, tile = tile, token  = token)
    if result['status'] == 204:
        output =  np.zeros((1,256,256))
    else:
        r = result['result']

        output = r[0:1,:,:] * 2
    return(output)


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

Functions

applyModel

applyModel(model, bounds, targetPathId, classificationZoom, token, modelNoDataValue = -1, targetFromDate = None, targetToDate = 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 given bounds to a 3D numpy array.
bounds A shapely polygon or multipolygon indicating the region you wish to classify
targetPathId The id of the path to write the result to
classificationZoom The zoomlevel of the tiles you wish to use for the model input as integer.
token Your token
tempFolder A path where temporary files can be written
modelNoDataValue Which number of the model output to interpret as transparent
targetDate Dictionary with keys from and to, both must be of type datetime. Defaults to current date

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

getTileData

getTileData(pathId, timestampId, tile, token = None )

This function retrieves raster data for a certain tile.

Name Description
PathId Id of the layer to retrieve the raster for
timestampId Id of the timestamp to retrieve the raster for
tile A dictionary with tileX, tileY and zoom as integers
token Your token (optional)

getReccomendedClassificationZoom

getReccomendedClassificationZoom(pathId, timestampId, token = None)

This function retrieves raster data for a certain tile.

Name Description
PathId Id of the layer to retrieve the raster for
timestampId Id of the timestamp to retrieve the raster for
token Your token (optional)

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

Uploaded Source

Built Distribution

ellipsisAI-0.1.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ellipsisAI-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6bb928e3c8ff568e035b1de0678c0d0a8c378a073fd6a54c6f5384f31a755a58
MD5 0a97f87f2ac311b152cfc6581005a049
BLAKE2b-256 fe26fec0043c46b30d72e492ef1a366c3f9ba8776727f848dff9732c3030f3d1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ellipsisAI-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6a03135a27cab5794445898daf2c3bef6d6e826b6da59cf73daac0045de77cce
MD5 381bfca84b4db1b92654e27ab62285c6
BLAKE2b-256 0b0805590766e6eefbb31d770f006b0f813de03b89d62c37c676b7b14ef9c1a4

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