;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; ; @file_comments write an Oasis file (version < 2.5) ; ; @param filename {in}{required} the filename ; @param varname {in}{required} the name of the variable to be written ; @param z2d {in}{required} the variable (2D array) to be written ; ; @keyword /I2 ; @keyword /I4 ; @keyword /I8 ; @keyword /R4 ; to change the defaut format (R8) of the data to be written. ; ; @keyword /APPEND to open the file with the file pointer at the end of ; the file, ready for data to be appended. ; ; ; @restrictions varname is automatically written as a "charactere*8" ; by defaut z2d is written as an R8 array ; ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) ; July 01, 2002 ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ PRO write_oasis, filename, varname, z2d, I2 = i2, I4 = i4, I8 = i8, R4 = r4, APPEND = append openw, unit, filename , /F77_UNFORMATTED, /GET_LUN, /SWAP_IF_LITTLE_ENDIAN $ , error=err, APPEND = append if err ne 0 then begin print,!err_string return endif writeu, unit, string(varname, format='(a8)') case 1 of keyword_set(i2):writeu, unit, fix(z2d) keyword_set(i4):writeu, unit, long(z2d) keyword_set(i8):writeu, unit, long64(z2d) keyword_set(r4):writeu, unit, float(z2d) ELSE:writeu, unit, double(z2d) endcase free_lun,unit return end