[Dart-dev] DART/branches Revision: 12180

dart at ucar.edu dart at ucar.edu
Tue Dec 5 14:30:16 MST 2017


nancy at ucar.edu
2017-12-05 14:30:14 -0700 (Tue, 05 Dec 2017)
289
refactor a chunk of model_interpolate so the chunks are
smaller and the flow is easier to see. 

remove unneeded comment blocks and discussion.

move the netcdf open/close into the routine
that uses it.

remove the routine that does work which is now
folded into the quad interp routine.




Modified: DART/branches/recam/models/cam-fv/model_mod.f90
===================================================================
--- DART/branches/recam/models/cam-fv/model_mod.f90	2017-12-05 19:59:35 UTC (rev 12179)
+++ DART/branches/recam/models/cam-fv/model_mod.f90	2017-12-05 21:30:14 UTC (rev 12180)
@@ -212,12 +212,11 @@
 
 
 !-----------------------------------------------------------------------
-! All the REQUIRED interfaces come first - by convention.
+! All the required interfaces are first.
 !-----------------------------------------------------------------------
 
 
 !-----------------------------------------------------------------------
-!>
 !> Called to do one time initialization of the model.
 !> In this case, it reads in the grid information, the namelist
 !> containing the variables of interest, where to get them, their size,
@@ -279,9 +278,7 @@
 
 
 !-----------------------------------------------------------------------
-!>
 !> Returns the size of the DART state vector (i.e. model) as an integer.
-!> Required for all applications.
 !>
 
 function get_model_size()
@@ -403,12 +400,12 @@
 end function get_location_from_index
 
 !-----------------------------------------------------------------------
-!>
 !> this routine should be called to get a value from an unstaggered grid
 !> that corresponds to a staggered grid.  e.g. you need the surface pressurre
 !> under a V wind point.
 
-subroutine get_staggered_values_from_qty(ens_handle, ens_size, qty, lon_index, lat_index, lev_index, stagger_qty, vals, my_status)
+subroutine get_staggered_values_from_qty(ens_handle, ens_size, qty, lon_index, lat_index, &
+                                         lev_index, stagger_qty, vals, my_status)
 type(ensemble_type), intent(in) :: ens_handle
 integer,             intent(in) :: ens_size
 integer,             intent(in) :: qty
@@ -554,7 +551,8 @@
 !-----------------------------------------------------------------------
 !> this is just for 3d fields
 
-subroutine get_values_from_nonstate_fields(ens_handle, ens_size, lon_index, lat_index, lev_index, obs_quantity, vals, my_status)
+subroutine get_values_from_nonstate_fields(ens_handle, ens_size, lon_index, lat_index, &
+                                           lev_index, obs_quantity, vals, my_status)
 type(ensemble_type),  intent(in)  :: ens_handle
 integer,              intent(in)  :: ens_size
 integer,              intent(in)  :: lon_index
@@ -567,6 +565,8 @@
 integer  :: imember
 real(r8) :: vals_array(grid_data%lev%nsize,ens_size)
 
+character(len=*), parameter :: routine = 'get_values_from_nonstate_fields:'
+
 vals(:) = MISSING_R8
 
 select case (obs_quantity)
@@ -592,8 +592,8 @@
       my_status(:) = 0
 
    case default
-      !>@todo FIXME
-      print*, 'should not go here'
+      write(string1,*)'contact dart support. unexpected error for quantity ', obs_quantity
+      call error_handler(E_MSG,routine,string1,source,revision,revdate)
 
 end select
 
@@ -625,6 +625,7 @@
 !> istatus = 12   cannot get values from obs quantity
 !> istatus = 13   can not interpolate values of this quantity
 !> istatus = 14   can not interpolate values above a given level
+!> istatus = 15   can not get indices from given state vector index
 !> istatus = X
 !> istatus = 99   unknown error - shouldn't happen
 !>
@@ -648,52 +649,26 @@
 real(r8) :: lon_fract, lat_fract
 real(r8) :: lon_lat_vert(3)
 real(r8) :: botvals(ens_size), topvals(ens_size)
-real(r8) :: two_horiz_fracts(2)
 real(r8) :: four_vert_fracts(4, ens_size), quad_vals(4, ens_size)
 type(quad_interp_handle) :: interp_handle
 
 if ( .not. module_initialized ) call static_init_model
 
-! the overall strategy:
-! 1. figure out if the quantity to interpolate is
-! in the state.  if so, compute and return the value.
-! if not, is it something that is a simple function of
-! items in the state that we should compute here instead
-! of computing it in a separate forward operator?  ok, we'll
-! do it.. else error.
-! (if there *are* functions of state vars or others that we
-! need to compute here, put the rest of the interp code into
-! a separate subroutine for reuse.)


More information about the Dart-dev mailing list