;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; NAME:write_oasis ; ; PURPOSE:write an Oasis file (version < 2.5) ; ; CATEGORY: ; ; CALLING SEQUENCE:write_oasis, filename, varname, z2d ; ; INPUTS: ; filename:the filename ; varname: the name of the variable to be written ; z2d: the variable (2D array) to be written ; ; KEYWORD PARAMETERS: ; /I2, /I4, /I8, /R4: to change the defaut format (R8) of the data to ; be written. ; ; /APPEND: to open the file with the file pointer at the end of ; the file, ready for data to be appended. ; ; OUTPUTS: ; ; COMMON BLOCKS: ; ; SIDE EFFECTS:varname is automatically written as a "charactere*8" ; by defaut z2d is written as an R8 array ; ; RESTRICTIONS: ; ; EXAMPLE: ; ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) ; July 01, 2002 ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ PRO write_oasis, filename, varname, z2d, 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