Data model: Difference between revisions

From SPEDAS Wiki
Jump to navigation Jump to search
(→‎Line Data: vector example)
Line 77: Line 77:
</pre>
</pre>


The x elements are the times for each sample, and the y values are the measurements themselves.
The x field stores the times associated with each sample, and the y field stores the measurements themselves.


Line data can be grouped, so that one time may be associated with multiple time-series measurements. (e.g. vectors)
Line data can be grouped, so that one time may be associated with multiple time-series measurements. (e.g. vectors)
Line 91: Line 91:
</pre>
</pre>


As in the first example, the x elements are the times for each sample, but this data represents 3 measurements at each time.
As in the first example, the x field stores the times associated with each sample, but this data associates 3 measurements with each time.


== Spectral Data ==
== Spectral Data ==


== Importing Tplot Data into the SPEDAS GUI ==
== Importing Tplot Data into the SPEDAS GUI ==

Revision as of 01:01, 22 August 2014

Overview

The primary data model for SPEDAS is built around tplot-variables. Tplot-variables bind a name-string to a structure containing time series measurements with one or two structures storing heterogeneous metadata.

Getting, Storing, & Listing Tplot Data

At their core, tplot variables are binding of a name to zero to three structures of any type. The structures are called "data", "dlimits" and "limits".

To bind a name to zero to three structures:

SPEDAS> store_data,'no_structures' ;creates tplot variable names "no_structures" no associated structures.

SPEDAS> store_data,'one_structure',data={hello:'world'} ;creates a tplot variable named "one_structure" with a data structure

SPEDAS> store_data,'two_structures',data={x:0},limits={y:0} ;creates a tplot variable named "two_structures" with a data and a limits structure

SPEDAS> store_data,'three_structures',data={x:0},limits={height:7,width:9},dlimits={goodbye:'world'} ; creates a tplot variable named "three_structures" with all three structures

At any time you can see what tplot_variables you have stored in memory using the tplot_names command.

SPEDAS> tplot_names
   1 no_structures    
   2 one_structure    
   3 two_structures   
   4 three_structures 

The structure data in tplot variables can be accessed using the get_data command.


SPEDAS> get_data,'no_structures',data=d
SPEDAS> help,d
D               LONG      =            0
SPEDAS> get_data,'three_structures',data=d,limits=l,dlimits=dl
SPEDAS> help,d
** Structure <4c80a938>, 1 tags, length=4, data length=4, refs=1:
   X               LONG      Array[1]
SPEDAS> help,l
** Structure <4d40bd48>, 2 tags, length=8, data length=8, refs=2:
   HEIGHT          LONG                 7
   WIDTH           LONG                 9
SPEDAS> help,dl
** Structure <f0cadb58>, 1 tags, length=16, data length=16, refs=2:
   GOODBYE         STRING    'world'

Tplot variables can be identified by name string or by number(from the tplot_names listing)

SPEDAS> get_data,2,data=d,limits=l
SPEDAS> help,d
** Structure <4c80a938>, 1 tags, length=16, data length=16, refs=1:
   HELLO           STRING    Array[1]
SPEDAS> help,l
L               LONG      =            0

Line Data

One dimensional tplot variables are generally intended for line plotting. To be compatible with SPEDAS routines, the name conventions for structure fields must be followed. The data structure for the tplot variable must have two fields.
"x": A 1-d array of SPEDAS times
"y": A 1-d or 2-d array of numeric data. The first dimension of the array, must have the same number of elements as "x"

For example:

;two minutes of example data from 2007
SPEDAS> store_data,'line_variable',data={x:time_double('2007-03-23')+dindgen(120),y:dindgen(120)^2}
STORE_DATA(221): Creating tplot variable: 5 line_variable
SPEDAS> get_data,'line_variable',data=d
SPEDAS> help,d
** Structure <4c875918>, 2 tags, length=1920, data length=1920, refs=1:
   X               DOUBLE    Array[120]
   Y               DOUBLE    Array[120]

The x field stores the times associated with each sample, and the y field stores the measurements themselves.

Line data can be grouped, so that one time may be associated with multiple time-series measurements. (e.g. vectors)

SPEDAS> store_data,'vector_variable',data={x:time_double('2007-03-23')+dindgen(120),y:dindgen(120,3)^2}
STORE_DATA(221): Creating tplot variable: 6 vector_variable
SPEDAS> get_data,'vector_variable',data=d
SPEDAS> help,d
** Structure <4fb344a8>, 2 tags, length=3840, data length=3840, refs=1:
   X               DOUBLE    Array[120]
   Y               DOUBLE    Array[120, 3]

As in the first example, the x field stores the times associated with each sample, but this data associates 3 measurements with each time.

Spectral Data

Importing Tplot Data into the SPEDAS GUI