[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CDF question

Harald Frey wrote:

> I started working with CDF files and encountered two problems/questions.
> 1.
> IDL> id=cdf_open('WIC')
> IDL> cdf_control,id,variable='epoch',get_var_info=info
> % CDF_CONTROL: Must specify a variable via VARIABLE keyword.
> % Execution halted at:  READ_THE_WIC_CDF   26 read_the_wic_cdf.pro
> %                       $MAIN$
> I think I have specified a variable 'epoch'?
> 2. I have several variables in a CDF record of different size (2D
> arrays, single numbers etc.). The procedure CDF_VARGET requires keywords
> interval and offset. How do I specify these vectors in a universal
> manner?
> I would very much appreciate getting an example program.
> Harald Frey
> Space Sciences Laboratory
> UC Berkeley
> hfrey@ssl.berkeley.edu

I found at least the solution for the first problem. In some way IDL is
sensitive to upper/lower case
statements in that case. I have a variable in the cdf-file 'EPOCH'.

IDL> print,!version
{ sparc sunos unix 5.1 Apr 13 1998}
IDL> id=cdf_open('WIC')
IDL> result2=cdf_varinq(id,1)
IDL> print,result2.name
IDL>  var=result2.name
IDL>  cdf_control,id,variable=var,get_var_info=info
IDL>  help,info,/struc
** Structure <83850>, 7 tags, length=28, refs=1:
   EXTENDRECS      LONG                 0
   MAXALLOCREC     LONG                 3
   MAXREC          LONG                 3
   MAXRECS         LONG                 3
   NINDEXENTRIES   LONG                 2
   NINDEXRECORDS   LONG                 1
   PADVALUE        INT              0

Everything works in this case. However, if I specify the variable var in
case letters, then I get this stupid and misleading error message.

IDL> var='epoch'
IDL> cdf_control,id,variable=var,get_var_info=info
% CDF_CONTROL: Must specify a variable via VARIABLE keyword.
% Execution halted at:  $MAIN$

I don't fully understand this behaviour. Maybe it's UNIX related? But
should be platform compatible. However, I found my way around it and don't
much more.