diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e241d3360..0e3decf3c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,7 @@ SET(STRICT_MATH_FILES ${SRC}/helio/helio_step.f90 ${SRC}/misc/lambda_function_module.f90 ${SRC}/misc/solver_module.f90 + ${SRC}/netcdf_io/netcdf_io_implementations.f90 ${SRC}/operator/operator_module.f90 ${SRC}/operator/operator_cross.f90 ${SRC}/operator/operator_mag.f90 @@ -69,7 +70,6 @@ SET(FAST_MATH_FILES ${SRC}/encounter/encounter_io.f90 ${SRC}/encounter/encounter_util.f90 ${SRC}/helio/helio_util.f90 - ${SRC}/netcdf_io/netcdf_io_implementations.f90 ${SRC}/rmvs/rmvs_discard.f90 ${SRC}/rmvs/rmvs_encounter_check.f90 ${SRC}/rmvs/rmvs_util.f90 diff --git a/src/netcdf_io/netcdf_io_implementations.f90 b/src/netcdf_io/netcdf_io_implementations.f90 index 831b17902..b4e7f0b12 100644 --- a/src/netcdf_io/netcdf_io_implementations.f90 +++ b/src/netcdf_io/netcdf_io_implementations.f90 @@ -59,6 +59,8 @@ module subroutine netcdf_io_find_tslot(self, t, tslot) !! !! Given an open NetCDF file and a value of time t, finds the index of the time value (aka the time slot) to place a new set of data. !! The returned value of tslot will correspond to the first index value where the value of t is greater than or equal to the saved time value. + use, intrinsic :: ieee_exceptions + use, intrinsic :: ieee_arithmetic implicit none ! Arguments class(netcdf_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset @@ -67,7 +69,10 @@ module subroutine netcdf_io_find_tslot(self, t, tslot) ! Internals real(DP), dimension(:), allocatable :: tvals integer(I4B) :: i + logical, dimension(size(IEEE_ALL)) :: fpe_halting_modes + call ieee_get_halting_mode(IEEE_ALL,fpe_halting_modes) ! Save the current halting modes so we can turn them off temporarily + call ieee_set_halting_mode(IEEE_ALL,.false.) if (.not.self%lfile_is_open) return tslot = 0 @@ -76,7 +81,7 @@ module subroutine netcdf_io_find_tslot(self, t, tslot) if (self%max_tslot > 0) then allocate(tvals(self%max_tslot)) call netcdf_io_check( nf90_get_var(self%id, self%time_varid, tvals(:), start=[1]), "netcdf_io_find_tslot get_var" ) - where(tvals(:) /= tvals(:)) tvals(:) = huge(1.0_DP) + where(.not.ieee_is_normal(tvals(:))) tvals(:) = huge(1.0_DP) else allocate(tvals(1)) tvals(1) = huge(1.0_DP) @@ -91,6 +96,8 @@ module subroutine netcdf_io_find_tslot(self, t, tslot) self%max_tslot = max(self%max_tslot, tslot) self%tslot = tslot + call ieee_set_halting_mode(IEEE_ALL,fpe_halting_modes) + return end subroutine netcdf_io_find_tslot