[Dart-dev] DART/branches Revision: 12086

dart at ucar.edu dart at ucar.edu
Thu Nov 9 15:55:20 MST 2017


hendric at ucar.edu
2017-11-09 15:55:19 -0700 (Thu, 09 Nov 2017)
73
Adding support for 2d variables and variables not 
in the state vector.




Modified: DART/branches/recam/models/cam-fv/model_mod.f90
===================================================================
--- DART/branches/recam/models/cam-fv/model_mod.f90	2017-11-09 21:27:16 UTC (rev 12085)
+++ DART/branches/recam/models/cam-fv/model_mod.f90	2017-11-09 22:55:19 UTC (rev 12086)
@@ -332,6 +332,61 @@
 
 !-----------------------------------------------------------------------
 !>
+!> 
+
+subroutine get_values_from_qty(state_handle, ens_size, qty, lon_index, lat_index, lev_index, vals, my_status)
+type(ensemble_type), intent(in) :: state_handle
+integer,             intent(in) :: ens_size
+integer,             intent(in) :: qty
+integer,             intent(in) :: lon_index
+integer,             intent(in) :: lat_index
+integer,             intent(in) :: lev_index
+real(r8),            intent(out) :: vals(ens_size)
+integer,             intent(out) :: my_status
+
+integer :: varid
+integer(i8) :: state_indx
+
+varid      = get_varid_from_kind(domain_id, qty)
+state_indx = get_dart_vector_index(lon_index, lat_index, lev_index, domain_id, varid)
+vals(:)    = get_state(state_indx, state_handle)
+
+if (varid < 0) my_status = 12
+
+end subroutine get_values_from_qty
+
+
+!-----------------------------------------------------------------------
+!>
+!> 
+
+subroutine get_values_from_varid(state_handle, ens_size, lon_index, lat_index, lev_index, &
+                       varid, vals, my_status)
+type(ensemble_type), intent(in)  :: state_handle
+integer,  intent(in)  :: ens_size
+integer,  intent(in)  :: lon_index
+integer,  intent(in)  :: lat_index
+integer,  intent(in)  :: lev_index(ens_size)
+integer,  intent(in)  :: varid
+real(r8), intent(out) :: vals(ens_size)
+integer,  intent(out) :: my_status(ens_size)
+
+integer(i8) :: state_indx
+
+!>@todo FIXME add error checking?  is state_indx < 0 how it indicates error?
+
+!>@todo FIXME find unique level indices here (see new wrf code)
+
+state_indx = get_dart_vector_index(lon_index, lat_index, lev_index(1), domain_id, varid)
+vals       = get_state(state_indx, state_handle)
+
+my_status(:) = 0
+
+end subroutine get_values_from_varid
+
+
+!-----------------------------------------------------------------------
+!>
 !> Model interpolate will interpolate any DART state variable
 !> to the given location.
 !>
@@ -353,6 +408,8 @@
 !> istatus = 9    cannot get vertical levels for an obs on model levels
 !> istatus = 10   cannot get vertical levels for an obs on pressure levels
 !> istatus = 11   cannot get vertical levels for an obs on height levels
+!> istatus = 12   cannot get values from obs quantity
+!> istatus = 13   can not interpolate values of this quantity
 !> istatus = X
 !> istatus = 99   unknown error - shouldn't happen
 !>
@@ -370,9 +427,10 @@
 integer  :: lon_bot, lat_bot, lon_top, lat_top
 real(r8) :: lon_fract, lat_fract
 real(r8) :: lon_lat_vert(3), botvals(ens_size), topvals(ens_size)
+integer  :: level_one_array(ens_size)
 integer  :: which_vert, status1, status2, status_array(ens_size)
 type(quad_interp_handle) :: interp_handle
-integer  :: ijk(3), icorner, imember
+integer  :: ijk(3), icorner, imember, numdims
 integer  :: four_lons(4), four_lats(4)
 integer  :: two_bots(2), two_tops(2)
 real(r8) :: two_horiz_fracts(2)
@@ -405,16 +463,15 @@
 
 ! Successful istatus is 0
 interp_vals(:) = MISSING_R8
-istatus(:)    = 99
+istatus(:)     = 99
 
-! See if the state contains the obs quantity 
-varid = get_varid_from_kind(domain_id, obs_qty)
+call ok_to_interpolate(obs_qty, varid, status1)
 
 ! If not, for now return an error.  if there are other quantities
 ! that we can return that aren't part of the state then add code here.
 ! (make the rest of this routine into a separate subroutine that can


More information about the Dart-dev mailing list