[Dart-dev] DART/branches Revision: 11489

dart at ucar.edu dart at ucar.edu
Fri Apr 14 10:14:09 MDT 2017


nancy at ucar.edu
2017-04-14 10:14:07 -0600 (Fri, 14 Apr 2017)
631
commit the version of this code which uses the new
netcdf sampling_error_correction table.  all the path_names
files should have already included the needed modules
but this version was never committed.  we still may need
a way to point users to where to pick up the sampling
error correction file.  right now it is in the
assimilation_code/programs/gen_sampling_err_table directory
which seems a bit tough to find.  the file itself is only
160K - perhaps we should commit a version of it in the
work directories of all the large models?  i'm open to
ideas here.  symbolic links are a problem for subversion
or i'd suggest those.




Modified: DART/branches/rma_trunk/assimilation_code/modules/assimilation/assim_tools_mod.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/modules/assimilation/assim_tools_mod.f90	2017-04-14 16:10:53 UTC (rev 11488)
+++ DART/branches/rma_trunk/assimilation_code/modules/assimilation/assim_tools_mod.f90	2017-04-14 16:14:07 UTC (rev 11489)
@@ -35,6 +35,9 @@
 
 use       obs_impact_mod, only : allocate_impact_table, read_impact_table, free_impact_table
 
+use sampling_error_correction_mod, only : get_sampling_error_table_size, &
+                                          read_sampling_error_correction
+
 use         location_mod, only : location_type, get_close_type, get_close_obs_destroy,    &
                                  operator(==), set_location_missing, write_location,      &
                                  LocationDims, vert_is_surface, has_vertical_localization,&
@@ -96,13 +99,11 @@
 character(len = 255)   :: msgstring, msgstring2, msgstring3
 
 ! Need to read in table for off-line based sampling correction and store it
-logical                :: first_get_correction = .true.
-real(r8)               :: exp_true_correl(200), alpha(200)
+integer                :: sec_table_size
+real(r8), allocatable  :: exp_true_correl(:), alpha(:)
 
 ! if adjust_obs_impact is true, read in triplets from the ascii file
-! and fill this 2d impact table.  it should be allocated for both
-! kinds and types, 0-N for kinds, 1-N for types, with a type offset
-! computed somehow.
+! and fill this 2d impact table. 
 real(r8), allocatable  :: obs_impact_table(:,:)
 
 ! version controlled file description for error handling, do not edit
@@ -187,7 +188,8 @@
    output_localization_diagnostics, localization_diagnostics_file,         &
    special_localization_obs_types, special_localization_cutoffs,           &
    allow_missing_in_clm, distribute_mean, close_obs_caching,               &
-   allow_any_impact_values, lanai_bitwise
+   adjust_obs_impact, obs_impact_filename,                                 &  
+   allow_any_impact_values, lanai_bitwise ! don't document these last two for now
 
 !============================================================================
 
@@ -279,6 +281,12 @@
    close_obs_caching = .false.
 endif
 
+if(sampling_error_correction) then
+   sec_table_size = get_sampling_error_table_size()
+   allocate(exp_true_correl(sec_table_size), alpha(sec_table_size))
+   ! we can't read the table here because we don't have access to the ens_size
+endif
+
 ! log what the user has selected via the namelist choices
 ! E_MSG only prints from PE0 by default, but go ahead and only
 ! construct the messages on PE0 as well.
@@ -1855,10 +1863,9 @@
 if(present(correl_out)) correl_out = correl
 
 
-! BEGIN TEST OF CORRECTION FROM FILE +++++++++++++++++++++++++++++++++++++++++++++++++
 ! Get the expected actual correlation and the regression weight reduction factor
 if(sampling_error_correction) then
-   call get_correction_from_file(ens_size, correl, mean_factor, exp_true_correl)
+   call get_correction_from_table(correl, mean_factor, exp_true_correl, ens_size)
    ! Watch out for division by zero; if correl is really small regression is safely 0
    if(abs(correl) > 0.001_r8) then
       reg_coef = reg_coef * (exp_true_correl / correl) * mean_factor
@@ -1868,10 +1875,8 @@
    correl = exp_true_correl
 endif
 
-! END TEST OF CORRECTION FROM FILE +++++++++++++++++++++++++++++++++++++++++++++++++
 
 
-
 ! Then compute the increment as product of reg_coef and observation space increment
 state_inc = reg_coef * obs_inc
 
@@ -1914,56 +1919,23 @@
 
 !------------------------------------------------------------------------
 
-subroutine get_correction_from_file(ens_size, scorrel, mean_factor, expected_true_correl)
+subroutine get_correction_from_table(scorrel, mean_factor, expected_true_correl, ens_size)
 
-integer,   intent(in) :: ens_size
 real(r8),  intent(in) :: scorrel
 real(r8), intent(out) :: mean_factor, expected_true_correl
+integer,  intent(in)  :: ens_size
 
-! Reads in a regression error file for a give ensemble_size and uses interpolation
-! to get correction factor into the file
+! Uses interpolation to get correction factor into the table
 
 integer             :: iunit, i, low_indx, high_indx
 real(r8)            :: temp, temp2, correl, fract, low_correl, low_exp_correl, low_alpha
 real(r8)            :: high_correl, high_exp_correl, high_alpha
-character(len = 20) :: correction_file_name
 
-if(first_get_correction) then
-   ! Compute the file name for this ensemble size
-   if(ens_size < 10) then


More information about the Dart-dev mailing list