[Dart-dev] DART/branches Revision: 11444
dart at ucar.edu
dart at ucar.edu
Fri Apr 7 09:46:17 MDT 2017
nancy at ucar.edu
2017-04-07 09:46:17 -0600 (Fri, 07 Apr 2017)
228
remove the private checkit() routine and call the standard system
nc_check() routine. it now takes 2 optional strings - a context
which we generally set to the subroutine name, and a filename
if we have it in the calling code.
Modified: DART/branches/model_mod_changes/assimilation_code/location/utilities/location_io_mod.f90
===================================================================
--- DART/branches/model_mod_changes/assimilation_code/location/utilities/location_io_mod.f90 2017-04-07 15:45:24 UTC (rev 11443)
+++ DART/branches/model_mod_changes/assimilation_code/location/utilities/location_io_mod.f90 2017-04-07 15:46:17 UTC (rev 11444)
@@ -74,15 +74,16 @@
integer :: LocDimID, LDimID, VarID
integer :: rc
+character(len=32) :: context = 'nc_write_location_atts'
! define the rank/dimension of the location information
rc = nf90_def_dim(ncid=ncFileID, name='location', len=dimlen, dimid=LocDimID)
-call checkit(rc, 'nc_write_location_atts', 'def_dim:location', fname)
+call nc_check(rc, context, 'def_dim:location', fname)
if (LocationDims > 1) then
rc = nf90_def_dim(ncid=ncFileID, name='locdim', len=LocationDims, dimid=LDimID)
- call checkit(rc, 'nc_write_location_atts', 'def_dim:locdim', fname)
+ call nc_check(rc, context, 'def_dim:locdim', fname)
endif
! Define the location variable and attributes
@@ -89,68 +90,79 @@
if (LocationDims > 1) then
if (present(use_dimID)) then
- call nc_check(nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
- dimids=(/ LDimID, use_dimID /), varid=VarID), &
- 'nc_write_location_atts', 'location:def_var')
+ rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
+ dimids=(/ LDimID, use_dimID /), varid=VarID)
+ call nc_check(rc, context, 'def_var1:location', fname)
else
- call nc_check(nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
- dimids=(/ LDimID, LocDimID /), varid=VarID), &
- 'nc_write_location_atts', 'location:def_var')
+ rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
+ dimids=(/ LDimID, LocDimID /), varid=VarID)
+ call nc_check(rc, context, 'def_var2:location', fname)
endif
else
if (present(use_dimID)) then
- call nc_check(nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
- dimids=(/ use_dimID /), varid=VarID), &
- 'nc_write_location_atts', 'location:def_var')
+ rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
+ dimids=(/ use_dimID /), varid=VarID)
+ call nc_check(rc, context, 'def_var3:location', fname)
else
- call nc_check(nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
- dimids=(/ LocDimID /), varid=VarID), &
- 'nc_write_location_atts', 'location:def_var')
+ rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
+ dimids=(/ LocDimID /), varid=VarID)
+ call nc_check(rc, context, 'def_var4:location', fname)
endif
endif
-call nc_check(nf90_put_att(ncFileID, VarID, 'description', 'location coordinates'), &
- 'nc_write_location_atts', 'location:description')
-call nc_check(nf90_put_att(ncFileID, VarID, 'location_type', trim(LocationName)), &
- 'nc_write_location_atts', 'location:location_type')
-call nc_check(nf90_put_att(ncFileID, VarID, 'long_name', trim(LocationLName)), &
- 'nc_write_location_atts', 'location:long_name')
-call nc_check(nf90_put_att(ncFileID, VarID, 'storage_order', trim(LocationStorageOrder)), &
- 'nc_write_location_atts', 'location:storage_order')
-call nc_check(nf90_put_att(ncFileID, VarID, 'units', trim(LocationUnits)), &
- 'nc_write_location_atts', 'location:units')
+rc = nf90_put_att(ncFileID, VarID, 'description', 'location coordinates')
+call nc_check(rc, context, 'put_att:description', fname)
+rc = nf90_put_att(ncFileID, VarID, 'location_type', trim(LocationName))
+call nc_check(rc, context, 'put_att:location_type', fname)
+
+rc = nf90_put_att(ncFileID, VarID, 'long_name', trim(LocationLName))
+call nc_check(rc, context, 'put_att:long_name', fname)
+
+rc = nf90_put_att(ncFileID, VarID, 'storage_order', trim(LocationStorageOrder))
+call nc_check(rc, context, 'put_att:storage_order', fname)
+
+rc = nf90_put_att(ncFileID, VarID, 'units', trim(LocationUnits))
+call nc_check(rc, context, 'put_att:units', fname)
+
end subroutine nc_write_location_atts
!----------------------------------------------------------------------------
!> Define the ancillary vertical array and attributes
-subroutine nc_write_location_vert( ncFileID, fname )
+subroutine nc_write_location_vert(ncFileID, fname)
-integer, intent(in) :: ncFileID ! handle to the netcdf file
-character(len=*), intent(in) :: fname ! file name (for printing purposes)
+integer, intent(in) :: ncFileID ! handle to the netcdf file
+character(len=*), optional, intent(in) :: fname ! file name (for printing purposes)
-integer :: VarID
+integer :: VarID, rc
+character(len=32) :: context = 'nc_write_location_vert'
More information about the Dart-dev
mailing list