source: trunk/SRC/ReadWrite/write_oasis.pro @ 134

Last change on this file since 134 was 130, checked in by pinsard, 18 years ago

improvements of ReadWrite/?*.pro header

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