[44] | 1 | ;+ |
---|
| 2 | ; |
---|
[130] | 3 | ; @file_comments |
---|
| 4 | ; write an Oasis file (version < 2.5) |
---|
[44] | 5 | ; |
---|
[163] | 6 | ; @param FILENAME {in}{required} |
---|
[136] | 7 | ; the filename |
---|
[44] | 8 | ; |
---|
[163] | 9 | ; @param VARNAME {in}{required} |
---|
[136] | 10 | ; the name of the variable to be written |
---|
| 11 | ; |
---|
[163] | 12 | ; @param Z2D {in}{required} |
---|
[136] | 13 | ; the variable (2D array) to be written |
---|
| 14 | ; |
---|
[130] | 15 | ; @keyword I2 |
---|
| 16 | ; @keyword I4 |
---|
| 17 | ; @keyword I8 |
---|
| 18 | ; @keyword R4 |
---|
[121] | 19 | ; to change the default format (R8) of the data to be written. |
---|
[44] | 20 | ; |
---|
[136] | 21 | ; @keyword APPEND |
---|
| 22 | ; to open the file with the file pointer at the end of the file, ready for |
---|
| 23 | ; data to be appended. |
---|
[44] | 24 | ; |
---|
[136] | 25 | ; @restrictions |
---|
| 26 | ; varname is automatically written as a "character*8" |
---|
| 27 | ; by default z2d is written as an R8 array |
---|
[44] | 28 | ; |
---|
[106] | 29 | ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[44] | 30 | ; July 01, 2002 |
---|
[130] | 31 | ; @version $Id$ |
---|
[44] | 32 | ;- |
---|
[231] | 33 | ; |
---|
[107] | 34 | PRO write_oasis, filename, varname, z2d, I2 = i2, I4 = i4, I8 = i8, R4 = r4, APPEND = append |
---|
[114] | 35 | ; |
---|
| 36 | compile_opt idl2, strictarrsubs |
---|
| 37 | ; |
---|
[44] | 38 | openw, unit, filename , /F77_UNFORMATTED, /GET_LUN, /SWAP_IF_LITTLE_ENDIAN $ |
---|
| 39 | , error=err, APPEND = append |
---|
| 40 | if err ne 0 then begin |
---|
| 41 | print,!err_string |
---|
| 42 | return |
---|
| 43 | endif |
---|
| 44 | |
---|
| 45 | writeu, unit, string(varname, format='(a8)') |
---|
| 46 | case 1 of |
---|
| 47 | keyword_set(i2):writeu, unit, fix(z2d) |
---|
| 48 | keyword_set(i4):writeu, unit, long(z2d) |
---|
| 49 | keyword_set(i8):writeu, unit, long64(z2d) |
---|
| 50 | keyword_set(r4):writeu, unit, float(z2d) |
---|
| 51 | ELSE:writeu, unit, double(z2d) |
---|
| 52 | endcase |
---|
| 53 | |
---|
| 54 | free_lun,unit |
---|
| 55 | return |
---|
| 56 | end |
---|