diff --git a/assimilation_code/location/threed_cartesian/location_mod.f90 b/assimilation_code/location/threed_cartesian/location_mod.f90 index 32c712d165..7afa4722d4 100644 --- a/assimilation_code/location/threed_cartesian/location_mod.f90 +++ b/assimilation_code/location/threed_cartesian/location_mod.f90 @@ -1046,10 +1046,21 @@ subroutine get_close_init(gc, num, maxdist, locs, maxdist_list) if ( .not. module_initialized ) call initialize_module +if (maxdist <= 0.0_r8) then + write(msgstring, *) 'bad maxdist value ', maxdist, ' , must be > 0' + call error_handler(E_ERR, 'get_close_init', msgstring, source) +endif + typecount = get_num_types_of_obs() allocate(gc%type_to_cutoff_map(typecount)) if (present(maxdist_list)) then + + if (any(maxdist_list <= 0.0_r8)) then + write(msgstring, *) 'bad maxdist_list value ', maxdist_list, ' , must be > 0' + call error_handler(E_ERR, 'get_close_init', msgstring, source) + endif + if (size(maxdist_list) .ne. typecount) then write(msgstring,'(A,I8,A,I8)')'maxdist_list len must equal number of specific types, ', & size(maxdist_list), ' /= ', typecount