[Dart-dev] [6182] DART/branches/development/preprocess: Change the 'force' namelist item to the more appropriately

nancy at ucar.edu nancy at ucar.edu
Wed May 29 10:08:55 MDT 2013


Revision: 6182
Author:   nancy
Date:     2013-05-29 10:08:55 -0600 (Wed, 29 May 2013)
Log Message:
-----------
Change the 'force' namelist item to the more appropriately
named 'overwrite_output' and make it TRUE by default.  this
change should be almost transparent since the quickbuild.csh
script has always removed the target files before running
preprocess; this change makes it easier for folks working on
forward operator code since you don't have to remove the
target files by hand before reexecuting preprocess.

Modified Paths:
--------------
    DART/branches/development/preprocess/preprocess.f90
    DART/branches/development/preprocess/preprocess.html
    DART/branches/development/preprocess/preprocess.nml

-------------- next part --------------
Modified: DART/branches/development/preprocess/preprocess.f90
===================================================================
--- DART/branches/development/preprocess/preprocess.f90	2013-05-29 16:07:07 UTC (rev 6181)
+++ DART/branches/development/preprocess/preprocess.f90	2013-05-29 16:08:55 UTC (rev 6182)
@@ -118,11 +118,11 @@
                         '../../../obs_kind/obs_kind_mod.f90'
 character(len = 129) :: input_files(max_input_files) = 'null'
 character(len = 129) :: model_files(max_model_files) = 'null'
-logical              :: force = .false.
+logical              :: overwrite_output = .true.
 
 namelist /preprocess_nml/ input_obs_def_mod_file, input_obs_kind_mod_file,   &
                           output_obs_def_mod_file, output_obs_kind_mod_file, &
-                          input_files, model_files, force
+                          input_files, model_files, overwrite_output
 
 !---------------------------------------------------------------------------
 ! start of program code
@@ -195,7 +195,7 @@
 ! DEFAULT files must exist or else an error
 if(file_exist(trim(input_obs_def_mod_file))) then
    ! Open the file for reading
-   obs_def_in_unit = open_file(input_obs_def_mod_file)
+   obs_def_in_unit = open_file(input_obs_def_mod_file, action='read')
 else
    ! If file does not exist it is an error
    write(err_string, *) 'file ', trim(input_obs_def_mod_file), &
@@ -206,7 +206,7 @@
 
 if(file_exist(trim(input_obs_kind_mod_file))) then
    ! Open the file for reading
-   obs_kind_in_unit = open_file(input_obs_kind_mod_file)
+   obs_kind_in_unit = open_file(input_obs_kind_mod_file, action='read')
 else
    ! If file does not exist it is an error
    write(err_string, *) 'file ', trim(input_obs_kind_mod_file), &
@@ -215,23 +215,23 @@
       source, revision, revdate)
 endif
 
-! Output files must NOT EXIST or else an error
-if(.not. file_exist(trim(output_obs_def_mod_file)) .or. force) then
+! Error if Output files EXIST, unless 'overwrite_output' is TRUE
+if(.not. file_exist(trim(output_obs_def_mod_file)) .or. overwrite_output) then
    ! Open (create) the file for writing
-   obs_def_out_unit = open_file(output_obs_def_mod_file)
+   obs_def_out_unit = open_file(output_obs_def_mod_file, action='write')
 else
-   ! If file *does* exist it is an error
+   ! If file *does* exist and we haven't said ok to overwrite, error
    write(err_string, *) 'file ', trim(output_obs_def_mod_file), &
       ' exists and will not be overwritten: Please remove or rename'
    call error_handler(E_ERR, 'preprocess', err_string, &
       source, revision, revdate)
 endif
 
-if(.not. file_exist(trim(output_obs_kind_mod_file)) .or. force) then
+if(.not. file_exist(trim(output_obs_kind_mod_file)) .or. overwrite_output) then
    ! Open (create) the file for writing
-   obs_kind_out_unit = open_file(output_obs_kind_mod_file)
+   obs_kind_out_unit = open_file(output_obs_kind_mod_file, action='write')
 else
-   ! If file *does* exist it is an error
+   ! If file *does* exist and we haven't said ok to overwrite, error
    write(err_string, *) 'file ', trim(output_obs_kind_mod_file), &
       ' exists and will not be overwritten: Please remove or rename'
    call error_handler(E_ERR, 'preprocess', err_string, &
@@ -251,7 +251,7 @@
 SEARCH_INPUT_FILES: do j = 1, num_input_files
    if(file_exist(trim(input_files(j)))) then
       ! Open the file for reading
-         in_unit = open_file(input_files(j))
+         in_unit = open_file(input_files(j), action='read')
    else
       ! If file does not exist it is an error
       write(err_string, *) 'input_files ', trim(input_files(j)), &
@@ -595,7 +595,7 @@
       ! open and close them each time needed
       if(file_exist(trim(input_files(j)))) then
          ! Open the file for reading
-         in_unit = open_file(input_files(j))
+         in_unit = open_file(input_files(j), action='read')
       else
          ! If file does not exist it is an error
          write(err_string, *) 'input_files ', trim(input_files(j)), &

Modified: DART/branches/development/preprocess/preprocess.html
===================================================================
--- DART/branches/development/preprocess/preprocess.html	2013-05-29 16:07:07 UTC (rev 6181)
+++ DART/branches/development/preprocess/preprocess.html	2013-05-29 16:08:55 UTC (rev 6182)
@@ -173,12 +173,13 @@
      the obs_def directory in files such as 
       <em class="file">obs_def_reanalysis_bufr_mod.f90</em>.</TD></TR>
 
-<TR><!--contents--><TD valign=top>force           </TD>
+<TR><!--contents--><TD valign=top>overwrite_output </TD>
     <!--  type  --><TD valign=top>logical<BR>
           <em class="unit">[default: .false.]</em></TD>
     <!--descript--><TD> If set to .true., will allow preprocess to overwrite
      existing obs_kind_mod.f90 and obs_def_mod.f90 files without complaint.  
-     The default setting prevents you from overwriting existing files. </TD></TR>
+     The default setting has changed from .FALSE. to .TRUE., so by default it
+     will not complain about existing files but will silently update them in place. </TD></TR>
 
 </TABLE>
 

Modified: DART/branches/development/preprocess/preprocess.nml
===================================================================
--- DART/branches/development/preprocess/preprocess.nml	2013-05-29 16:07:07 UTC (rev 6181)
+++ DART/branches/development/preprocess/preprocess.nml	2013-05-29 16:08:55 UTC (rev 6182)
@@ -1,5 +1,5 @@
 &preprocess_nml
-                     force = .FALSE.,
+          overwrite_output = .true.,
     input_obs_def_mod_file = '../../../obs_def/DEFAULT_obs_def_mod.F90', 
    output_obs_def_mod_file = '../../../obs_def/obs_def_mod.f90', 
    input_obs_kind_mod_file = '../../../obs_kind/DEFAULT_obs_kind_mod.F90', 


More information about the Dart-dev mailing list