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