[Dart-dev] DART/branches Revision: 12802
dart at ucar.edu
dart at ucar.edu
Fri Aug 31 09:28:45 MDT 2018
nancy at ucar.edu
2018-08-31 09:28:45 -0600 (Fri, 31 Aug 2018)
477
large overhaul of the utilities module. prompted by
a recursive calling sequence when early errors happened
(e.g. not being able to create a log file in the
current directory, or having it be write-protected).
remove unused routines; subroutine-ize more code to
avoid big replicated blocks; cut down on some of the
unneeded output; also add a routine to find a value
in a sorted list and add an indirect option to the
existing 'find enclosing indices and fraction' routine.
Modified: DART/branches/recam/assimilation_code/modules/utilities/utilities_mod.f90
===================================================================
--- DART/branches/recam/assimilation_code/modules/utilities/utilities_mod.f90 2018-08-31 15:26:07 UTC (rev 12801)
+++ DART/branches/recam/assimilation_code/modules/utilities/utilities_mod.f90 2018-08-31 15:28:45 UTC (rev 12802)
@@ -40,7 +40,7 @@
error_handler, &
to_upper, &
squeeze_out_blanks, &
- nc_check, &
+ nc_check, & ! remove this; moved to netcdf_utils
next_file, & ! deprecate this
logfileunit, &
nmlfileunit, &
@@ -66,6 +66,7 @@
string_to_integer, &
string_to_logical, &
find_enclosing_indices, &
+ find_first_occurrence, &
array_dump, &
dump_unit_attributes, &
! lowest level routines
@@ -157,7 +158,6 @@
integer :: iunit, io
character(len=256) :: lname
-character(len=512) :: string1,string2,string3
if ( module_initialized ) return
@@ -178,12 +178,11 @@
! be used just yet. If we cannot open a logfile, we
! always abort execution at this step.
-if ( present(progname) ) then
- if (do_output_flag) write(*,*)'Starting program ',trim(progname)
-endif
+!>@todo see if we like leaving this off
+!if ( present(progname) ) then
+! if (do_output_flag) write(*,*)'Starting program ',trim(progname)
+!endif
-if (do_output_flag) write(*,*)'Initializing the utilities module.'
-
! Read the namelist entry first before opening logfile, because
! you can rename the logfile via a utilities namelist item.
@@ -191,40 +190,31 @@
read(iunit, nml = utilities_nml, iostat = io)
call check_namelist_read(iunit, io, "utilities_nml")
+! Check to make sure termlevel is set to a reasonable value
+call check_term_level(TERMLEVEL)
+
! Open the log file with the name from the namelist
! does not return here on failure.
logfileunit = get_unit()
-if (present(alternatename)) then
- lname = alternatename
-else
- lname = logfilename
-endif
+! name of the log file
+lname = logfilename
+if (present(alternatename)) lname = alternatename
-if (do_output_flag) write(*,*)'Trying to log to unit ', logfileunit
-if (do_output_flag) write(*,*)'Trying to open file ', trim(lname)
-
open(logfileunit, file=lname, form='formatted', &
action='write', position='append', iostat = io )
if ( io /= 0 ) call fatal_opening_log('initialize_utilities', lname)
-! Log the run-time
-
+! Log the starting wall-clock time
if (do_output_flag) then
if ( present(progname) ) then
- call write_time (logfileunit, label='Starting ', &
- string1='Program '//trim(progname))
- call write_time ( label='Starting ', &
- string1='Program '//trim(progname))
+ call log_time (logfileunit, label='Starting ', &
+ string1='Program '//trim(progname))
else
- call write_time (logfileunit, label='Starting ')
- call write_time ( label='Starting ')
+ call log_time (logfileunit, label='Starting ')
endif
endif
-! Check to make sure termlevel is set to a reasonable value
-call check_term_level(TERMLEVEL)
-
! Echo the module information using normal mechanism
call register_module(source, revision, revdate)
@@ -244,7 +234,7 @@
position='append', iostat = io )
if ( io /= 0 ) then
call error_handler(E_ERR,'initialize_utilities', &
More information about the Dart-dev
mailing list