Introduction

This section outlines the general usage of the Python bindings for a Cloud.

All the examples assume the import has been done.

from caris.coverage import *

Opening a Cloud for Reading

cloud = Cloud('source_cloud.csar')

One can specify the named parameter.

cloud = Cloud(filename='source_cloud.csar')

One can also supply a URI

cloud = Cloud(uri='file:///source_cloud.csar')

Opening from BDB Server

To open a database surface, a URI must be given formatted as:

bdb://username:password@hostname/database/boid

Note

The database name is case sensitive.

Boids (object IDs for database objects) can be found by via caris.bathy.db.Database.query_objects().

In BASE Editor the boid can be found by selecting a surfac, the boid will be shown in the Selection window. The URI for opened rasters or clouds is shown in the Properties window’s the “Surface Name” field.

cloud = caris.coverage.Cloud(uri='bdb://dba:sql@example.com/MyDB/02000001')

Listing Bands

The band information is found in the Cloud.band_info property. It is simply a dictionary where the key is the band name and the value is an instance of BandInfo. The band information contains properties such as its type, category, minimum, maximum, no-data-value, etc. See BandInfo for more info.

cloud = Cloud('source_cloud.csar')

for band_name in cloud.band_info:
    print(str(cloud.band_info[band_name]))

Reading from a cloud

Reading from a point cloud is done in a three step process. The first step is iterating over the cloud’s block iterator. This will give us a block of points for each band. Next, we iterate over these bands. Finally, we iterate over each point in each block (for each band). That means three possible iterations. Iterate over blocks, iterate over bands and iterate over points.

Here is an example where we decided we wanted to read an entire band before moving on to the next. This will usually be slower than doing the iteration in the order mentioned above, but can make the code simpler to follow if you need to deal with an entire band before dealing with the next one.

cloud = Cloud('source_cloud.csar')

points = {}

# Read the points
for band_name in cloud.band_info:
    points[band_name] = []
    for block in cloud:
        for pt in block[band_name]:
            points[band_name].append(pt)