[Dart-dev] [6593] DART/trunk/assim_tools/assim_tools_mod.f90: no change in behavior - rename an internal variable to more
nancy at ucar.edu
nancy at ucar.edu
Fri Nov 8 16:33:06 MST 2013
Revision: 6593
Author: nancy
Date: 2013-11-08 16:33:06 -0700 (Fri, 08 Nov 2013)
Log Message:
-----------
no change in behavior - rename an internal variable to more
correctly reflect its use. print out a message to the log
if caching of distances to co-located observations has been
disabled because different obs types have different localization
distances. in that case we have to recompute which obs are
within the localization distance and cannot use information
computed by a previous ob which might be a different type.
Modified Paths:
--------------
DART/trunk/assim_tools/assim_tools_mod.f90
-------------- next part --------------
Modified: DART/trunk/assim_tools/assim_tools_mod.f90
===================================================================
--- DART/trunk/assim_tools/assim_tools_mod.f90 2013-11-08 23:31:03 UTC (rev 6592)
+++ DART/trunk/assim_tools/assim_tools_mod.f90 2013-11-08 23:33:06 UTC (rev 6593)
@@ -25,7 +25,7 @@
use obs_def_mod, only : obs_def_type, get_obs_def_location, get_obs_def_time, &
get_obs_def_error_variance, get_obs_kind
-use obs_kind_mod, only : get_num_obs_kinds, get_obs_kind_index, &
+use obs_kind_mod, only : get_num_obs_kinds, get_obs_kind_index, &
get_obs_kind_var_type, assimilate_this_obs_kind
use cov_cutoff_mod, only : comp_cov_factor
@@ -72,6 +72,8 @@
integer :: num_types = 0
real(r8), allocatable :: cutoff_list(:)
logical :: has_special_cutoffs
+logical :: close_obs_caching = .true.
+
character(len = 255) :: msgstring, msgstring2, msgstring3
! Need to read in table for off-line based sampling correction and store it
@@ -108,7 +110,6 @@
integer :: adaptive_localization_threshold = -1
real(r8) :: adaptive_cutoff_floor = 0.0_r8
integer :: print_every_nth_obs = 0
-logical :: close_obs_caching = .true.
! since this is in the namelist, it has to have a fixed size.
integer, parameter :: MAX_ITEMS = 300
@@ -151,7 +152,7 @@
integer :: iunit, io, i, j
integer :: num_special_cutoff, type_index
-logical :: namelist_cache_override = .false.
+logical :: cache_override = .false.
call register_module(source, revision, revdate)
@@ -182,7 +183,10 @@
! allocate a list in all cases - even the ones where there is only
! a single cutoff value. note that in spite of the name these
! are specific types (e.g. RADIOSONDE_TEMPERATURE, AIRCRAFT_TEMPERATURE)
-! because that's what get_close() is passed.
+! because that's what get_close() is passed. and because i've confused
+! myself several times -- we define generic kinds starting at 0, but
+! the specific types are autogenerated and always start at 1. so the
+! cutoff list is never (0:num_types); it is always (num_types).
num_types = get_num_obs_kinds()
allocate(cutoff_list(num_types))
cutoff_list(:) = cutoff
@@ -220,7 +224,7 @@
! cannot cache previous obs location if different obs types have different
! localization radii. change it to false, and warn user why.
if (has_special_cutoffs .and. close_obs_caching) then
- namelist_cache_override = .true.
+ cache_override = .true.
close_obs_caching = .false.
endif
@@ -246,9 +250,9 @@
call error_handler(E_MSG, '', '')
endif
- if (namelist_cache_override) then
- call error_handler(E_MSG,'assim_tools_init:','Disabling the close_obs_caching because specialized localization')
- call error_handler(E_MSG,'assim_tools_init:','distances are enabled. The two cannot be used together.')
+ if (cache_override) then
+ call error_handler(E_MSG,'assim_tools_init:','Disabling the close obs caching because specialized localization')
+ call error_handler(E_MSG,'assim_tools_init:','distances are enabled. ')
endif
if(adaptive_localization_threshold > 0) then
@@ -323,7 +327,7 @@
integer :: base_obs_kind, base_obs_type, my_obs_kind(obs_ens_handle%my_num_vars)
integer :: my_obs_type(obs_ens_handle%my_num_vars)
integer :: my_state_kind(ens_handle%my_num_vars), nth_obs
-integer :: num_close_obs_buffered, num_close_states_buffered
+integer :: num_close_obs_cached, num_close_states_cached
integer :: num_close_obs_calls_made, num_close_states_calls_made
! GSR add new count for only the 'assimilate' type close obs in the tile
integer :: localization_unit, secs, days, rev_num_close_obs
@@ -341,7 +345,6 @@
logical :: local_single_ss_inflate
logical :: local_varying_ss_inflate
logical :: local_obs_inflate
-logical :: get_close_buffering
logical :: missing_in_state
! we are going to read/write the copies array
@@ -372,14 +375,6 @@
localization_unit = open_file(localization_diagnostics_file, action = 'append')
endif
-! turn on and off the close buffering - you want to turn this off if you
-! have a specialized get_close_obs() routine in your model_mod and you
-! use the type of the observation to determine anything about the distance
-! to the other locations. it will run slower, but will be accurate. if
-! you have not special handling or don't depend on the obs type, leave
-! this with the default .true. value.
-get_close_buffering = close_obs_caching
-
! For performance, make local copies of these settings which
! are really in the inflate derived type.
local_single_ss_inflate = do_single_ss_inflate(inflate)
@@ -486,7 +481,7 @@
endif
call get_close_obs_init(gc_obs, my_num_obs, my_obs_loc)
-if (get_close_buffering) then
+if (close_obs_caching) then
! Initialize last obs and state get_close lookups, to take advantage below
! of sequential observations at the same location (e.g. U,V, possibly T,Q)
! (this is getting long enough it probably should go into a subroutine. nsc.)
@@ -498,8 +493,8 @@
last_close_state_ind(:) = -1
last_close_obs_dist(:) = 888888.0_r8 ! something big, not small
last_close_state_dist(:) = 888888.0_r8 ! ditto
- num_close_obs_buffered = 0
- num_close_states_buffered = 0
+ num_close_obs_cached = 0
+ num_close_states_cached = 0
num_close_obs_calls_made = 0
num_close_states_calls_made = 0
endif
@@ -650,7 +645,7 @@
! to shrink it, and so we need to know this before doing get_close() for the
! state space (even though the state space increments will be computed and
! applied first).
- if (.not. get_close_buffering) then
+ if (.not. close_obs_caching) then
call get_close_obs(gc_obs, base_obs_loc, base_obs_type, my_obs_loc, my_obs_kind, &
num_close_obs, close_obs_ind, close_obs_dist)
else
@@ -658,7 +653,7 @@
num_close_obs = last_num_close_obs
close_obs_ind(:) = last_close_obs_ind(:)
close_obs_dist(:) = last_close_obs_dist(:)
- num_close_obs_buffered = num_close_obs_buffered + 1
+ num_close_obs_cached = num_close_obs_cached + 1
else
call get_close_obs(gc_obs, base_obs_loc, base_obs_type, my_obs_loc, my_obs_kind, &
num_close_obs, close_obs_ind, close_obs_dist)
@@ -672,7 +667,8 @@
! set the cutoff default, keep a copy of the original value, and avoid
! looking up the cutoff in a list if the incoming obs is an identity ob
- ! (and therefore has a negative kind).
+ ! (and therefore has a negative kind). specific types can never be 0;
+ ! generic kinds (not used here) start their numbering at 0 instead of 1.
if (base_obs_type > 0) then
cutoff_orig = cutoff_list(base_obs_type)
else
@@ -751,7 +747,7 @@
! Now everybody updates their close states
! Find state variables on my process that are close to observation being assimilated
- if (.not. get_close_buffering) then
+ if (.not. close_obs_caching) then
call get_close_obs(gc_state, base_obs_loc, base_obs_type, my_state_loc, my_state_kind, &
num_close_states, close_state_ind, close_state_dist)
else
@@ -759,7 +755,7 @@
num_close_states = last_num_close_states
close_state_ind(:) = last_close_state_ind(:)
close_state_dist(:) = last_close_state_dist(:)
- num_close_states_buffered = num_close_states_buffered + 1
+ num_close_states_cached = num_close_states_cached + 1
else
call get_close_obs(gc_state, base_obs_loc, base_obs_type, my_state_loc, my_state_kind, &
num_close_states, close_state_ind, close_state_dist)
@@ -978,18 +974,18 @@
! diagnostics for stats on saving calls by remembering obs at the same location.
! change .true. to .false. in the line below to remove the output completely.
-if (get_close_buffering .and. .true.) then
- if (num_close_obs_buffered > 0 .and. do_output()) then
+if (close_obs_caching .and. .true.) then
+ if (num_close_obs_cached > 0 .and. do_output()) then
print *, "Total number of calls made to get_close_obs for obs/states: ", &
num_close_obs_calls_made + num_close_states_calls_made
print *, "Total number of calls avoided to get_close_obs for obs/states: ", &
- num_close_obs_buffered + num_close_states_buffered
- if (num_close_obs_buffered+num_close_obs_calls_made+ &
- num_close_states_buffered+num_close_states_calls_made > 0) then
+ num_close_obs_cached + num_close_states_cached
+ if (num_close_obs_cached+num_close_obs_calls_made+ &
+ num_close_states_cached+num_close_states_calls_made > 0) then
print *, "Percent saved: ", 100.0_r8 * &
- (real(num_close_obs_buffered+num_close_states_buffered, r8) / &
- (num_close_obs_calls_made+num_close_obs_buffered+ &
- num_close_states_calls_made+num_close_states_buffered))
+ (real(num_close_obs_cached+num_close_states_cached, r8) / &
+ (num_close_obs_calls_made+num_close_obs_cached + &
+ num_close_states_calls_made+num_close_states_cached))
endif
endif
endif
More information about the Dart-dev
mailing list