-
Notifications
You must be signed in to change notification settings - Fork 2
/
quick_demo.py
44 lines (36 loc) · 1008 Bytes
/
quick_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#
# Quick little demo file showing a few capabilities
#
import sys
import databank
import databank_io
import databank_util
#
# Create the big data repository object
#
the_vault = databank.DataVault()
#
# read a file that has self-contained metadata (new format)
# File has sample Lake Michigan monthly NBS values in cms for 1999-2002
#
ds1 = databank_io.read_file('data/mn/tab_monthly.txt')
#
# echo the data to a new output file
#
databank_io.write_file(filename='demo_output1.txt', file_format='column', ds=ds1)
#
# store the data in the repository
#
the_vault.deposit(ds1)
#
# retrieve monthly Lake Michigan NBS from the repository in cfs
#
ds_cfs = the_vault.withdraw(kind='nbs', units='cfs', intvl='mon', loc='mic')
#
# output lake Michigan monthly NBS values to a new file
#
databank_io.write_file('demo_output2.txt', file_format='column', ds=ds_cfs)
#
# try to retrieve daily data from the vault (fails)
#
ds_fail = the_vault.withdraw(kind='nbs', units='cfs', intvl='dly', loc='mic')