; ========================================================================== ; ####################### ARTS IDL INTERFACE PROCEDURE ##################### ; ========================================================================== ; function aii_file_exists, filename ;+ ;NAME: ; aii_file_exists ; checks whether the file filename exists and returns 1 for yes and 0 ; for no ;- YES = 1 NO = 0 get_lun,unit openr,unit,filename,error=err free_lun,unit if (err ne 0) then return,NO $ else return,YES end ;; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PRO aii_readfile,filename,output ;+ ;NAME: ; aii_readfile ;PURPOSE: ; checks whether the is file present by using aii_file_exists, ; compressed, or gzipped, and reads it if possible by using ; read_datafile into output variable ;USAGE: ; aii_readfile, filename, output ;- ;; do we have to uncompress? com=-1 ;; uncompressed if aii_file_exists(filename) then begin filename = filename com = 0 endif ;; compressed if aii_file_exists(filename+'.Z') then begin filename = filename+'.Z' com = 1 endif ;; gzipped if aii_file_exists(filename+'.gz') then begin filename = filename+'.gz' com = 1 endif ;; file not found if com eq -1 then begin print,'Error: File not found: '+filename stop endif ; read the file if ( com ) then begin dummyname = './'+filename+'.arts.dummy.this.should.not.be.here' print,' decompressing...' spawn,'zcat '+filename+' > '+dummyname ; read in from dummyname output=read_datafile(dummyname, /check) ;remove the dummy matrix file spawn,'rm '+dummyname endif else begin ; read in from filename output=read_datafile(filename, /check) endelse end ;; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%