Introduction

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

All the examples assume the import has been done.

from caris.coverage import *

Opening a VRS for Reading

vrs = VRS('source_vrs.csar')

One can specify the named parameter.

vrs = VRS(filename='source_vrs.csar')

One can also supply a URI

vrs = VRS(uri='file:///source_vrs.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, clouds, or variable resolution surfaces is shown in the Properties window’s the “Surface Name” field.

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

Listing Bands

The band information is found in the VRS.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.

vrs = VRS('source_vrs.csar')

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

Reading from a VRS

Reading points from a VRS can be done similar to Cloud with query() and query_box():

vrs = VRS('source_vrs.csar')

points = {}

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

A VRS stores resolution information in VRSTile. This can be iterated by calling tiles(). The points in a tile can be retrieved with query_tile(), or gridded using VRSGridder.

vrs = VRS('source_vrs.csar')
gridder = VRSGridder(vrs)

for tile in vrs.tiles():
    # Iterate all the points in the tile
    blocks = vrs.query_tile(tile)

    # Or generate a grid
    gridder.load(tile)
    grid = gridder.read("Depth")