[44] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; NAME:write_oasis |
---|
| 6 | ; |
---|
| 7 | ; PURPOSE:write an Oasis file (version < 2.5) |
---|
| 8 | ; |
---|
| 9 | ; CATEGORY: |
---|
| 10 | ; |
---|
| 11 | ; CALLING SEQUENCE:write_oasis, filename, varname, z2d |
---|
| 12 | ; |
---|
| 13 | ; INPUTS: |
---|
| 14 | ; filename:the filename |
---|
| 15 | ; varname: the name of the variable to be written |
---|
| 16 | ; z2d: the variable (2D array) to be written |
---|
| 17 | ; |
---|
| 18 | ; KEYWORD PARAMETERS: |
---|
| 19 | ; /I2, /I4, /I8, /R4: to change the defaut format (R8) of the data to |
---|
| 20 | ; be written. |
---|
| 21 | ; |
---|
| 22 | ; /APPEND: to open the file with the file pointer at the end of |
---|
| 23 | ; the file, ready for data to be appended. |
---|
| 24 | ; |
---|
| 25 | ; OUTPUTS: |
---|
| 26 | ; |
---|
| 27 | ; COMMON BLOCKS: |
---|
| 28 | ; |
---|
| 29 | ; SIDE EFFECTS:varname is automatically written as a "charactere*8" |
---|
| 30 | ; by defaut z2d is written as an R8 array |
---|
| 31 | ; |
---|
| 32 | ; RESTRICTIONS: |
---|
| 33 | ; |
---|
| 34 | ; EXAMPLE: |
---|
| 35 | ; |
---|
| 36 | ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
| 37 | ; July 01, 2002 |
---|
| 38 | ;- |
---|
| 39 | ;------------------------------------------------------------ |
---|
| 40 | ;------------------------------------------------------------ |
---|
| 41 | ;------------------------------------------------------------ |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | PRO write_oasis, filename, varname, z2d, I2, I4 = i4, I8 = i8, R4 = r4, APPEND = append |
---|
| 45 | openw, unit, filename , /F77_UNFORMATTED, /GET_LUN, /SWAP_IF_LITTLE_ENDIAN $ |
---|
| 46 | , error=err, APPEND = append |
---|
| 47 | if err ne 0 then begin |
---|
| 48 | print,!err_string |
---|
| 49 | return |
---|
| 50 | endif |
---|
| 51 | |
---|
| 52 | writeu, unit, string(varname, format='(a8)') |
---|
| 53 | case 1 of |
---|
| 54 | keyword_set(i2):writeu, unit, fix(z2d) |
---|
| 55 | keyword_set(i4):writeu, unit, long(z2d) |
---|
| 56 | keyword_set(i8):writeu, unit, long64(z2d) |
---|
| 57 | keyword_set(r4):writeu, unit, float(z2d) |
---|
| 58 | ELSE:writeu, unit, double(z2d) |
---|
| 59 | endcase |
---|
| 60 | |
---|
| 61 | free_lun,unit |
---|
| 62 | return |
---|
| 63 | end |
---|