Scenario
Create a SPASE description of data in a CDF file.
Our CDF file contains a time series of data.
It has a magnetic field vector in HDZ coordinates and time stamp for each vector.
The magnetic field vector is stored as a 2D array with the dimension of 3 by 1440.
The time stamp is a 1D array with 1440 elements (one for each HDZ vector).
We want to create an PDS4 label that describes the data in the CDF file.
We will use the data file with the name thg_l2_mag_and_20121226_v01.cdf.
Our velocity template will be a SPASE description with some information already filled in.
Information specific to the contents of the CDF file (data arrays, record count, file size, etc.) will be generated
using igpp.docgen. Our template looks like:
2.2.6
spase://noaa/NumericalData/$cdf.getAttributeValue('Logical_file_id')
$cdf.getAttributeValue("TITLE")
2016-12-08T08:40:00.000
$cdf.getAttributeValue('Logical_source_description') $cdf.getAttributeValue('TEXT')
spase://SMWG/Person/$cdf.getAttributeValue('PI_name')
PrincipalInvestigator
spase://SMWG/Person/Todd.A.King
MetadataContact
Product Description
spase://SMWG/Repository/NSSDC
Online
Open
CDF
Calibrated
$cdf.getAttributeValue('Data_version')
spase://SMWG/Instrument/$cdf.getAttributeValue('Mission_group')/$cdf.getAttributeValue('Logical_source')
#foreach ($variable in $cdf.variables)
$variable.getAttributeValue('FIELDNAM')
$variable.getAttributeValue('CATDESC')
$variable.getAttributeValue('VAR_NOTES')
$variable.getDataSample(0)
$variable.getAttributeValue('UNITS')
$variable.getAttributeValue('VALIDMIN')
$variable.getAttributeValue('VALIDMAX')
$variable.getAttributeValue('FILLVAL')
#if( ! $variable.getAttributeValue('SCALEMIN').isEmpty() )
$variable.getAttributeValue('SCALEMIN')
$variable.getAttributeValue('SCALEMAX')
#end ## if()
#if( $variable.getDimCount() == 1 )
$variable.getDim(0)
#end ## if()
#if( $variable.getDimCount() == 2 )
$variable.getDim(0) $variable.getDim(1)
#end ## if()
#set( $var_type = $variable.getAttributeValue("VAR_TYPE") )
#set( $funct = $variable.getAttributeValue("FUNCT") )
#if( ! $funct.isEmpty() || $var_type.compareTo("support_data") == 0)
#end ## if()
#if( ! $funct.isEmpty() || $var_type.compareTo("data") == 0)
#end ## if
#{end}## foreach variable
We will store this in a file called spase.vm.
A CDF file contains attributes and variables. An attribute can contain descriptive information
which is transferred into the appropriate SPASE element. A varaible can contain data or sets of metadata
In the template conditional statements (if/else) make sure that we only write the variables
in the CDF file which are designated as "data".
Running igpp.docgen with the command:
java -jar igpp-docgen.jar cdf:thg_l2_mag_and_20121226_v01.cdf testcase/cdf/spase.vm
Instructs igpp.docgen to parse the file "thg_l2_mag_and_20121226_v01.cdf" and place the results in a context
named "cdf". Since the extension on "thg_l2_mag_and_20121226_v01.cdf" is ".cdf" igpp.docgen will parse the
file a CDF file, creating arrays to contian the attribute and variable information in the file.
Running this command will generate an XML document that looks like:
2.2.6
spase://VMO/NumericalData/thg_l2_mag_and_20121226_v01
2017-02-02T12:59:34.457Z
Ground-based Vector Magnetic Field at Andenes, Norway, 1 minute time Resolution. Part of the Tromso Geophysical Observatory ground magnetometer network
spase://SMWG/Person/Truls Lynne Hansen
PrincipalInvestigator
spase://SMWG/Person/Todd.A.King
MetadataContact
Product Description
spase://SMWG/Repository/NSSDC
Online
Open
CDF
Calibrated
1
spase://SMWG/Instrument/THEMIS/thg_l2_mag_and
B in HDZ Components
Magnetic field B in HDZ vector components
-60000.0 6.7700764E25 3.711801E19
60000.0 6.7700173E25 3.6973893E19
NaN
3
thg_mag_and_unit
thg_mag_and_unit
3
thg_mag_and_labl
thg_mag_and_labl
3
HDZ Component Number
HDZ Component Number
1 256 65536
3 768 196608
-2147483648
3
thg_mag_and_time
thg_mag_and_time,.UTC, in seconds since 01-Jan-1970 00:00:00
sec
0.0
5.0E9
NaN
1
thg_mag_and_Epoch
thg_mag_and_Epoch
6.31455264E13
6.6301199999999E13
-1.0E31
1
thg_mag_and_epoch0
EPOCH0 of THEMIS TIME BASE
msec
5.99582304E13
6.4060675199999E13
-1.0E31
1
range_epoch
range_epoch
msec
6.31455264E13
6.6301199999999E13
-1.0E31
1