@@ -7,8 +7,8 @@ using SpaceDataModel
7
7
using SpaceDataModel: AbstractDataVariable
8
8
import SpaceDataModel: times
9
9
10
- export pyspedas, pytplot
11
- export tplot , get_data
10
+ export pyspedas
11
+ export pytplot , get_data
12
12
export Project, TplotVariable
13
13
14
14
include (" types.jl" )
@@ -18,15 +18,13 @@ include("DimensionalData.jl")
18
18
19
19
using . Projects
20
20
21
- const TnamesType = Union{AbstractArray,Tuple}
21
+ const TnamesType = Union{AbstractArray, Tuple}
22
22
23
23
const pyspedas = pynew ()
24
- const pytplot = pynew ()
25
24
const pyns = pynew ()
26
25
27
26
function __init__ ()
28
27
PythonCall. pycopy! (pyspedas, pyimport (" pyspedas" ))
29
- PythonCall. pycopy! (pytplot, pyimport (" pytplot" ))
30
28
PythonCall. pycopy! (pyns, pyimport (" numpy" ). timedelta64 (1 , " ns" ))
31
29
for p in PROJECTS
32
30
try
@@ -37,10 +35,11 @@ function __init__()
37
35
@warn " Failed to load project $(p) : $e "
38
36
end
39
37
end
38
+ return
40
39
end
41
40
42
- tplot (args... ) = @pyconst (pyspedas. tplot)(args... )
43
- tplot (tnames:: TnamesType , args... ) = @pyconst (pyspedas. tplot)(pylist (tnames), args... )
41
+ pytplot (args... ) = @pyconst (pyspedas. tplot)(args... )
42
+ pytplot (tnames:: TnamesType , args... ) = @pyconst (pyspedas. tplot)(pylist (tnames), args... )
44
43
45
44
"""
46
45
get_data(name; xarray=true, kwargs...)
@@ -49,35 +48,19 @@ Retrieve data from a tplot variable by `name`.
49
48
50
49
By default, returns an xarray DataArray object. If `xarray` is set to false, returns a tuple of (times, data).
51
50
"""
52
- get_data (name; xarray= true , kwargs... ) = pyspedas. get_data (name; xarray, kwargs... )
51
+ get_data (name; xarray = true , kwargs... ) = pyspedas. get_data (name; xarray, kwargs... )
53
52
54
- """
55
- get_data(::Type{DimArray}, name; kwargs...)
56
-
57
- Retrieve data from a tplot variable and convert it to a `DimensionalData.DimArray.
58
- """
59
- get_data (:: Type{DimArray} , name; kwargs... ) = pyconvert_dataarray (get_data (name; kwargs... ))
60
-
61
- """
62
- get_data(::Type{T<:AbstractDimStack}, names; kwargs...)
63
-
64
- Retrieve multiple tplot variables and combine them into a DimensionalData stack.
65
- """
66
- function get_data (:: Type{T} , names; kwargs... ) where {T<: AbstractDimStack }
67
- T (pyconvert_dataarray .(get_data .(names; kwargs... )))
68
- end
69
-
70
- function demo_get_data (; trange= [" 2020-04-20/06:00" , " 2020-04-20/08:00" ])
71
- pyspedas. projects. themis. fgm (; trange, time_clip= true , probe= ' d' )
72
- get_data (DimArray, " thd_fgs_gsm" )
53
+ function demo_get_data (; trange = [" 2017-03-23/00:00:00" , " 2017-04-23/23:59:59" ])
54
+ pyspedas. projects. omni. data (; trange)
55
+ return get_data (DimArray, " SYM_H" )
73
56
end
74
57
75
- function demo (; trange= [" 2020-04-20/06:00" , " 2020-04-20/08:00" ])
76
- pyspedas. projects. solo. mag (; trange, time_clip= true )
77
- pyspedas. projects. psp. fields (; trange, time_clip= true )
78
- pyspedas. projects. mms. fgm (; trange, time_clip= true , probe= 2 )
79
- pyspedas. projects. themis. fgm (; trange, time_clip= true , probe= ' d' )
80
- tplot ([" B_RTN" , " psp_fld_l2_mag_RTN" , " mms2_fgm_b_gsm_srvy_l2_bvec" , " thd_fgs_gsm" ])
58
+ function demo (; trange = [" 2020-04-20/06:00" , " 2020-04-20/08:00" ])
59
+ pyspedas. projects. solo. mag (; trange, time_clip = true )
60
+ pyspedas. projects. psp. fields (; trange, time_clip = true )
61
+ pyspedas. projects. mms. fgm (; trange, time_clip = true , probe = 2 )
62
+ pyspedas. projects. themis. fgm (; trange, time_clip = true , probe = ' d' )
63
+ return pytplot ([" B_RTN" , " psp_fld_l2_mag_RTN" , " mms2_fgm_b_gsm_srvy_l2_bvec" , " thd_fgs_gsm" ])
81
64
end
82
65
83
66
end
0 commit comments