Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhapiplot_demo.py
More file actions
Latest commit
98 lines (72 loc) · 2.57 KB
/
Copy pathhapiplot_demo.py
File metadata and controls
98 lines (72 loc) · 2.57 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Basic demo of hapiclient. Install package using
# pip install hapiclient --upgrade
# from command line.
# Note:
# In IPython, enter
# %matplotlib qt
# on command line to open plots in new window. Enter
# %matplotlib inline
# to revert.
# For more extensive demos and examples, see
# https://colab.research.google.com/drive/11Zy99koiE90JKJ4u_KPTaEBMQFzbfU3P?usp=sharing
defmain():
demos= [omniweb, sscweb, cdaweb, lisird]
fordemoindemos:
try:
demo()
exceptExceptionase:
print("\033[0;31mError:\033[0m "+str(e))
defomniweb():
fromhapiclientimporthapi
fromhapiplotimporthapiplot
server='https://cdaweb.gsfc.nasa.gov/hapi'
dataset='OMNI2_H0_MRG1HR'
start='2003-09-01T00:00:00'
stop='2003-12-01T00:00:00'
parameters='DST1800'
opts= {'logging': True, 'usecache': True}
# Get data
data, meta=hapi(server, dataset, parameters, start, stop, **opts)
# Plot all parameters
hapiplot(data, meta)
defsscweb():
fromhapiclientimporthapi
fromhapiplotimporthapiplot
# SSCWeb data
server='http://hapi-server.org/servers/SSCWeb/hapi'
dataset='ace'
start='2001-01-01T05:00:00'
stop='2001-01-01T10:00:00'
parameters='X_GSE,Y_GSE,Z_GSE'
opts= {'logging': True, 'usecache': True}
data, meta=hapi(server, dataset, parameters, start, stop, **opts)
hapiplot(data, meta, **opts)
defcdaweb():
fromhapiclientimporthapi
fromhapiplotimporthapiplot
# CDAWeb data - Magnitude and BGSEc from dataset AC_H0_MFI
server='https://cdaweb.gsfc.nasa.gov/hapi'
dataset='AC_H0_MFI'
start='2001-01-01T05:00:00'
stop='2001-01-01T10:00:00'
parameters='Magnitude,BGSEc'
opts= {'logging': True, 'usecache': True}
data, meta=hapi(server, dataset, parameters, start, stop, **opts)
hapiplot(data, meta, **opts)
deflisird():
fromhapiclientimporthapi
fromhapiplotimporthapiplot
server='http://lasp.colorado.edu/lisird/hapi';
dataset='sme_ssi'
parameters='irradiance'
start='1981-10-09T00:00:00.000Z'
stop='1981-10-14T00:00:00.000Z'
opts= {'usecache': True, 'logging': True}
data, meta=hapi(server, dataset, parameters, start, stop, **opts)
hapiplot(data, meta)
if__name__=='__main__':
try:
fromhapiplotimporthapiplot
except:
print('Package hapiplot is not installed. Will not plot results.')
main()