comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL Test case
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL Test case [message #37967] Wed, 04 February 2004 09:54
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
The simple-mined solution:

>
> PRO test1
>
> pushd,'C:\Temp\test'

XML_Files = FIDFILE( "*.xml" )
DAT_Files = FINDFILE( "*.dat" )

n_Files = N_ELEMENTS( XML_Files )
nDAT_Files = N_ELEMENTS( DAT_Files )

; -- Gross check.
IF ( n_Files NE nDAT_Files ) THEN $
MESSAGE, "Found unmatched XML and DAT files!"

FOR i = 0, n_Files - 1 DO BEGIN

XML = XML_Files[i]
DAT = ...search DAT_Files for corresponding .dat file....
...using string commands to extract oput the filename minus the suffixes...

; -- Here you probably want another check to make
; -- sure the corresponding DAT filename search succeeded.
IF ( some smart test ) THEN $
MESSAGE, 'DAT file prefix does not match XML file prefix'

>
> obj = CREATEOBJ(XML, DAT)
> list_struct= LISTSTRUCTURES(obj, '\')
> print,'Structure:', list_struct
> list_field = LISTFIELDS(obj, '\')
> print, 'Field:', list_field
> rank = GETRANK(obj, '/Bin/19GHz')
> print, 'Rank:', rank
> dim = GETDIMENSION(obj, '/Bin/19GHz',1)
> print, 'Dimension:',dim
> dim_name = GETDIMENSIONNAME(obj, '/Bin/19GHz',1)
> print, 'Dimension Name:', dim_name
> type = GETFIELDTYPE(obj, '/Bin/19GHz')
> print,'Data Type:', type
> field = READFIELD(obj, '/Bin/19GHz')
> print, field
> print, DeleteObj(obj)

ENDFOR
> end
>
> The above code takes one B.xml and one B.dat file from a directory and
> runs the program. What i want to do is instead of testing for only
> these 2 files, i want to test for all the files in that same
> directory. It is very time consuming to test each file seperately.
> Could someone suggest me how to write a test case so it tests all
> files listed in the directory without me having to hard code each
> filename in the above code?

The hard part is the search of DAT_Files for the corresponding XXX.dat file for the
current XML file...and that's not so difficult. I just hate dealing with strings.

This all assumes you can't past arrays of filenames to all the functions above (I don't
know)

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
[Message index]
 
Read Message
Previous Topic: IDL Test case
Next Topic: Object Graphics Roting Sphere

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 16:19:11 PDT 2025

Total time taken to generate the page: 1.19717 seconds