[Dart-dev] [5983] DART/branches/development/models/clm/model_mod.f90: In preparation for using the COSMOS operator.

nancy at ucar.edu nancy at ucar.edu
Tue Mar 5 10:40:06 MST 2013


Revision: 5983
Author:   thoar
Date:     2013-03-05 10:40:05 -0700 (Tue, 05 Mar 2013)
Log Message:
-----------
In preparation for using the COSMOS operator.
Now interpolates geopotential heights (primarily to query for number of levels).
Also fixes error when trying to interpolate for an observation above or at the
top model depth.

Modified Paths:
--------------
    DART/branches/development/models/clm/model_mod.f90

-------------- next part --------------
Modified: DART/branches/development/models/clm/model_mod.f90
===================================================================
--- DART/branches/development/models/clm/model_mod.f90	2013-03-01 18:58:04 UTC (rev 5982)
+++ DART/branches/development/models/clm/model_mod.f90	2013-03-05 17:40:05 UTC (rev 5983)
@@ -56,12 +56,14 @@
                              file_to_text
 
 use     obs_kind_mod, only : KIND_SOIL_TEMPERATURE,   &
+                             KIND_SOIL_MOISTURE,      &
                              KIND_LIQUID_WATER,       &
                              KIND_ICE,                &
                              KIND_SNOWCOVER_FRAC,     &
                              KIND_SNOW_THICKNESS,     &
                              KIND_LEAF_CARBON,        &
                              KIND_WATER_TABLE_DEPTH,  &
+                             KIND_GEOPOTENTIAL_HEIGHT,&
                              paramname_length,        &
                              get_raw_obs_kind_index
 
@@ -2042,6 +2044,8 @@
 
 real(r8), dimension(3) :: loc_array
 real(r8) :: llon, llat, lheight
+real(r8) :: interp_val_2
+integer  :: istatus_2
 
 if ( .not. module_initialized ) call static_init_model
 
@@ -2051,7 +2055,8 @@
 ! good value, and the last line here sets istatus to 0.
 ! make any error codes set here be in the 10s
 
-interp_val = MISSING_R8     ! the DART bad value flag
+interp_val   = MISSING_R8     ! the DART bad value flag
+interp_val_2 = MISSING_R8     ! the DART bad value flag
 istatus = 99                ! unknown error
 
 ! Get the individual locations values
@@ -2069,6 +2074,19 @@
 
 if (obs_kind == KIND_SOIL_TEMPERATURE) then
    call get_grid_vertval(x, location, 'T_SOISNO',  interp_val, istatus )
+
+elseif (obs_kind == KIND_SOIL_MOISTURE) then
+   ! TJH FIXME - actually ROLAND FIXME
+   ! This is terrible ... the COSMOS operator wants m3/m3 ... CLM is kg/m2
+   call get_grid_vertval(x, location, 'H2OSOI_LIQ',interp_val  , istatus   )
+   call get_grid_vertval(x, location, 'H2OSOI_ICE',interp_val_2, istatus_2 )
+   if ((istatus == 0) .and. (istatus_2 == 0)) then
+      interp_val = interp_val + interp_val_2
+   else
+      interp_val = MISSING_R8
+      istatus = 6
+   endif
+
 elseif (obs_kind == KIND_LIQUID_WATER ) then
    call get_grid_vertval(x, location, 'H2OSOI_LIQ',interp_val, istatus )
 elseif (obs_kind == KIND_ICE ) then
@@ -2083,6 +2101,14 @@
    write(string1,*)'model_interpolate for DZSNO not written yet.'
    call error_handler(E_ERR,'compute_gridcell_value',string1,source,revision,revdate)
    istatus = 5
+elseif ((obs_kind == KIND_GEOPOTENTIAL_HEIGHT) .and. vert_is_level(location)) then
+   if (nint(lheight) > nlevgrnd) then
+      interp_val = MISSING_R8
+      istatus = 1
+   else
+      interp_val = LEVGRND(nint(lheight))
+      istatus = 0
+   endif
 else
    write(string1,*)'model_interpolate not written for (integer) kind ',obs_kind
    call error_handler(E_ERR,'compute_gridcell_value',string1,source,revision,revdate)
@@ -2370,11 +2396,15 @@
       counter1            = counter1 + 1
       above( counter1)    =        x(indexi)
       myarea(counter1,1)  = landarea(indexi)
-   elseif (levels(indexi) == depthbelow) then
+   endif
+   if (levels(indexi)     == depthbelow) then
       counter2            = counter2 + 1
       below( counter2)    =        x(indexi)
       myarea(counter2,2)  = landarea(indexi)
-   else
+   endif
+
+   if ((levels(indexi) /= depthabove) .and. &
+       (levels(indexi) /= depthbelow)) then
       cycle ELEMENTS
    endif
 


More information about the Dart-dev mailing list