|
3 | 3 | # |
4 | 4 |
|
5 | 5 | import sys |
6 | | -import logging |
7 | 6 | from sliderule import icesat2 |
8 | | -from utils import parse_command_line |
| 7 | +from utils import parse_command_line, initialize_client |
9 | 8 |
|
10 | 9 | ############################################################################### |
11 | 10 | # MAIN |
|
14 | 13 | if __name__ == '__main__': |
15 | 14 |
|
16 | 15 | # set script defaults |
17 | | - cfg = { |
18 | | - "url": 'localhost', |
19 | | - "organization": None, |
20 | | - "asset": 'atlas-local', |
| 16 | + local = { |
21 | 17 | "dataset": '/gt2l/heights/h_ph', |
22 | | - "resource": 'ATL03_20181017222812_02950102_005_01.h5', |
23 | 18 | "col": 0, |
24 | 19 | "startrow": 0, |
25 | 20 | "numrows": -1 |
26 | 21 | } |
27 | 22 |
|
28 | | - # parse configuration parameters |
29 | | - parse_command_line(sys.argv, cfg) |
30 | | - |
31 | | - # Configure Logging # |
32 | | - logging.basicConfig(level=logging.INFO) |
| 23 | + # Initialize Client |
| 24 | + parms, cfg = initialize_client(sys.argv) |
33 | 25 |
|
34 | | - # Configure SlideRule # |
35 | | - icesat2.init(cfg["url"], True, organization=cfg["organization"]) |
| 26 | + # parse configuration parameters |
| 27 | + parse_command_line(sys.argv, local) |
36 | 28 |
|
37 | 29 | # Read Dataset # |
38 | | - datasets = [ {"dataset": cfg["dataset"], "col": cfg["col"], "startrow": cfg["startrow"], "numrows": cfg["numrows"]} ] |
| 30 | + datasets = [ {"dataset": local["dataset"], "col": local["col"], "startrow": local["startrow"], "numrows": local["numrows"]} ] |
39 | 31 | rawdata = icesat2.h5p(datasets, cfg["resource"], cfg["asset"]) |
40 | 32 | print(rawdata) |
41 | 33 |
|
42 | 34 | # Write Dataset to File # |
43 | | - filename = cfg["dataset"][cfg["dataset"].rfind("/")+1:] |
| 35 | + filename = local["dataset"][local["dataset"].rfind("/")+1:] |
44 | 36 | f = open(filename + ".bin", 'w+b') |
45 | | - f.write(bytearray(rawdata[cfg["dataset"]])) |
| 37 | + f.write(bytearray(rawdata[local["dataset"]])) |
46 | 38 | f.close() |
0 commit comments