[Dart-dev] FindIndex/ Revision: 10785

dart at ucar.edu dart at ucar.edu
Thu Dec 8 16:34:21 MST 2016


thoar at ucar.edu
2016-12-08 16:34:20 -0700 (Thu, 08 Dec 2016)
245
get_reg_box_indices() now returns an error code - which is used.
Some problems in get_reg_box_indices now throw errors or wanrings.
Most of these are from trying to interpolate land or the use the last 'box'.
This is in response to DARTSUP-391




Modified: DART/trunk/models/ROMS/model_mod.f90
===================================================================
--- DART/trunk/models/ROMS/model_mod.f90	2016-12-06 23:17:18 UTC (rev 10784)
+++ DART/trunk/models/ROMS/model_mod.f90	2016-12-08 23:34:20 UTC (rev 10785)
@@ -21,7 +21,6 @@
 !>
 !> subsequently modified by the DART team.
 !>
-!> \todo
 !> @todo really check the land masking and _FillValue processing
 !----------------------------------------------------------------
 
@@ -97,7 +96,8 @@
            get_model_restart_filename, &
            get_time_from_namelist,     &
            write_model_time,           &
-           print_variable_ranges
+           print_variable_ranges,      &
+           is_dry_land
 
 ! version controlled file description for error handling, do not edit
 character(len=256), parameter :: source   = &
@@ -149,9 +149,6 @@
 !> a netCDF file is stored here as well as all the information about where
 !> the variable is stored in the DART state vector.
 !> @todo FIXME ... do we need numvertical as opposed to ZonHalf ...
-!>
-!> @todo FIXME ... add a field for what kind of mask to use
-!>
 
 type progvartype
    private
@@ -214,6 +211,10 @@
                               mask_u(:,:), &
                               mask_v(:,:)
 
+integer(i2), parameter :: LAND  = 0_i2
+integer(i2), parameter :: WATER = 1_i2
+
+
 real(r8)        :: ocean_dynamics_timestep = 900.0_r4
 type(time_type) :: model_timestep
 
@@ -326,10 +327,11 @@
 
 ! Local variables
 
-integer  :: nxp, nzp, iloc, vloc, nf, n,nyp,jloc
+integer  :: iloc, vloc, nf, n, jloc
 integer  :: myindx
 integer  :: ivar
 real(r8) :: depth
+logical  :: dry_land
 
 if ( .not. module_initialized ) call static_init_model
 
@@ -345,10 +347,6 @@
     endif
 enddo FindIndex
 
-if (present(var_type)) then
-   var_type = progvar(nf)%dart_kind
-endif
-
 if( myindx == -1 ) then
      write(string1,*) 'Problem, cannot find base_offset, index_in is: ', index_in
      call error_handler(E_ERR,'get_state_meta_data:',string1,source,revision,revdate)
@@ -356,23 +354,54 @@
 
 ! Now that we know the variable, find the cell or edge
 
-if (     progvar(nf)%numxi /= MISSING_I .AND. progvar(nf)%numeta /= MISSING_I ) then
-   nyp = progvar(nf)%numxi
-   nxp = progvar(nf)%numeta
+if ( progvar(nf)%numxi /= MISSING_I .AND. progvar(nf)%numeta /= MISSING_I ) then
+   continue
 else
-     write(string1,*) 'ERROR, ',trim(progvar(nf)%varname),' is not defined on xi or eta'
-     call error_handler(E_ERR,'get_state_meta_data:',string1,source,revision,revdate)
+   write(string1,*) 'ERROR, ',trim(progvar(nf)%varname),' is not defined on xi or eta'
+   call error_handler(E_ERR,'get_state_meta_data:',string1,source,revision,revdate)
 endif
 
 call get_state_indices(progvar(nf)%dart_kind, myindx, iloc, jloc, vloc)
 
-nzp  = progvar(nf)%numvertical
-if(nzp==1) then
-  depth=0.0
+dry_land = is_dry_land(nf, iloc, jloc)
+
+if (present(var_type)) then
+   if (dry_land) then
+      var_type = KIND_DRY_LAND
+   else
+      var_type = progvar(nf)%dart_kind
+   endif
+endif
+
+if (dry_land) then
+   depth = MISSING_R8
 else


More information about the Dart-dev mailing list