Commit a118273e authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

unit testing: verify that check_state does not affect masked values

parent 4fefed92
......@@ -761,15 +761,15 @@ contains
! Now destroy the state by setting all values to below the minimum
do ivar=1,size(model%state_variables)
interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar) = model%state_variables(ivar)%minimum - 1
call apply_mask_3d(interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar),model%state_variables(ivar)%missing_value)
call apply_mask_3d(interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar), model%state_variables(ivar)%missing_value - 1)
end do
do ivar=1,size(model%bottom_state_variables)
bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar) = model%bottom_state_variables(ivar)%minimum - 1
call apply_mask_2d(bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar),model%bottom_state_variables(ivar)%missing_value)
call apply_mask_2d(bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%bottom_state_variables(ivar)%missing_value - 1)
end do
do ivar=1,size(model%surface_state_variables)
surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar) = model%surface_state_variables(ivar)%minimum - 1
call apply_mask_2d(surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar),model%surface_state_variables(ivar)%missing_value)
call apply_mask_2d(surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%surface_state_variables(ivar)%missing_value - 1)
end do
call start_test('fabm_check_state < min')
......@@ -779,7 +779,7 @@ contains
!if (valid) call driver%fatal_error('fabm_check_state','state is reported as valid')
_END_OUTER_INTERIOR_LOOP_
do ivar=1,size(model%state_variables)
call check_interior(interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar), model%state_variables(ivar)%missing_value, model%state_variables(ivar)%minimum)
call check_interior(interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar), model%state_variables(ivar)%missing_value - 1, model%state_variables(ivar)%minimum)
end do
call report_test_result()
......@@ -790,7 +790,7 @@ contains
!if (valid) call driver%fatal_error('fabm_check_surface_state','state is reported as valid')
_END_OUTER_HORIZONTAL_LOOP_
do ivar=1,size(model%surface_state_variables)
call check_horizontal(surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%surface_state_variables(ivar)%missing_value, model%surface_state_variables(ivar)%minimum)
call check_horizontal(surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%surface_state_variables(ivar)%missing_value - 1, model%surface_state_variables(ivar)%minimum)
end do
call report_test_result()
......@@ -801,7 +801,7 @@ contains
!if (valid) call driver%fatal_error('fabm_check_surface_state','state is reported as valid')
_END_OUTER_HORIZONTAL_LOOP_
do ivar=1,size(model%bottom_state_variables)
call check_horizontal(bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%bottom_state_variables(ivar)%missing_value, model%bottom_state_variables(ivar)%minimum)
call check_horizontal(bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%bottom_state_variables(ivar)%missing_value - 1, model%bottom_state_variables(ivar)%minimum)
end do
call report_test_result()
......@@ -812,15 +812,15 @@ contains
! Now destroy the state by setting all values to above the maximum
do ivar=1,size(model%state_variables)
interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar) = model%state_variables(ivar)%maximum + 1
call apply_mask_3d(interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar),model%state_variables(ivar)%missing_value)
call apply_mask_3d(interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar), model%state_variables(ivar)%missing_value - 1)
end do
do ivar=1,size(model%bottom_state_variables)
bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar) = model%bottom_state_variables(ivar)%maximum + 1
call apply_mask_2d(bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar),model%bottom_state_variables(ivar)%missing_value)
call apply_mask_2d(bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%bottom_state_variables(ivar)%missing_value - 1)
end do
do ivar=1,size(model%surface_state_variables)
surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar) = model%surface_state_variables(ivar)%maximum + 1
call apply_mask_2d(surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar),model%surface_state_variables(ivar)%missing_value)
call apply_mask_2d(surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%surface_state_variables(ivar)%missing_value - 1)
end do
call start_test('fabm_check_state > max')
......@@ -830,7 +830,7 @@ contains
!if (valid) call driver%fatal_error('fabm_check_state','state is reported as valid')
_END_OUTER_INTERIOR_LOOP_
do ivar=1,size(model%state_variables)
call check_interior(interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar), model%state_variables(ivar)%missing_value, model%state_variables(ivar)%maximum)
call check_interior(interior_state(_PREARG_LOCATION_DIMENSIONS_ ivar), model%state_variables(ivar)%missing_value - 1, model%state_variables(ivar)%maximum)
end do
call report_test_result()
......@@ -841,7 +841,7 @@ contains
!if (valid) call driver%fatal_error('fabm_check_surface_state','state is reported as valid')
_END_OUTER_HORIZONTAL_LOOP_
do ivar=1,size(model%surface_state_variables)
call check_horizontal(surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%surface_state_variables(ivar)%missing_value, model%surface_state_variables(ivar)%maximum)
call check_horizontal(surface_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%surface_state_variables(ivar)%missing_value - 1, model%surface_state_variables(ivar)%maximum)
end do
call report_test_result()
......@@ -852,7 +852,7 @@ contains
!if (valid) call driver%fatal_error('fabm_check_surface_state','state is reported as valid')
_END_OUTER_HORIZONTAL_LOOP_
do ivar=1,size(model%bottom_state_variables)
call check_horizontal(bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%bottom_state_variables(ivar)%missing_value, model%bottom_state_variables(ivar)%maximum)
call check_horizontal(bottom_state(_PREARG_HORIZONTAL_LOCATION_DIMENSIONS_ ivar), model%bottom_state_variables(ivar)%missing_value - 1, model%bottom_state_variables(ivar)%maximum)
end do
call report_test_result()
......@@ -896,9 +896,9 @@ contains
real(rk), intent(in) :: required_masked_value,required_value
_DECLARE_ARGUMENTS_INTERIOR_IN_
#ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_interior_slice(dat(:,ivar),required_masked_value,required_value _ARGUMENTS_INTERIOR_IN_)
call check_interior_slice(dat(:,index),required_masked_value,required_value _ARGUMENTS_INTERIOR_IN_)
#else
call check_interior_slice(dat(ivar),required_masked_value,required_value _ARGUMENTS_INTERIOR_IN_)
call check_interior_slice(dat(index),required_masked_value,required_value _ARGUMENTS_INTERIOR_IN_)
#endif
end subroutine
......@@ -934,9 +934,9 @@ contains
real(rk), intent(in) :: required_masked_value,required_value
_DECLARE_ARGUMENTS_HORIZONTAL_IN_
#ifdef _HORIZONTAL_IS_VECTORIZED_
call check_horizontal_slice(dat(:,ivar),required_masked_value,required_value _ARGUMENTS_HORIZONTAL_IN_)
call check_horizontal_slice(dat(:,index),required_masked_value,required_value _ARGUMENTS_HORIZONTAL_IN_)
#else
call check_horizontal_slice(dat(ivar),required_masked_value,required_value _ARGUMENTS_HORIZONTAL_IN_)
call check_horizontal_slice(dat(index),required_masked_value,required_value _ARGUMENTS_HORIZONTAL_IN_)
#endif
end subroutine check_horizontal_slice_plus_1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment