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, tempFolder, 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.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

ellipsisAI-0.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ellipsisAI-0.1.1.tar.gz
  • Upload date:
  • Size: 6.5 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.10.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.15 CPython/3.10.6

File hashes

Hashes for ellipsisAI-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bad923833d746d459fea0407b21f37a4b3b12d4a23e84916aa2edeb3e2b0c96a
MD5 a69904330f5eab17dcf7406ceb2b7adf
BLAKE2b-256 157f05d84070ed9583800caf0838a9d136b591a37d12857e75b342ea59eeac9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ellipsisAI-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.10.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.15 CPython/3.10.6

File hashes

Hashes for ellipsisAI-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fba2204b10c0be83ad447a3bcf7912973cfe0729c896353e65631b00d26df77f
MD5 0a5fc5a5dd607ae133fff05da45a9ca6
BLAKE2b-256 f4499a9f08bce558167e4b699eda4bf289a69ae2656837b1a912d30d50e1a55d

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