CDF_VARDELETE

Syntax | Arguments | Keywords | Examples | Version History | See Also

The CDF_VARDELETE procedure deletes a variable from a SINGLE_FILE CDF file. Note that the variable's entries are also deleted, and that the variables that numerically follow the deleted variable within the CDF file are automatically renumbered. CDF rVariables and zVariables are counted separately within CDF files. Attempting to delete a variable from a MULTI_FILE format CDF file will result in a warning message.

Syntax

CDF_VARDELETE, Id, Variable [, /ZVARIABLE]

Arguments

Id

The CDF ID of the file containing the Variable to be deleted, returned from a previous call to CDF_OPEN or CDF_CREATE.

Variable

A string containing the name of the variable to be deleted OR the variable number to be deleted. Variable numbers are 0-based in IDL. zVariables and rVariables are counted separately in CDF files.

Keywords

ZVARIABLE

Set this keyword if the Variable is a zVariable and was passed by number. The default is to assume that Variable is an rVariable.

Examples

cid = CDF_CREATE('DEMOvardelete',/SINGLE_FILE) 
 
; Create 3 zVariables and 1 rVariable: 
var1_id = CDF_VARCREATE(cid, 'rVAR1', /CDF_FLOAT) 
var2_id = CDF_VARCREATE(cid, 'zVAR1', /CDF_INT4, /REC_NOVARY, $ 
   /ZVARIABLE) 
var3_id = CDF_VARCREATE(cid, 'zVAR2', /CDF_CHAR, [2,10], $ 
   NUMELEM=10, DIM=[5,5]) 
var4_id = CDF_VARCREATE(cid, 'zVAR3' ,/CDF_REAL8, /ZVARIABLE) 
 
; Check the number of variables: 
info = CDF_INQUIRE(cid) 
HELP, info.nzvars, info.nvars 
 
; Delete the first and third zvariables: 
CDF_VARDELETE, cid, 'zVAR1', /ZVARIABLE 
CDF_VARDELETE, cid, 1, /ZVARIABLE 
 
; CAUTION: Remember the variable numbers are zero-based  
; and are automatically renumbered. 
 
info = CDF_INQUIRE(cid) 
HELP, info.nzvars, info.nvars 
varinfo = CDF_VARINQ(cid, 0, /ZVARIABLE) 
; check on zVAR2 
HELP, varinfo, /STRUCTURE 
 
CDF_DELETE, cid 

IDL Output

<Expression>    LONG      =            3 
<Expression>    LONG      =            1 
 
<Expression>    LONG      =            1 
<Expression>    LONG      =            1 
 
** Structure <400a3b40>, 8 tags, length=48, refs=1: 
   IS_ZVAR         INT              1 
   NAME            STRING    'zVAR2' 
   DATATYPE        STRING    'CDF_CHAR' 
   NUMELEM         LONG                10 
   RECVAR          STRING    'VARY' 
   DIMVAR          BYTE      Array(2) 
   ALLOCATERECS    LONG      Array(2) 
   DIM             LONG      Array(1) 

Version History

4.0.1b

Introduced

See Also

CDF_ATTDELETE, CDF_CONTROL, CDF_VARCREATE, CDF_VARINQ