[MITgcm-support] STDOUT monitor output

Ed Hill ed at eh3.com
Mon Jan 16 12:05:41 EST 2006


On Mon, 2006-01-16 at 10:49 -0500, Thomas Haine wrote:
> Hi, I've noticed a very minor formatting glitch in STDOUT monitor
> output:
> 
> (PID.TID 0000.0001) %MON seaice_area_max              =
> 3.0247774315412-163
> (PID.TID 0000.0001) %MON seaice_area_min              =
> 0.0000000000000E+00

Hi Tom,

This "problem" boils down to a single formatted write (located in the
mon_out.f file) which does:

  WRITE(msgBuf(36:57),'(1X,1P1E21.13)') dval

to generate the numerical part of the monitor output.  Using the simple
program below, notice how different compilers give these answers:

  g77 (GCC 3.x):
  1.2345678806305E+00  1.2345678900000E-07  1.2345678900000+123
   1.2345678806305E+00   1.2345678900000E-07   1.2345678900000+123
    1.2345678806305E+00    1.2345678900000E-07    1.2345678900000+123

  Intel ifort v8.x:
  1.2345678806305E+00  1.2345678900000E-07  1.2345678900000+123
   1.2345678806305E+00   1.2345678900000E-07   1.2345678900000+123
    1.2345678806305E+00    1.2345678900000E-07    1.2345678900000+123

  PGI v5.2:
  1.2345678806305E+00  1.2345678900000E-07  1.2345678900000+123
   1.2345678806305E+00   1.2345678900000E-07   1.2345678900000+123
    1.2345678806305E+00    1.2345678900000E-07    1.2345678900000+123


which all drop the "E" even when there is sufficient "space" within the
overall output field width.  So trying to parse the monitor ASCII output
can be tricky.

Given the above, what can you do?  You have at least two choices:

  1) write a smarter parser for the ASCII output or
  2) quick mucking about with ASCII and use MNC to write the 
     monitor output to a neatly and consistently formatted 
     netCDF file.

The MNC capability is there in the code so you just need to turn it on.
And I'll be happy to help you build netCDF for whatever platform you're
using.  For example, see: 

  http://eh3.com/blog_20060107.html

Ed

===== t.f =====
      program t
      double precision a,b,c
      a = 1.23456789
      b = 1.23456789d-7
      c = 1.23456789d+123
      write(6,'(1P1E21.13,1P1E21.13,1P1E21.13)') a,b,c
      write(6,'(1P1E22.13,1P1E22.13,1P1E22.13)') a,b,c
      write(6,'(1P1E23.13,1P1E23.13,1P1E23.13)') a,b,c
      end
===== t.f =====

-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS;  Rm 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464




More information about the MITgcm-support mailing list