[Dart-dev] DART/branches Revision: 11817

dart at ucar.edu dart at ucar.edu
Mon Jul 17 13:49:53 MDT 2017


nancy at ucar.edu
2017-07-17 13:49:52 -0600 (Mon, 17 Jul 2017)
468
fix an 'off by one' error in computing the specific obs types
which correspond to a generic observation quantity, when building
an obs impact table.

fix some code that validates that there are enough members in
a single-input file - error checking was too strict if starting 
from a single member and perturbing it.  also rearranged some
code that was calling a validation routine once per loop instead
of once up front (did not depend on anything inside the loop).




Modified: DART/branches/rma_trunk/assimilation_code/modules/io/direct_netcdf_mod.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/modules/io/direct_netcdf_mod.f90	2017-07-17 19:22:00 UTC (rev 11816)
+++ DART/branches/rma_trunk/assimilation_code/modules/io/direct_netcdf_mod.f90	2017-07-17 19:49:52 UTC (rev 11817)
@@ -494,7 +494,7 @@
 integer :: ens_size, extra_size, time_size, var_size, elm_count, ndims
 integer :: my_pe, recv_pe, recv_start, recv_end, start_rank
 integer :: start_pos, end_pos, send_start, send_end, start_point
-logical :: do_perturb, is_sender, is_receiver, is_member_copy, is_extra_copy
+logical :: do_perturb, is_sender, is_receiver, is_extra_copy
 
 real(r8), allocatable :: var_block(:)
 
@@ -545,6 +545,8 @@
 ! recv_* and send_* are PE's that variables are sent and received
 call get_pe_loops(ens_size, recv_start, recv_end, send_start, send_end)
 
+call check_singlefile_member_info(my_ncid, fname, ens_size, do_perturb)
+
 COPY_LOOP: do icopy = 1, ens_size+extra_size
 
    ! only SINGLE_IO_TASK_ID reads and distributes data 
@@ -553,17 +555,15 @@
    !   {variable}_priorinf_{mean,sd}
    !   {variable}_postinf_{mean,sd}
 
+   if ( file_handle%stage_metadata%io_flag(icopy) /= READ_COPY ) cycle
+
    is_extra_copy  = (icopy >  ens_size)
-   is_member_copy = (icopy <= ens_size)
 
    ! check that copy infomation is valid
-   if ( is_member_copy ) call check_singlefile_member_info(my_ncid, fname, ens_size, do_perturb)
 
    ! starting position in the copies array
    start_pos  = 1
 
-   if ( file_handle%stage_metadata%io_flag(icopy) /= READ_COPY ) cycle
-
    VAR_LOOP: do ivar = 1, get_num_variables(domain)
 
       var_size = get_variable_size(domain, ivar)
@@ -2539,11 +2539,17 @@
    ret = nf90_inquire_dimension(ncid, MemDimID, len=member_size) 
    call nc_check(ret, 'check_singlefile_member_info', 'inq_varid member : '//trim(fname))
 
-   !>@todo FIXME : if there is a single file with a member dimension but only one member
-   !> it is ok if we are perturbing.
+   ! are there enough members to start from this file?  if you're perturbing a single member
+   ! to generate an ensemble it's ok to have 1.  otherwise you have to have at least
+   ! 'ens_size' members (more is ok).
+   if (do_pert) then
+      if (member_size < 1) then
+         write(msgstring,  *) 'input file contains ', member_size, ' ensemble members; '
+         write(msgstring2, *) 'requires at least 1 member to perturb'
+         call error_handler(E_ERR, 'check_singlefile_member_info: ', msgstring, source, revision, revdate)
+      endif
 
-   ! not enough members to start from this file 
-   if ( member_size < ens_size ) then 
+   else if (member_size < ens_size) then
       write(msgstring,  *) 'input file only contains ', member_size, ' ensemble members; '
       write(msgstring2, *) 'requested ensemble size is ', ens_size
       call error_handler(E_ERR, 'check_singlefile_member_info: ', msgstring, source, revision, revdate)
@@ -2551,7 +2557,8 @@
    endif
 
 else
-
+   ! if you don't have a member dimension, it's only ok if you're reading in a single
+   ! array and not an ensemble.  
    if ( .not. do_pert ) then
       write(msgstring,  *) 'input file does not contain a "member" dimension; '
       write(msgstring2, *) 'cannot read in an ensemble of values'

Modified: DART/branches/rma_trunk/assimilation_code/modules/utilities/obs_impact_mod.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/modules/utilities/obs_impact_mod.f90	2017-07-17 19:22:00 UTC (rev 11816)
+++ DART/branches/rma_trunk/assimilation_code/modules/utilities/obs_impact_mod.f90	2017-07-17 19:49:52 UTC (rev 11817)
@@ -347,7 +347,7 @@
 
 index1 = get_index_for_type_of_obs(typename)
 index2 = get_index_for_quantity(qtyname)
-!print *, 'in set_impact, index values are: ', index1, index2
+!print *, 'in set_impact, type, qty index values are: ', index1, index2
 
 if (index1 < 0) then
    call error_handler(E_ERR, 'obs_impact', &
@@ -1484,7 +1484,6 @@
 character(len=*), intent(in), optional :: label
 
 integer :: i, typeid(toc%type_count), typesfound
-integer :: qtyid
 
 ! expand tableindex1 if type here and loop over list
 if (get_toc_type(tocindex1, toc) == ENTRY_DARTQTY) then
@@ -1493,8 +1492,7 @@
    ! and qtys array; not the indices in the table of contents.  the values
    ! returned can be used directly to set the table entries.
 
-   qtyid = tableindex1 - 1   ! qtys must be offset down by one, 0:num_qtys


More information about the Dart-dev mailing list