[Dart-dev] DART/branches Revision: 11443
dart at ucar.edu
dart at ucar.edu
Fri Apr 7 09:45:24 MDT 2017
nancy at ucar.edu
2017-04-07 09:45:24 -0600 (Fri, 07 Apr 2017)
196
make the nc_check() routine take both an optional context string
and an optional filename, and add those onto the netcdf error string
if present. then call the error_handler with a fatal error.
Modified: DART/branches/model_mod_changes/assimilation_code/modules/utilities/netcdf_utilities_mod.f90
===================================================================
--- DART/branches/model_mod_changes/assimilation_code/modules/utilities/netcdf_utilities_mod.f90 2017-04-07 15:44:18 UTC (rev 11442)
+++ DART/branches/model_mod_changes/assimilation_code/modules/utilities/netcdf_utilities_mod.f90 2017-04-07 15:45:24 UTC (rev 11443)
@@ -49,25 +49,29 @@
!> check return code from previous call. on error, print and stop.
!> if you want to continue after an error don't use this call.
-subroutine nc_check(istatus, subr_name, context)
+subroutine nc_check(istatus, subr_name, context, filename)
integer, intent (in) :: istatus
character(len=*), intent(in) :: subr_name
character(len=*), intent(in), optional :: context
+character(len=*), intent(in), optional :: filename
if (istatus == nf90_noerr) return
! something wrong. construct an error string and call the handler.
+msgstring1 = nf90_strerror(istatus)
! context is optional, but is very useful if specified.
-! if context + error code > 129, the assignment will truncate.
if (present(context)) then
- msgstring1 = trim(context) // ': ' // trim(nf90_strerror(istatus))
-else
- msgstring1 = nf90_strerror(istatus)
+ msgstring1 = trim(context) // ': ' // trim(msgstring1)
endif
+! filename is optional, but is very useful if specified.
+if (present(filename)) then
+ msgstring1 = trim(msgstring1) // ', file "' // trim(filename) // '"'
+endif
+
! this does not return
call error_handler(E_ERR, subr_name, msgstring1, source, revision, revdate)
More information about the Dart-dev
mailing list