[44] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; |
---|
[130] | 6 | ; @file_comments |
---|
| 7 | ; write an Oasis file (version < 2.5) |
---|
[44] | 8 | ; |
---|
[163] | 9 | ; @param FILENAME {in}{required} |
---|
[136] | 10 | ; the filename |
---|
[44] | 11 | ; |
---|
[163] | 12 | ; @param VARNAME {in}{required} |
---|
[136] | 13 | ; the name of the variable to be written |
---|
| 14 | ; |
---|
[163] | 15 | ; @param Z2D {in}{required} |
---|
[136] | 16 | ; the variable (2D array) to be written |
---|
| 17 | ; |
---|
[130] | 18 | ; @keyword I2 |
---|
| 19 | ; @keyword I4 |
---|
| 20 | ; @keyword I8 |
---|
| 21 | ; @keyword R4 |
---|
[121] | 22 | ; to change the default format (R8) of the data to be written. |
---|
[44] | 23 | ; |
---|
[136] | 24 | ; @keyword APPEND |
---|
| 25 | ; to open the file with the file pointer at the end of the file, ready for |
---|
| 26 | ; data to be appended. |
---|
[44] | 27 | ; |
---|
[136] | 28 | ; @restrictions |
---|
| 29 | ; varname is automatically written as a "character*8" |
---|
| 30 | ; by default z2d is written as an R8 array |
---|
[44] | 31 | ; |
---|
[106] | 32 | ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[44] | 33 | ; July 01, 2002 |
---|
[130] | 34 | ; @version $Id$ |
---|
[44] | 35 | ;- |
---|
| 36 | ;------------------------------------------------------------ |
---|
| 37 | ;------------------------------------------------------------ |
---|
| 38 | ;------------------------------------------------------------ |
---|
| 39 | |
---|
| 40 | |
---|
[107] | 41 | PRO write_oasis, filename, varname, z2d, I2 = i2, I4 = i4, I8 = i8, R4 = r4, APPEND = append |
---|
[114] | 42 | ; |
---|
| 43 | compile_opt idl2, strictarrsubs |
---|
| 44 | ; |
---|
[44] | 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 |
---|