Re: gziped files [message #11386 is a reply to message #11380] |
Thu, 09 April 1998 00:00  |
dlhopols
Messages: 10 Registered: April 1998
|
Junior Member |
|
|
In article <6gi5lk$ah8$1@info.abdn.ac.uk>,
mph406@biomed.abdn.ac.uk wrote:
>
> Is there a way to access a directory containing gzipped files (images in
this case), unzip those files,
> read them into an array (which I can already do when unzipped manually from
the system prompt) and then re-zip the files, all within a .pro.
I just did this a while ago, I have rather a complicated directory
pathname but the FINDFILE command finds all matching files and puts them
into a string array. All that you really need to know is the command
and SPAWN lines. The SPAWN command unzips the file without affecting it
in any way.
There is no need to re-zip it, and it can be write protectd. The data is
piped into a unit number which can be read with: readu,lun,dataimage
or whatever read command you use. (Check out Esrg-3.2 libraries
referenced on the IDL pages, idl-fortran contains some example
code.)
>>>> code:
file_string = data_path
print,file_string
filename_array=FINDFILE(data_path+wildcard,COUNT=number_of_f iles)
print,'Information about Matching Files:'
help,filename_array
; Prints out names of data files found
print,'Name of file found:',filename_array
IF (number_of_files GT 0) THEN BEGIN
FOR i = 0, number_of_files-1 DO BEGIN
command = 'zcat '+filename_array(i)
SPAWN,command,unit = lun
print,'..Reading output from command ',command
...
dataimage=intarr(pif_c,pif_l)
readu,lun,dataimage
...
free_lun,lun
return
end
I hope I didn't forget anything. Good luck!
Rose
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
|
|
|