forked from oceanobservatories/uframe-webservices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_arrays.py
executable file
·39 lines (26 loc) · 938 Bytes
/
get_arrays.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
#! /usr/bin/env python
import argparse
from uframe import UFrame, get_arrays
def main(args):
"""
Retrieve the list of available OOI arrays on the uFrame instance.
Default uFrame instance is: http://uframe-test.ooi.rutgers.edu
"""
if args.base_url:
uframe_base = UFrame(base_url=args.base_url)
else:
uframe_base = UFrame()
arrays = get_arrays(uframe_base=uframe_base)
if not arrays:
print 'No arrays found for uFrame instance: {:s}'.format(uframe_base.url)
return
print 'Available arrays:'
for array in arrays:
print array
if __name__ == '__main__':
arg_parser = argparse.ArgumentParser(description=main.__doc__)
arg_parser.add_argument('-b', '--baseurl',
dest='base_url',
help='Specify an alternate uFrame server URL. Must start with \'http://\'.')
parsed_args = arg_parser.parse_args()
main(parsed_args)