[Dart-dev] DART/branches Revision: 10783

dart at ucar.edu dart at ucar.edu
Mon Dec 5 16:06:36 MST 2016


hendric at ucar.edu
2016-12-05 16:06:36 -0700 (Mon, 05 Dec 2016)
203
Have the option to clamp variables or not. Before write_state()
would always clamp ensemble members if clamping was present. 
For the case of preassim and postassim files we do not 
want this behavior.




Modified: DART/branches/rma_fixed_filenames/filter/filter_mod.f90
===================================================================
--- DART/branches/rma_fixed_filenames/filter/filter_mod.f90	2016-12-01 21:46:10 UTC (rev 10782)
+++ DART/branches/rma_fixed_filenames/filter/filter_mod.f90	2016-12-05 23:06:36 UTC (rev 10783)
@@ -865,7 +865,7 @@
 call timestamp_message('Before writing state restart files if requested')
 
 call write_state(state_ens_handle, file_info_output, prior_inflate, post_inflate, &
-                 do_spares=.true.)
+                 do_spares=.true., do_clamping=.true.)
 
 if(ds) call smoother_write_restart(1, ens_size)
 call trace_message('After  writing state restart files if requested')

Modified: DART/branches/rma_fixed_filenames/io/direct_netcdf_mod.f90
===================================================================
--- DART/branches/rma_fixed_filenames/io/direct_netcdf_mod.f90	2016-12-01 21:46:10 UTC (rev 10782)
+++ DART/branches/rma_fixed_filenames/io/direct_netcdf_mod.f90	2016-12-05 23:06:36 UTC (rev 10783)
@@ -143,19 +143,20 @@
 
 
 subroutine transpose_write(state_ens_handle, name_handle, domain, &
-                     dart_index, limit_mem, write_single_precision)
+                     dart_index, limit_mem, write_single_precision, clamp_variables)
 
-type(ensemble_type),      intent(inout) :: state_ens_handle
+type(ensemble_type),       intent(inout) :: state_ens_handle
 type(stage_metadata_type), intent(in)    :: name_handle
-integer,                  intent(in)    :: domain
-integer,                  intent(inout) :: dart_index
-integer,                  intent(in)    :: limit_mem !< How many state elements you can write at once
-logical,                  intent(in)    :: write_single_precision
+integer,                   intent(in)    :: domain
+integer,                   intent(inout) :: dart_index
+integer,                   intent(in)    :: limit_mem !< How many state elements you can write at once
+logical,                   intent(in)    :: write_single_precision
+logical,                   intent(in)    :: clamp_variables
 
 if (task_count() == 1) then
-   call transpose_write_single_task(state_ens_handle, name_handle, domain, dart_index, write_single_precision)
+   call transpose_write_single_task(state_ens_handle, name_handle, domain, dart_index, write_single_precision, clamp_variables)
 else
-   call transpose_write_multi_task(state_ens_handle, name_handle, domain, dart_index, limit_mem, write_single_precision)
+   call transpose_write_multi_task(state_ens_handle, name_handle, domain, dart_index, limit_mem, write_single_precision, clamp_variables)
 endif
 
 end subroutine transpose_write
@@ -231,13 +232,14 @@
 
 
 subroutine transpose_write_single_task(state_ens_handle, name_handle, domain, &
-                     dart_index, write_single_precision)
+                     dart_index, write_single_precision, clamp_variables)
 
 type(ensemble_type),      intent(inout) :: state_ens_handle
 type(stage_metadata_type), intent(in)    :: name_handle
 integer,                  intent(in)    :: domain
 integer,                  intent(inout) :: dart_index
 logical,                  intent(in)    :: write_single_precision
+logical,                  intent(in)    :: clamp_variables
 
 integer :: ncfile_out !< netcdf output file handle
 character(len=256) :: netcdf_filename_out
@@ -292,8 +294,8 @@
 
       vector = state_ens_handle%copies(copy, starting_point:ending_point)
 
-      if (copy <= state_ens_handle%num_copies - state_ens_handle%num_extras) then
-         ! actual copy, may need clamping
+      if (copy <= state_ens_handle%num_copies - state_ens_handle%num_extras .and. &
+          clamp_variables) then ! actual copy, may need clamping
          call write_variables_clamp(ncfile_out, vector, 1, get_num_variables(domain), domain)
       else ! extra copy, don't clamp
          call write_variables(ncfile_out, vector, 1, get_num_variables(domain), domain)
@@ -498,7 +500,7 @@
 
 
 subroutine transpose_write_multi_task(state_ens_handle, name_handle, domain, &
-                dart_index, limit_mem, write_single_precision)
+                dart_index, limit_mem, write_single_precision, clamp_variables)
 
 type(ensemble_type),      intent(inout) :: state_ens_handle
 type(stage_metadata_type), intent(in)    :: name_handle
@@ -506,6 +508,7 @@
 integer,                  intent(inout) :: dart_index
 integer,                  intent(in)    :: limit_mem !< How many state elements you can read at once
 logical,                  intent(in)    :: write_single_precision
+logical,                  intent(in)    :: clamp_variables
 
 integer :: i
 integer :: start_var, end_var !< start/end variables in a read block
@@ -643,7 +646,8 @@
       if (is_writer) then ! I am a writer
          if ( query_write_copy(my_copy)) then
             !var_block = MISSING_R8  ! if you want to create a file for bitwise testing
-            if (my_copy <= state_ens_handle%num_copies - state_ens_handle%num_extras) then ! actual copy, may need clamping
+            if (my_copy <= state_ens_handle%num_copies - state_ens_handle%num_extras .and. &
+                clamp_variables) then ! actual copy, may need clamping
                call write_variables_clamp(ncfile_out, var_block, start_var, end_var, domain)
             else ! extra copy, don't clamp
                call write_variables(ncfile_out, var_block, start_var, end_var, domain)


More information about the Dart-dev mailing list