[Dart-dev] DART/branches Revision: 12922

dart at ucar.edu dart at ucar.edu
Mon Oct 29 14:58:55 MDT 2018


thoar at ucar.edu
2018-10-29 14:58:55 -0600 (Mon, 29 Oct 2018)
424
Moved 'allow_missing_clm' from &filter_nml to &model_nml.
This allows any program to access this - not just filter.

Modified direct_netcdf_mod:write_variables() to replace the DART missing
value with the variables natural _FillValue/missing_value as long as those
attributes and values are compatible.

At present, this removes the need for assimilate.csh to call 'dart_to_model'
N times in serial during an assimilation.




Modified: DART/branches/cesm_clm/assimilation_code/modules/assimilation/filter_mod.f90
===================================================================
--- DART/branches/cesm_clm/assimilation_code/modules/assimilation/filter_mod.f90	2018-10-29 19:49:41 UTC (rev 12921)
+++ DART/branches/cesm_clm/assimilation_code/modules/assimilation/filter_mod.f90	2018-10-29 20:58:55 UTC (rev 12922)
@@ -107,7 +107,7 @@
 character(len=128), parameter :: revdate  = "$Date$"
 
 ! Some convenient global storage items
-character(len=512)      :: msgstring
+character(len=512)      :: msgstring, string2
 type(obs_type)          :: observation
 
 integer                 :: trace_level, timestamp_level
@@ -243,6 +243,7 @@
 real(r8) :: inf_upper_bound(2)             = 1000000.0_r8
 real(r8) :: inf_sd_lower_bound(2)          = 0.0_r8
 
+!>@todo so I put 'allow_missing_in_clm in the model_nml'
 ! Some models are allowed to have MISSING_R8 values in the DART state vector.
 ! If they are encountered, it is not necessarily a FATAL error.
 ! Most of the time, if a MISSING_R8 is encountered, DART should die.
@@ -249,7 +250,6 @@
 ! CLM should have allow_missing_clm = .true.
 logical  :: allow_missing_clm = .false.
 
-
 namelist /filter_nml/ async,     &
    adv_ens_command,              &
    ens_size,                     &
@@ -383,7 +383,18 @@
 ! See if smoothing is turned on
 ds = do_smoothing()
 
-call set_missing_ok_status(allow_missing_clm)
+!>@todo deprecate 'allow_missing_clm'.
+!> Is there a better way to determine if someone is specifying 'allow_missing_clm'.
+!> If they are specifying the default value, they will never see this message.
+
+! call set_missing_ok_status(allow_missing_clm)
+if (allow_missing) then
+   write(msgstring,*) '&filter_nml "allow_missing_clm" is deprecated.'
+   write(string2,*) 'Please specify "allow_missing_clm" in the &model_nml.'
+   call error_handler(E_MSG,'filter_main:', msgstring, &
+              source, revision, revdate, text2=string2)
+endif
+
 allow_missing = get_missing_ok_status()
 
 call trace_message('Before initializing inflation')

Modified: DART/branches/cesm_clm/assimilation_code/modules/io/direct_netcdf_mod.f90
===================================================================
--- DART/branches/cesm_clm/assimilation_code/modules/io/direct_netcdf_mod.f90	2018-10-29 19:49:41 UTC (rev 12921)
+++ DART/branches/cesm_clm/assimilation_code/modules/io/direct_netcdf_mod.f90	2018-10-29 20:58:55 UTC (rev 12922)
@@ -828,7 +828,10 @@
 
 
 !-------------------------------------------------------------------------------
-!> Read in variables from start_var to end_var
+!> Read in variables from start_var to end_var.
+!> If the variable has a _FillValue or missing_value attribute, those values
+!> are read and matching data values are replaced with the DART 'missing' flag.
+!>
 !>@todo FIXME: At the moment, this code is assuming that the variables in the state start
 !> at (1,1,1) and that the whole variable is read. This is not the case for
 !> TIEGCM and CLM. 
@@ -872,8 +875,6 @@
    ret = nf90_get_var(ncfile_in, var_id, var_block(istart:iend), count=dims)
    call nc_check(ret, 'read_variables: nf90_get_var',trim(get_variable_name(domain,i)) )
 
-   !>@todo replace the native missing_value or _FillValue atts with the DART missing
-
    ret = nf90_inquire_variable(ncfile_in, var_id, xtype=xtype)
    call nc_check(ret, 'read_variables: nf90_get_var',trim(get_variable_name(domain,i)) )
 
@@ -905,6 +906,8 @@
        endif
    endif
 
+   ! replace the native missing_value or _FillValue atts with the DART missing
+
    where(var_block(istart:iend) == special) var_block(istart:iend) = MISSING_R8 
    where(var_block(istart:iend) == missing) var_block(istart:iend) = MISSING_R8 
 
@@ -1544,14 +1547,78 @@
 
 end subroutine clamp_variable
 
+!-------------------------------------------------------------------------------
+!> Replace the DART missing value with the variables natural MISSING value if
+!> the variable has a MISSING or _FillValue.
+!-------------------------------------------------------------------------------
 
+subroutine replace_missing(dom_id, var_index, variable)
 
+integer,     intent(in) :: dom_id      ! domain id
+integer,     intent(in) :: var_index   ! variable index
+real(r8), intent(inout) :: variable(:) ! variable
+
+character(len=NF90_MAX_NAME) :: varname ! for informational log messages
+


More information about the Dart-dev mailing list