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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ellipsisAI-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 aa5a780d32b48b82d26127e40774e30d7656aa5cf7fa69ba20f191d6a0128de7
MD5 aa4bdea3f14bf8071e507ee613c86b7d
BLAKE2b-256 a1c7a10f0d826af3c288fee662bf69bfe132867dc4a7b7a5a6ed248c26609507

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ellipsisAI-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d5027ee2dc0b093c3999e4f81ec565cf19b10d8e2e1397391864f264f550c873
MD5 d6e1a73248d0fc318b1db3ea57719294
BLAKE2b-256 11bc4843b3d3c4b65edd6274bfe63cc5d0c7b60fe2ce0f23970144bc8b47dc61

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