Skip to content

HDF5 Project Metadata Tutorial (RemoteExtension Branch)

Luis Rodriguez edited this page Feb 24, 2018 · 2 revisions

This tutorial shows how to obtain data offline from a local HDF5 and add metadata before re-uploading to either BOSS or DVID using intern's LocalRemote. The code shows the capability of intern to be used as a universal remote to manipulate data between all three data storage systems.

import intern
from intern.remote.local import LocalRemote
from intern.remote.boss import BossRemote
from intern.resource.boss.resource import *
import matplotlib.pyplot as plt
import numpy as np

#Local Upload
local = LocalRemote({
    "host": "/Users/rodrilm2/InternRel/",
    "datastore":"LocalBossDummy"
    })

#LocalMetadata updates
Channel1 = local.retrieve('em')
Collection1 = local.retrieve('em/pinky40')

coll_data = {'poc': 'Jane Doe'}
local.create_metadata(Channel1, coll_data)

exp_data = {'weight': '20g', 'diet': 'C2', 'date': '23-May-2016'}
local.create_metadata(Collection1, exp_data)

chan_new_data = {'weight': '45g', 'date': '23-May-2017'}
local.update_metadata(Collection1, chan_new_data)

local.delete_metadata(Channel1, ['poc'])

CollectionMeta= local.list_metadata(Collection1)
print(CollectionMeta)