[Dart-dev] DART/branches Revision: 12225

dart at ucar.edu dart at ucar.edu
Tue Dec 19 15:41:53 MST 2017


nancy at ucar.edu
2017-12-19 15:41:52 -0700 (Tue, 19 Dec 2017)
150
make sure a filename is present before trying to return it;
get the direction of from and to right; don't pass in an ncid
if it hasn't been set yet.




Modified: DART/branches/recam/assimilation_code/modules/utilities/netcdf_utilities_mod.f90
===================================================================
--- DART/branches/recam/assimilation_code/modules/utilities/netcdf_utilities_mod.f90	2017-12-19 22:14:55 UTC (rev 12224)
+++ DART/branches/recam/assimilation_code/modules/utilities/netcdf_utilities_mod.f90	2017-12-19 22:41:52 UTC (rev 12225)
@@ -180,8 +180,10 @@
 ! to extract the filename from it.
 if (.not. present(filename) .and. present(ncid)) then
    call find_name_from_fh(ncid, saved_filename)
+else if (present(filename)) then
+   saved_filename = filename
 else
-   saved_filename = filename
+   saved_filename = ''
 endif
 
 ! this does not return 
@@ -1202,7 +1204,6 @@
 integer :: ret, ncid
 
 ret = nf90_open(filename, NF90_NOWRITE, ncid)
-
 call nc_check(ret, routine, 'open '//trim(filename)//' read only', context)
 
 call add_fh_to_list(ncid, filename)
@@ -1221,14 +1222,12 @@
 character(len=*), intent(in), optional :: context
 integer                       :: nc_open_file_readwrite
 
-character(len=*), parameter :: routine = 'nc_open_file_readwrite'
 integer :: ret, ncid, oldmode
 
 ret = nf90_open(filename, NF90_WRITE, ncid)
-
 call nc_check(ret, routine, 'open '//trim(filename)//' read/write', context)
 
-call add_fh_from_list(ncid, filename)
+call add_fh_to_list(ncid, filename)
 nc_open_file_readwrite = ncid
 
 ! faster if we don't fill the vars first with 'fill' value.
@@ -1254,10 +1253,9 @@
 integer :: ret, ncid, oldmode
 
 ret = nf90_create(filename, NF90_CLOBBER, ncid)
-
 call nc_check(ret, routine, 'create '//trim(filename)//' read/write', context)
 
-call add_fh_from_list(ncid, filename)
+call add_fh_to_list(ncid, filename)
 nc_create_file = ncid
 
 ! faster if we don't fill the vars first with 'fill' value.
@@ -1282,7 +1280,7 @@
 ret = nf90_close(ncid)
 call nc_check(ret, routine, 'close file', context, filename, ncid)
 
-call del_fh_to_list(ncid, filename)
+call del_fh_from_list(ncid)
 
 end subroutine nc_close_file
 
@@ -1330,7 +1328,7 @@
 integer :: ret
 
 ret = nf90_sync(ncid)
-call nc_check(ret, routine, 'file sync', context, filename, ncid)
+call nc_check(ret, routine, 'synchronize file contents', context, filename, ncid)
 
 end subroutine nc_synchronize_file
 


More information about the Dart-dev mailing list