[Dart-dev] [3959] DART/trunk: Added a fix to the routine which was supposed to help users figure out

nancy at ucar.edu nancy at ucar.edu
Thu Jul 9 14:55:32 MDT 2009


An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090709/f57194cb/attachment.html 
-------------- next part --------------
Modified: DART/trunk/models/wrf/model_mod.f90
===================================================================
--- DART/trunk/models/wrf/model_mod.f90	2009-07-07 22:46:36 UTC (rev 3958)
+++ DART/trunk/models/wrf/model_mod.f90	2009-07-09 20:55:32 UTC (rev 3959)
@@ -55,7 +55,8 @@
                               KIND_POTENTIAL_TEMPERATURE, KIND_SOIL_MOISTURE, &
                               KIND_VORTEX_LAT, KIND_VORTEX_LON, &
                               KIND_VORTEX_PMIN, KIND_VORTEX_WMAX, &
-                              get_raw_obs_kind_index, max_obs_kinds, get_raw_obs_kind_name
+                              get_raw_obs_kind_index, get_num_raw_obs_kinds, &
+                              get_raw_obs_kind_name
 
 
 !nc -- module_map_utils split the declarations of PROJ_* into a separate module called
@@ -188,7 +189,8 @@
 
 character(len = 20) :: wrf_nml_file = 'namelist.input'
 logical :: have_wrf_nml_file = .false.
-logical :: in_state_vector(max_obs_kinds) = .false.
+integer :: num_obs_kinds = 0
+logical, allocatable :: in_state_vector(:)
 
 !-----------------------------------------------------------------------
 
@@ -335,6 +337,8 @@
 ! helpful error message if not).
 !---------------------------
 
+num_obs_kinds = get_num_raw_obs_kinds()
+allocate(in_state_vector(num_obs_kinds))
 call fill_dart_kinds_table(wrf_state_variables, in_state_vector)
 
 
@@ -572,7 +576,7 @@
 
    ! NEWVAR: If you add a new wrf array type which is not yet in this list, currently
    ! NEWVAR: you will have to add it here, and add a type_xx for it, and also add
-   ! NEWVAR: a in_state_variable case in the select statement.  search for NEWVAR.
+   ! NEWVAR: a in_state_vector case in the select statement.  search for NEWVAR.
 
    ! JPH now that we have the domain ID just go ahead and get type indices once
    ! NOTE: this is not strictly necessary - can use only stagger info in the future (???)
@@ -5930,6 +5934,8 @@
 
 integer :: row, i, nextkind
 
+in_state_vector = .false.
+
 row = size(wrf_state_variables, 2)
 
 ! NEWVAR: see each of part1, part 2, and part 3 below.
@@ -6000,17 +6006,18 @@
           (.not. in_state_vector(KIND_TEMPERATURE))        .or. &
           (.not. in_state_vector(KIND_VAPOR_MIXING_RATIO)) .or. &
           (.not. in_state_vector(KIND_PRESSURE))) then
-         write(errstring, *) 'VORTEX kinds require U,V,T,QVAPOR,MU in state vector'
-         call error_handler(E_ERR, 'fill_dart_kinds_table', errstring, &
+         write(errstring, *) 'VORTEX kinds will require U,V,T,QVAPOR,MU in state vector'
+         ! FIXME: not fatal error, just informative at this point.
+         call error_handler(E_MSG, 'fill_dart_kinds_table', errstring, &
                             source, revision, revdate)
       endif
  
    ! if you have one wind component you have to have both
    case (KIND_U_WIND_COMPONENT, KIND_V_WIND_COMPONENT)
-      if ((.not. in_state_vector(KIND_U_WIND_COMPONENT))  .or. &
-          (.not. in_state_vector(KIND_V_WIND_COMPONENT))) then
-         write(errstring, *) 'WIND kinds require both U,V in state vector'
-         call error_handler(E_ERR, 'fill_dart_kinds_table', errstring, &
+      if (in_state_vector(KIND_U_WIND_COMPONENT) .ne. in_state_vector(KIND_V_WIND_COMPONENT)) then
+         write(errstring, *) 'WIND kinds will require both U,V in state vector'
+         ! FIXME: not fatal error, just informative at this point.
+         call error_handler(E_MSG, 'fill_dart_kinds_table', errstring, &
                             source, revision, revdate)
       endif
  

Modified: DART/trunk/obs_kind/DEFAULT_obs_kind_mod.F90
===================================================================
--- DART/trunk/obs_kind/DEFAULT_obs_kind_mod.F90	2009-07-07 22:46:36 UTC (rev 3958)
+++ DART/trunk/obs_kind/DEFAULT_obs_kind_mod.F90	2009-07-09 20:55:32 UTC (rev 3959)
@@ -26,6 +26,15 @@
           write_obs_kind, read_obs_kind, get_kind_from_menu, map_def_index
 ! Added by TRW for restart file functionality
 public :: get_raw_obs_kind_name, get_raw_obs_kind_index
+! Added by nsc to try to limit the number of global vars exported from
+! this program.  i do not like this terminology, but since we are still
+! using kind where we mean type, raw kind is as good a solution as anything.
+! when i get permission to change public interfaces (next significant public
+! release of the code), all kinds will become types, and raw_kind will become
+! plain kind.  or i'll dump type/kind altogether and go to specific/generic
+! or some other pair without this long history.
+public :: get_num_obs_kinds, get_num_raw_obs_kinds
+
 public :: do_obs_form_pair, add_wind_names
 
 !----------------------------------------------------------------------------
@@ -507,8 +516,37 @@
 get_raw_obs_kind_index = -1
 
 end function get_raw_obs_kind_index
+
 !----------------------------------------------------------------------------
 
+function get_num_obs_kinds()
+
+! Accessor function to return observation *type* count
+
+integer :: get_num_obs_kinds
+
+if ( .not. module_initialized ) call initialize_module
+
+get_num_obs_kinds = max_obs_specific
+
+end function get_num_obs_kinds
+
+!----------------------------------------------------------------------------
+
+function get_num_raw_obs_kinds()
+  
+! Accessor function to return observation *kind* count
+
+integer :: get_num_raw_obs_kinds
+
+if (.not. module_initialized) call initialize_module
+
+get_num_raw_obs_kinds = max_obs_generic
+
+end function get_num_raw_obs_kinds
+
+!----------------------------------------------------------------------------
+
 function assimilate_this_obs_kind(obs_kind_ind)
 
 ! Returns true if this obs_kind is being assimilated


More information about the Dart-dev mailing list