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

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • 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}
10; the filename
11;
12; @param VARNAME {in}{required}
13; the name of the variable to be written
14;
15; @param Z2D {in}{required}
16; the variable (2D array) to be written
17;
18; @keyword I2
19; @keyword I4
20; @keyword I8
21; @keyword R4
22; to change the default format (R8) of the data to be written.
23;
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.
27;
28; @restrictions
29; varname is automatically written as a "character*8"
30; by default z2d is written as an R8 array
31;
32; @history Sebastien Masson (smasson\@lodyc.jussieu.fr)
33;                      July 01, 2002
34; @version $Id$
35;-
36;------------------------------------------------------------
37;------------------------------------------------------------
38;------------------------------------------------------------
39
40
41PRO write_oasis, filename, varname, z2d, I2 = i2, I4 = i4, I8 = i8, R4 = r4, APPEND = append
42;
43  compile_opt idl2, strictarrsubs
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
63end
Note: See TracBrowser for help on using the repository browser.