get_context().dataManager.openOutput()
print "Data file: " + get_context().dataManager.output

#Writing scalar values  (datasets with rank 0)
save_dataset("group/val1", 1)
save_dataset("group/val2", 3.14)
save_dataset("group/val3", "test")
print load_data("group/val1")
print load_data("group/val2")
print load_data("group/val3")

data1d = [1,2,3,4,5]
path="group/data1"
save_dataset(path, data1d)
read =load_data(path)
print read.tolist()

#plot(read)


data2d = [ [1,2,3,4,5],  [2,3,4,5,6],  [3,4,5,6,7]]
path="group/data2"
save_dataset(path, data2d)
set_attribute(path, "AttrString", "Value")
set_attribute(path, "AttrInteger", 1)
set_attribute(path, "AttrDouble", 2.0)
set_attribute(path, "AttrBoolean", True)
read =load_data(path)
print read.tolist()
plot(read)

data3d = [ [ [1,2,3,4,5],  [2,3,4,5,6],  [3,4,5,6,7]],        [ [3,2,3,4,5],  [4,3,4,5,6],  [5,4,5,6,7]]]
path="group/data3"
save_dataset(path, data3d)
read =load_data(path,0)
print read.tolist()
read =load_data(path,1)
print read.tolist()


path = "group/data4"
create_dataset(path, 'i')
for i in range(10):
    append_dataset(path,i)    


path = "group/data5"
create_dataset(path, 'd', False, (0,0))
for row in data2d:
    append_dataset(path, row)    

path = "group/data6"
names = ["a", "b", "c", "d"]
types = ["d", "d", "d", "[d"]
dims = [0,0,0,5]


table = [    [1,2,3,[0,1,2,3,4]],  
            [2,3,4,[3,4,5,6,7]],  
            [3,4,5,[6,7,8,9,4]]    ]

create_table(path, names, types, dims)
for row in table:
    append_table(path, row)   
flush_data() 

read =load_data(path)
print read




