general/CDF/obsolete/
makecdf2.pro
PROCEDURE: makecdf2, data, sktfile=sktfile, cdffile=cdffile, $ gattributes=gattr, vattributes=vattr, overwrite=overwrite, $ status=status, verbose=verbose PURPOSE: Creates a CDF file from a structure of arrays INPUT: data: (this sounds complicated to describe, but see the EXAMPLE below) The structure containing the data to write out to CDF. The 'data' structure will contain exactly one field for each variable that is to be written to the output CDF (with the exception that additional variables 'Epoch' and 'Time_PB5' will be written to the CDF file, if they have been specified in the skeleton file input via the 'sktfile' keyword parameter). Each field of the 'data' structure is itself a structure containing exactly 4 fields, named 'name', 'value', 'recvary', and 'fill'. The 'name' field of the n-th field of 'data' should be the name of the n-th CDF variable in the output CDF file. The 'value' field of the n-th field of 'data' should be an array containing the values of the n-th variable (the i-th element of the array is the value at the i-th time). The 'recvary' field of the n-th field of 'data' should be 1 if the n-th variable is time varying and 'recvary' should be 0 if the n-th variable is time invariant. Time invariant variables are generally things like various kinds of array descriptors that don't depend on the time. The 'fill' field of the n-th field of 'data' should be 1 if the variable should have its values overwritten with ISTP standard FILLVAL's for all times for which data are missing or invalid, as specified by the values of the 'quality_flag' variable, otherwise, 'fill' should be zero. NOTE: the first field of the 'data' structure must contain the time values in seconds since 01-01-1970/00:00:00 UT. NOTE: all of the time variant variable arrays in the 'data' structure must be based on the exact same time array (that set of times given in the first field of the 'data' structure). If you have a set of arrays to write out to CDF which are not all based on the same time array, you must first do the appropriate interpolations to generate a set of arrays that are all based on the same time array. See the routine 'time_align.pro' for one simple way to do this with tplot variables. KEYWORDS: sktfile: name of the skeleton file that is to be used to specify the global attributes and their values, variable attributes and their values, and variable types and sizes. The value used for this parameter should not include any '.skt' suffix. cdffile: Name of CDF file to be created. Do not include any '.cdf' suffix. gattributes: FIX vattributes: FIX overwrite: if set, overwrite any existing CDF file with the specified name (default is to not overwrite any such existing file). status: status is 0 on successful return, nonzero on unsuccessful return. A routine that calls makecdf2 should in general use the status keyword parameter and verify that the CDF write has completed successfully. verbose: if set, display diagnostic messages. Useful for debugging. EXAMPLE: Consider making a CDF file of the FAST EESA summary data, as is done by the IDL routine 'fast_e_summary.pro'. Assume that an appropriate skeleton file named 'fa_k0_ees_template.skt' has been created, containing the appropriate variable definitions and the appropriate global and variable scope attributes and their values. Assume that all the standard data necessary has been stored with 'store_data' in IDL. Then to make the CDF file named 'fa_k0_ees.cdf'containing the variables 'unix_time', 'el_0', 'el_90', 'el_180', 'el_en', 'el_low', 'el_low_pa', 'el_high', 'el_high_pa', 'JEe', and 'Je', you could give the following IDL commands: > get_data, 'el_0', data=el_0 > get_data, 'el_90', data=el_90 > get_data, 'el_180', data=el_180 > get_data, 'el_low', data=el_low > get_data, 'el_high', data=el_high > get_data, 'JEe', data=JEe > get_data, 'Je', data=Je > > data = {unix_time: {name:'unix_time', value:el_0.x, recvary:1, fill:0}, $ > el_0: {name:'el_0', value:el_0.y, recvary:1, fill:1}, $ > el_90: {name:'el_90', value:el_90.y, recvary:1, fill:1}, $ > el_180: {name:'el_180', value:el_180.y, recvary:1, fill:1}, $ > el_en: {name:'el_en', value:el_0.v, recvary:1, fill:1}, $ > el_low: {name:'el_low', value:el_low.y, recvary:1, fill:1}, $ > el_low_pa: {name:'el_low_pa', value:el_low.v, recvary:1, fill:1}, $ > el_high: {name:'el_high', value:el_high.y, recvary:1, fill:1}, $ > el_high_pa: {name:'el_high_pa', value:el_high.v, recvary:1, fill:1}, $ > JEe: {name:'JEe', value:JEe.y, recvary:1, fill:1}, $ > Je: {name:'Je', value:Je.y, recvary:1, fill:1}} > > makecdf2, data, sktfile='fa_k0_ees_template', $ cdffile='fa_k0_ees', status=status, /overwrite > if status ne 0 then begin > message, /info, 'makecdf2 failed.' > return > endif Note that in the above, the name of the field containing time was named 'unix_time', and not 'time'. In general, CDF variables can be named anything you want, but there are a few special exceptions. IF A CDF CONTAINS AN 'EPOCH' VARIABLE, THE FOLLOWING VARIABLE NAMES SHOULD NOT BE USED: TIME, YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MSEC, IYEAR, IMONTH, IDAY, IHOUR, IMINUTE, ISECOND, IMSEC. THIS IS BECAUSE MANY STANDARD CDF ANALYSIS TOOLS USE THESE NAMES FOR SPECIFIC PURPOSES. This is because of certain assumptions made by various software tools developed by CDHF. SEE ALSO: "time_align" VERSION: @(#)makecdf2.pro 1.2 98/08/13
Routines
top source makecdf2
makecdf2, data, sktfile=sktfile, cdffile=cdffile, gattributes=gattributes, vattributes=vattributes, verbose=verbose, overwrite=overwrite, status=status
Parameters
- data
Keywords
- sktfile
- cdffile
- gattributes
- vattributes
- verbose
- overwrite
- status
File attributes
Modification date: | Thu Feb 13 16:43:50 2014 |
Lines: | 145 |