[Dart-dev] [5765] DART/branches/development/obs_model/obs_model_mod.f90: removed the verbose flag because it doesn't control whether the

nancy at ucar.edu nancy at ucar.edu
Tue Jun 12 14:18:26 MDT 2012


Revision: 5765
Author:   nancy
Date:     2012-06-12 14:18:26 -0600 (Tue, 12 Jun 2012)
Log Message:
-----------
removed the verbose flag because it doesn't control whether the
message lines print or not.   in case of error added: call set_output(.true.)
so all tasks will print messages, not just 0.  in an error situation it's
possible for tasks other than 0 to have a different time for the data and 
before it would silently fail without printing the messages about why.

also rearranged the section so the logic should be easier to follow.
tested with trace_execution true and false (which controls the setting
of print_trace_details) to ensure the info gets printed in either case.
(in this code we could use an error_handler() flag which is an error
but still returns instead of exiting.  we could use it to force
printing in all cases and have multiple calls with info before the
final fatal call which causes the program to stop.)

Modified Paths:
--------------
    DART/branches/development/obs_model/obs_model_mod.f90

-------------- next part --------------
Modified: DART/branches/development/obs_model/obs_model_mod.f90
===================================================================
--- DART/branches/development/obs_model/obs_model_mod.f90	2012-06-12 19:29:25 UTC (rev 5764)
+++ DART/branches/development/obs_model/obs_model_mod.f90	2012-06-12 20:18:26 UTC (rev 5765)
@@ -45,7 +45,6 @@
 logical :: module_initialized  = .false.
 integer :: print_timestamps    = 0
 integer :: print_trace_details = 0
-logical :: verbose             = .false.
 
 ! how to write out the state vector for the model_advance
 ! generally you want this to be binary for speed/accuracy.
@@ -171,10 +170,10 @@
       start_time = ens_time - delta_time / 2 + set_time(1, 0)
    endif
    end_time = ens_time + delta_time / 2
-   call timechat(ens_time,    'move_ahead', verbose,  'Current model data time:               ')
-   call timechat(start_time,  'move_ahead', verbose,  'Current assimilation window starts at: ')
-   call timechat(end_time,    'move_ahead', verbose,  'Current assimilation window ends at:   ')
-   !call timechat(delta_time,  'move_ahead', verbose, 'Width of assimilation window:          ')
+   call timechat(ens_time,    'move_ahead', .false.,        'Current model data time            is: ')
+   call timechat(start_time,  'move_ahead', .false.,        'Current assimilation window starts at: ')
+   call timechat(end_time,    'move_ahead', .false.,        'Current assimilation window ends   at: ')
+  !call timechat(delta_time,  'move_ahead', .false.,        'Width of assimilation window       is: ')
 endif
 
 ! now recompute for the next window, so the code below can remain unchanged.
@@ -194,52 +193,58 @@
 
 ! Output very brief current start and end time at the message level
 if (print_trace_details == 0) then
-   call timechat(start_time,  'move_ahead', verbose,  'Next assimilation window starts at: ')
-   call timechat(end_time,    'move_ahead', verbose,  'Next assimilation window ends   at: ')
+   call timechat(start_time,  'move_ahead', .false.,        'Next assimilation window starts    at: ')
+   call timechat(end_time,    'move_ahead', .false.,        'Next assimilation window ends      at: ')
 endif
 
-! If the next observation is not in the window, then have an error
+! This block of code gets called either if the next obs is not in the current window,
+! or if you're asking for the details of the assimilation window and obs times.
 if(next_time < start_time .or. next_time > end_time .or. print_trace_details > 0) then
-   ! Is this test still really needed?  If you comment out that test, you can
-   ! simply skip early obs, but for now, leave the code alone and print out a
-   ! better set of error messages.
 
-   if (next_time < start_time .or. next_time > end_time) then
-      call error_handler(E_MSG, ' ', ' ')
-      call error_handler(E_MSG, 'move_ahead', 'Inconsistent model state/observation times: ')
-   endif
-
    if (time2 /= ens_time) then
