-
Slice 2D
probe =
'1'
level =
'l2'
species =
'hplus'
data_rate
=
'srvy'
name =
'mms'
+prob
e+
'_hpca_'
+species+
'_phase_space_density'
timespan
,
'2015-10-16/13:06:00'
,
1
, /min
;time
range to load
trange =
timerange
()
time
= trange[
0
]
;slice time
;load data into tplot
mms_load_hpca
,
probes=probe,
trange=trange,
data_rate=data_rate,
level=level,
datatype=
'ion'
;reformat data from tplot
variables into compatible 3D structures
dist =
mms_get_dist
(name)
;get single
distribution
; -3d/2d
interpolation show smooth contours
; -3d interpolates entire
volume
; -2d interpolates
projection of a subset of data near the slice
plane
; -geometric
interpolation is slow but shows bin
boundaries
;----------------
-----------------------------
slice =
spd_slice2d
(dist, time=time)
;3D interpolation
;slice = spd_slice2d(dist, time=time,
/two) 2D interpolation
;slice = spd_slice2d(dist, time=time,
/geo) geometric interpolation
;average all data in
specified time window
;slice
= spd_slice2d(dist, time=time, /geo, window=20)
window (sec) starts
at TIME
;slice
=
spd_slice2d(dist,
time=time,
/geo,
window=20,
/center_time)
window
centered on TIME
;average specific number of
distributions (uses N closest to specified
time)
;slice =
spd_slice2d(dist, time=time, /geo,
samples=3)
;plot
spd_slice2d_plot
, slice
stop
;==============
==================================================
======
; Field-aligned
slices
;====================
==================================================
probe =
'1'
level =
'l2'
species =
'hplus'
data_rate
=
'srvy'
name =
'mms'
+prob
e+
'_hpca_'
+species+
'_phase_space_density'
bname =
'mms'
+pro
be+
'_fgm_b_gse_srvy_l2_bvec'
;name of bfield vector
vname
=
'mms'
+probe+
'_h
pca_'
+species+
'_ion_bulk_vel
ocity'
;name of bulk
velocity
vector
timespan
,
'2015-10-16/13:06:00'
,
1
, /min
;time
range to load
trange =
timerange
()
time
= trange[
0
]
;slice time
mms_load_hpca
,
probes=probe,
trange=trange,
data_rate=data_rate,
level=level,
datatype=
'ion'
dist =
mms_get_dist
(name)
;load B field
data
mms_load_fgm
, probe=probe,
trange=trange, level=
'l2'
;load velocity
moment
mms_load_hpca
,
probes=probe,
trange=trange,
data_rate=data_rate,
level=level,
$$
da
tatype=
'moments'
, varformat=
'*_'
+species+
'_io
n_bulk_velocity'
;field/velocity aligned
slice
; -the plot's x axis
is parallel to the B field
;
-the plot's y axis is defined by the bulk velocity
direction
;-----------------
----------------------------
slice =
spd_slice2d
(dist, time=time,
window=window, $$
rotation=
'bv'
,
mag_data=bname, vel_data=vname)
;plot
spd_slice2d_plot
, slice
stop
;==============
==================================================
==========
=
;
Export time series
;========
==================================================
================
=
probe =
'1'
level =
'l2'
species =
'hplus'
data_rate
=
'srvy'
name =
'mms'
+prob
e+
'_hpca_'
+species+
'_phase_space_density'
timespan
,
'2015-10-16/13:06:00'
,
1
, /min
;time
range to load
trange =
timerange
()
mms_load_hpca
,
probes=probe,
trange=trange,
data_rate=data_rate,
level=level,
datatype=
'ion'
dist =
mms_get_dist
(name)
;produce a plot of the
closest 2 distributions every 20 seconds for 1
minute
times =
trange[
0
] +
20
*
findgen
(
4
)
samples
=
2
for
i=
0
,
n_elements
p>
(times)-
1
dobegin
slice =
spd_slice2d
(dist,
time=times[i], samples=samples)
filename =
'mms'
+
probe+
'_'
+species+
'_'
+
time_string
(
times[i],format=
2
)
;plot and write .png image
to current directory
spd_slice2d_plot
, slice,
export=filename
;,/eps
endfor
stop
end
;+
;Purpose:
; Crib
sheet demonstrating how to obtain particle
distribution slices
; from
MMS HPCA data using spd_slice2d.
;
; Run as
script or copy-paste to command line.
; (examples containing loops cannot
be copy-pasted to command line)
;
;
;Field-aligned coordinate
descriptions:
; 'BV': The
x axis is parallel to B field; the bulk velocity
defines the x-y
plane
; 'BE': The x axis is parallel to B
field; the B x V(bulk) vector defines
the
x-y plane
; 'xy': (default) The x axis is along
the coordinate's x axis and y is along
the coordinate's y axis
; 'xz': The x axis is along the
coordinate's x axis and y is along the
coordinate's z axis
; 'yz': The x axis is along the
coordinate's y axis and y is along the
coordinate's z axis
; 'xvel': The
x
axis
is
along
the
coordinate's
x
axis;
the
x-y
plane
is
defined
by the bulk velocity
; 'perp': The x axis is
the bulk velocity projected onto the plane normal
to
the B field; y is B x
V(bulk)
; 'perp_xy': The
coordinate's x & y axes are projected onto the
plane normal
to the B field
; 'perp_xz': The coordinate's x & z
axes are projected onto the plane normal
to the B field
;
'perp_yz': The coordinate's y & z axes are
projected onto the plane normal
to the
B field
;
;
;
;$$LastChangedBy: egrimes $$
;$$LastChangedDate: 2016-05-25 13:37:25
-0700 (Wed, 25 May 2016) $$
;$$LastChangedRevision: 21200
$$
;$$URL:
svn+ssh:
//thmsvn@/repos/spdsoft/trunk/projects/mms
< br>/examples/advanced/mms_slice2d_hpca_ $$
;-
;==============
==================================================
==========
=
;
Basic
;=====================
==================================================
===
=
;setup
probe =
'1'
level =
'l2'
species =
'hplus'
data_rate
=
'srvy'
name =
'mms'
+prob
e+
'_hpca_'
+species+
'_phase_space_density'
timespan
,
'2015-10-16/13:06:00'
,
1
, /min
;time
range to load
trange =
timerange
()
time
= trange[
0
]
;slice time
;load data into tplot
mms_load_hpca
,
probes=probe,
trange=trange,
data_rate=data_rate,
level=level,
datatype=
'ion'
;reformat data from tplot
variables into compatible 3D structures
dist =
mms_get_dist
(name)
;get single
distribution
; -3d/2d
interpolation show smooth contours
; -3d interpolates entire
volume
; -2d interpolates
projection of a subset of data near the slice
plane
; -geometric
interpolation is slow but shows bin
boundaries
;----------------
-----------------------------
slice =
spd_slice2d
(dist, time=time)
;3D interpolation
;slice = spd_slice2d(dist, time=time,
/two) 2D interpolation
;slice = spd_slice2d(dist, time=time,
/geo) geometric interpolation
;average all data in
specified time window
;slice
= spd_slice2d(dist, time=time, /geo, window=20)
window (sec) starts
at TIME
;slice
=
spd_slice2d(dist,
time=time,
/geo,
window=20,
/center_time)
window
centered on TIME
;average specific number of
distributions (uses N closest to specified
time)
;slice =
spd_slice2d(dist, time=time, /geo, samples=3)
;plot
spd_slice2d_plot
, slice
stop
;==============
==================================================
======
; Field-aligned
slices
;====================
==================================================
probe =
'1'
level =
'l2'
species =
'hplus'
data_rate
=
'srvy'
name =
'mms'
+prob
e+
'_hpca_'
+species+
'_phase_space_density'
bname =
'mms'
+pro
be+
'_fgm_b_gse_srvy_l2_bvec'
;name of bfield vector
vname
=
'mms'
+probe+
'_h
pca_'
+species+
'_ion_bulk_vel
ocity'
;name of bulk
velocity
vector
timespan
,
'2015-10-16/13:06:00'
,
1
, /min
;time
range to load
trange =
timerange
()
time
= trange[
0
]
;slice time
mms_load_hpca
,
probes=probe,
trange=trange,
data_rate=data_rate,
level=level,
datatype=
'ion'
dist =
mms_get_dist
(name)
;load B field
data
mms_load_fgm
, probe=probe,
trange=trange, level=
'l2'
;load velocity
moment
mms_load_hpca
,
probes=probe,
trange=trange,
data_rate=data_rate,
level=level,
$$
da
tatype=
'moments'
, varformat=
'*_'
+species+
'_io
n_bulk_velocity'
;field/velocity aligned
slice
; -the plot's x axis
is parallel to the B field
;
-the plot's y axis is defined by the bulk velocity
direction
;-----------------
----------------------------
slice =
spd_slice2d
(dist, time=time,
window=window, $$
rotation=
'bv'
,
mag_data=bname, vel_data=vname)
;plot
spd_slice2d_plot
, slice
stop
;==============
==================================================
==========
=
;
Export time series
;========
==================================================
================
=
probe =
'1'
level =
'l2'
species =
'hplus'
data_rate
=
'srvy'
name =
'mms'
+prob
e+
'_hpca_'
+species+
'_phase_space_density'
timespan
,
'2015-10-16/13:06:00'
,
1
, /min
;time
range to load
trange =
timerange
()
mms_load_hpca
,
probes=probe,
trange=trange,
data_rate=data_rate,
level=level,
datatype=
'ion'
dist =
mms_get_dist
(name)
;produce a plot of the
closest 2 distributions every 20 seconds for 1
minute
times =
trange[
0
] +
20
*
findgen
(
4
)
samples
=
2
for
i=
0
,
n_elements
p>
(times)-
1
dobegin
slice =
spd_slice2d
(dist,
time=times[i], samples=samples)
filename =
'mms'
+
probe+
'_'
+species+
'_'
+
time_string
(
times[i],format=
2
)
;plot and write .png image
to current directory
spd_slice2d_plot
, slice,
export=filename
;,/eps
endfor
stop
end
;Purpose: A
basic overview of how to obtain and plot two-
dimentional slices of
;
SST and/or ESA particle distributions.
;
;
Run
;
;
;Methods:
;
Geomtric:
; Each point on
the plot is given the value of the bin it
instersects.
; This
allows bin boundaries to be drawn at high
resolutions.
;
; 2D Interpolation:
; Datapoints within the specified
theta or z-axis range are projected onto
; the slice plane and
linearly interpolated onto a regular 2D grid.
;
;
3D Interpolation:
; The
entire 3-dimensional distribution is linearly
interpolated onto a
;
regular 3D grid and a slice is extracted from the
volume.
;
;
;Coordinates:
;
The coordinate system in which the slice will be
oriented.
; Options are
'DSL' (default), 'GSM', 'GSE' and the following
magnetic
; field aligned
coordinates (field parallel to z axis).
;
;
'xgse': The x axis is the projection of the GSE
x-axis
; 'ygsm': The y
axis is the projection of the GSM
y-axis
; 'zdsl': The y
axis is the projection of the DSL
z-axis
; 'RGeo': The
x
is
the
projection
of
radial
spacecraft
position
vector
(GEI)
;
'mRGeo': The x axis is the projection of the
negative radial spacecraft
position
vector (GEI)
; 'phiGeo':
The
y
axis
is
the
projection
of
the
azimuthal
spacecraft
position
vector (GEI), positive
eastward
; 'mphiGeo':
The y axis is the projection of the azimuthal
spacecraft
position vector (GEI),
positive westward
;
'phiSM': The
y
axis
is
the
projection
of
the
azimuthal
spacecraft
position
vector in Solar Magnetic
coords
; 'mphiSM': The
y
axis
is
the
projection
of
the
negative
azimuthal
spacecraft
position vector in Solar Magnetic
coords
;
;
;Slice
Orientation
; The slice
plane is oriented by using the following options
to specify
; its x and y
axes with respect to the coordinate
system.
; (
;
;
'BV': The
x
axis
is
parallel
to
B
field;
the
bulk
velocity
defines
the
x-y
plane
; 'BE':
The x axis is parallel to B field; the B x V(bulk)
vector defines
the x-y plane
; 'xy': (default)
The
x
axis
is
along
the
coordinate's
x
axis
and
y
is
along
the
coordinate's y axis
;
'xz': The x axis is along the coordinate's x axis
and y is along the
coordinate's z
axis
; 'yz': The x axis
is along the coordinate's y axis and y is along
the
coordinate's z axis
; 'xvel': The
x
axis
is
along
the
coordinate's
x
axis;
the
x-y
plane
is
defined
by the bulk velocity
; 'perp': The x axis is
the bulk velocity projected onto the plane normal
to the B field; y is B x
V(bulk)
; 'perp_xy': The
coordinate's
x
&
y
axes
are
projected
onto
the
plane
normal
to the B field
;
'perp_xz': The
coordinate's
x
&
z
axes
are
projected
onto
the
plane
normal
to the B field
;
'perp_yz': The
coordinate's
y
&
z
axes
are
projected
onto
the
plane
normal
to the B field
;
;
;OTHER:
;
; For more
detailed/advanced usage see:
; thm_crib_part_slice2d_
; thm_crib_part_slice2d_
;
;
;NOTES:
;
;
;$$LastChangedBy: aaflores $$
;$$LastChangedDate: 2016-08-25 13:12:48
-0700 (Thu, 25 Aug 2016) $$
;$$LastChangedRevision: 21727
$$
;$$URL:
svn+ssh:
//thmsvn@/repos/spdsoft/trunk/projects/the
< br>mis/examples/basic/thm_crib_part_ $$
;
;-
compile_opt
idl2
thm_init
nl =
ssl_newline
()
print
,
nl,
'Starting basic 2D particle
distribution slice crib.'
,nl
;--------------
--------------------------------------------------
----------
------------
;Generate basic slice from ESA
data
;----------------------
--------------------------------------------------
--
------------
;set time range
trange =
'2008-02-26/'
+ [
'04:54'
,
'04:55'
]
;esa ion burst
data
dist_arr =
t
hm_part_dist_array
(probe=
'b'
,type=
'peib'
,
trange=trange)
;generate a
30 second slice starting at the beginning of the
time range
thm_part_slice2d
, dist_arr,
slice_time=trange[
0
],
timewin=
30
,
part_slice=slice
;plot the output
thm_part_slice2d_plot
, slice
print
,
nl,
'This example shows a basic slice of
ESA burst data (ions) along the
DSL xy
plane.'
print
,
'The default method will produce a plot
with visible bin boundaries.'
print
,
'The red
line is the projection of the bulk velocity
vector.'
,nl
stop
;--------------------------------------
------------------------------------
---
---------
;Generate basic
slice using 2D interpolation
;------------------------------------------------
--------------------------
------------<
/p>
;set time
range