[Dart-dev] DART/branches Revision: 12330
dart at ucar.edu
dart at ucar.edu
Tue Jan 16 09:44:39 MST 2018
thoar at ucar.edu
2018-01-16 09:44:36 -0700 (Tue, 16 Jan 2018)
129
Chaning the h5_check() routine to die when given a negative error code instead of
assuming an error code of only 0 is a success.
Modified: DART/branches/cesm_clm/assimilation_code/modules/utilities/HDF5_utilities_mod.f90
===================================================================
--- DART/branches/cesm_clm/assimilation_code/modules/utilities/HDF5_utilities_mod.f90 2018-01-12 23:23:26 UTC (rev 12329)
+++ DART/branches/cesm_clm/assimilation_code/modules/utilities/HDF5_utilities_mod.f90 2018-01-16 16:44:36 UTC (rev 12330)
@@ -15,13 +15,16 @@
implicit none
private
-public :: h5_open, H5_CRTDAT, H5_RDWT, h5_get_rank, h5_get_dimensions, &
- h5_get_dset_dspace
+public :: h5_open, H5_CRTDAT, H5_RDWT, &
+ h5_get_rank, &
+ h5_get_dimensions, &
+ h5_get_dset_dspace, &
+ h5_check
-! interface hf_get_var
-! module procedure hf_get_int_1d
-! module procedure hf_get_real_1d
-! end interface
+!interface hf_get_var
+! module procedure hf_get_int_1d
+! module procedure hf_get_real_1d
+!end interface
! version controlled file description for error handling, do not edit
character(len=*), parameter :: source = &
@@ -152,8 +155,8 @@
if (hdferr < 0) &
call h5_check(hdferr, routine, 'h5sget_simple_extent_dims_f', context)
-write(*,*)'TJH actual dimensions ',dims
-write(*,*)'TJH declared dimensions ',declared_dimensions
+! write(*,*)'TJH actual dimensions ',dims
+! write(*,*)'TJH declared dimensions ',declared_dimensions
if (present(maxdims)) maxdims = declared_dimensions
@@ -163,10 +166,11 @@
!------------------------------------------------------------------
!> check return code from previous call. on error, print and stop.
!> if you want to continue after an error don't use this call.
+!> a negative hdferr is considered a failure
-subroutine h5_check(istatus, subr_name, h5routine, context, filename)
+subroutine h5_check(hdferr, subr_name, h5routine, context, filename)
-integer, intent(in) :: istatus
+integer, intent(in) :: hdferr
character(len=*), intent(in) :: subr_name
character(len=*), intent(in) :: h5routine
character(len=*), intent(in), optional :: context
@@ -174,7 +178,7 @@
character(len=512) :: string1, string2, string3
-if (istatus == 0) return
+if (hdferr >= 0) return
! something wrong. construct an error string, print and abort.
@@ -181,9 +185,9 @@
write(string1,*)'HDF5 ERROR from ', trim(h5routine)
if (present(context)) then
- write(string2,*)trim(context),', error code is ',istatus
+ write(string2,*)trim(context),', error code is ',hdferr
else
- write(string2,*)'error code is ',istatus
+ write(string2,*)'error code is ',hdferr
endif
call error_handler(E_ERR, subr_name, string2, &
Modified: DART/branches/cesm_clm/observations/obs_converters/NSIDC/SMAP_L2_to_obs.f90
===================================================================
--- DART/branches/cesm_clm/observations/obs_converters/NSIDC/SMAP_L2_to_obs.f90 2018-01-12 23:23:26 UTC (rev 12329)
+++ DART/branches/cesm_clm/observations/obs_converters/NSIDC/SMAP_L2_to_obs.f90 2018-01-16 16:44:36 UTC (rev 12330)
@@ -59,7 +59,7 @@
use netcdf_utilities_mod, only : nc_get_variable, nc_check
-use HDF5_utilities_mod, only : h5_open, &
+use HDF5_utilities_mod, only : h5_open, h5_check, &
h5_get_rank, &
h5_get_dimensions, &
h5_get_dset_dspace
@@ -191,40 +191,20 @@
allocate(dims(ndims), maxdims(ndims))
-call h5sget_simple_extent_dims_f(dspace_id, dims, maxdims, hdferr)
-write(*,*)'TJH org: dims is ',dims
-
call h5_get_dimensions(dspace_id, dims, context=string1)
-
-
-
allocate(data_hdf5(dims(1)))
More information about the Dart-dev
mailing list