-      call timechat(next_time,   'move_ahead', verbose, 'Next available observation time:       ')
-      call timechat(time2,       'move_ahead', verbose, 'Next data time should be:              ', &
+      call timechat(next_time,   'move_ahead', .false.,     'Next available observation time    is: ')
+      call timechat(time2,       'move_ahead', .false.,     'Next data time should be           at: ', &
          'Not within current window, model will be called to advance state.')
-      call timechat(start_time,  'move_ahead', verbose, 'Next assimilation window starts at:    ')
-      call timechat(end_time,    'move_ahead', verbose, 'Next assimilation window ends   at:    ')
+      call timechat(start_time,  'move_ahead', .false.,     'Next assimilation window starts    at: ')
+      call timechat(end_time,    'move_ahead', .false.,     'Next assimilation window ends      at: ')
    else 
       if (next_time >= start_time .and. next_time <= end_time) then
-         call timechat(next_time,   'move_ahead', verbose,  'Next available observation time:       ', &
+         call timechat(next_time,   'move_ahead', .false.,  'Next available observation time    is: ', &
             'Within current assimilation window, model does not need advance.')
       else 
-         call timechat(next_time,   'move_ahead', verbose,  'Next available observation time:       ', &
+         call timechat(next_time,   'move_ahead', .false.,  'Next available observation time    is: ', &
             'Next obs outside current assimilation window.')
       endif
    endif
 
+   ! if different mpi tasks have different times, the default is only process 0
+   ! will print messages.  in this case we're headed towards a fatal error and
+   ! just trying to give the most info possible before exiting.  so make all
+   ! mpi tasks which get into this block output.  in the worst case you'll get
+   ! N sets of these messages which is messy, but probably better than having
+   ! the case where process 0 works but some other tasks fail and you get no
+   ! helpful info from them.
    if (next_time < start_time .or. next_time > end_time) then
+      call set_output(.true.) 
+      call error_handler(E_MSG, ' ', ' ')
+      call error_handler(E_MSG, 'move_ahead', 'Inconsistent model state/observation times. ')
+
       if (next_time < start_time) then
          call error_handler(E_MSG, 'move_ahead', &
             'Next observation cannot be earlier than start of new time window')
-         call timechat(next_time,   'move_ahead', verbose, 'Next available observation      at:    ')
-         call timechat(start_time,  'move_ahead', verbose, 'Next assimilation window starts at:    ')
-         call timechat(ens_time,    'move_ahead', verbose, 'Current model data time:               ')
+         call error_handler(E_MSG, ' ', ' ')
+         call timechat(next_time,   'move_ahead', .false.,  'Next available observation         at: ')
+         call timechat(start_time,  'move_ahead', .false.,  'Next assimilation window starts    at: ')
+         call timechat(ens_time,    'move_ahead', .false.,  'Current model data time            is: ')
          errstring1 = 'If this is the start of the obs_seq file, '
-         errstring2 = 'use filter namelist to set first obs or data init time.'
+         errstring2 = 'can use filter namelist to set first obs or initial data time.'
       else
          call error_handler(E_MSG, 'move_ahead', &
             'Next observation is later than end of new time window')
-         call timechat(next_time,   'move_ahead', verbose, 'Next available observation      at:    ')
-         call timechat(end_time,    'move_ahead', verbose, 'Next assimilation window ends   at:    ')
-         call timechat(ens_time,    'move_ahead', verbose, 'Current model data time:               ')
+         call error_handler(E_MSG, ' ', ' ')
+         call timechat(next_time,   'move_ahead', .false.,  'Next available observation         at: ')
+         call timechat(end_time,    'move_ahead', .false.,  'Next assimilation window ends      at: ')
+         call timechat(ens_time,    'move_ahead', .false.,  'Current model data time            is: ')
          errstring1 = 'should not happen; code has miscomputed how far to advance'
          errstring2 = ''
       endif


More information about the Dart-dev mailing list