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