Skip to content

Adding new components from a Python session #8

@robintw

Description

@robintw

I've had a bit of a play around with the example IPython notebook you provided, and found that the API is fairly easy to navigate - thanks!

I didn't want to submit this as a PR as it a) it isn't really designed for this repo (it's more general Glue), and b) It's definitely not robust enough or general enough to be used generically...but I wanted to show what I've done.

I've written a simple qadd function, that works like qglue, but adds an array as an extra component to an already-existing DataCollection. This is the kind of thing that would be very useful to me, so that I can add in various different 'partially-processed' bits of satellite imagery and compare them.

def qadd(arr, label, collection_id=None):
    if len(app.data_collection) > 1 and collection_id is None:
        raise ValueError('More than one collection exists, you must specify a collection_id')

    collection_id = collection_id or 0

    dc = app.data_collection[collection_id]
    dc.add_component(arr, label=label)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions