[Dart-dev] DART/branches Revision: 12470

dart at ucar.edu dart at ucar.edu
Tue Mar 27 17:02:54 MDT 2018


thoar at ucar.edu
2018-03-27 17:02:54 -0600 (Tue, 27 Mar 2018)
224
write_model_time() is correct, using the nc_open_file_read*()
routines everywhere so the ncid can be used to determine the
filename in nc_check().
added some delimeters to an output statement
in the netcdf_utilities_mod.f90



Modified: DART/branches/cesm_clm/assimilation_code/modules/utilities/netcdf_utilities_mod.f90
===================================================================
--- DART/branches/cesm_clm/assimilation_code/modules/utilities/netcdf_utilities_mod.f90	2018-03-27 21:32:50 UTC (rev 12469)
+++ DART/branches/cesm_clm/assimilation_code/modules/utilities/netcdf_utilities_mod.f90	2018-03-27 23:02:54 UTC (rev 12470)
@@ -209,8 +209,7 @@
 
 ! this does not return 
 call error_handler(E_ERR, subr_name, msgstring1, source, revision, revdate, &
-                   text2=context2, text3=saved_filename)
-  
+                   text2=context2, text3='"'//trim(saved_filename)//'"')
 
 end subroutine nc_check
 

Modified: DART/branches/cesm_clm/models/clm/model_mod.f90
===================================================================
--- DART/branches/cesm_clm/models/clm/model_mod.f90	2018-03-27 21:32:50 UTC (rev 12469)
+++ DART/branches/cesm_clm/models/clm/model_mod.f90	2018-03-27 23:02:54 UTC (rev 12470)
@@ -572,8 +572,7 @@
 
    ! Open the file for each variable and get dimensions, etc.
 
-   call nc_check(nf90_open(trim(progvar(ivar)%origin), NF90_NOWRITE, ncid), &
-              routine,'open '//trim(progvar(ivar)%origin))
+   ncid = nc_open_file_readonly(progvar(ivar)%origin, routine)
 
    ! File is not required to have a time dimension
    io = nf90_inq_dimid(ncid, 'time', TimeDimID)
@@ -662,7 +661,7 @@
    progvar(ivar)%indexN      = index1 + varsize - 1
    index1                    = index1 + varsize      ! sets up for next variable
 
-   call nc_check(nf90_close(ncid),routine,'close '//trim(string2))
+   call nc_close_file(ncid, routine, progvar(ivar)%origin)
    ncid = 0
 
    if (debug > 0 .and. do_output()) call dump_progvar(ivar)
@@ -1461,12 +1460,11 @@
    call error_handler(E_ERR,'read_model_time',string1,source,revision,revdate)
 endif
 
-call nc_check( nf90_open(trim(filename), NF90_NOWRITE, ncid), &
-                  'read_model_time', 'open '//trim(filename))
+ncid = nc_open_file_readonly(filename,'read_model_time')
 
 read_model_time = get_state_time_ncid(ncid)
 
-call nc_check(nf90_close(ncid),'read_model_time', 'close '//trim(filename))
+call nc_close_file(ncid, 'read_model_time', filename)
 
 end function read_model_time
 
@@ -1815,7 +1813,7 @@
 
 deallocate(snlsno)
 
-call nc_close_file(ncid_clm, 'close', clm_restart_filename)
+call nc_close_file(ncid_clm, routine, clm_file)
 
 end subroutine mark_missing_r8_values
 
@@ -2636,10 +2634,7 @@
 
 ! get the ball rolling ...
 
-if (ncid == 0) then ! we need to open it
-   call nc_check(nf90_open(trim(fname), nf90_nowrite, ncid), &
-       routine,'open '//trim(fname))
-endif
+if (ncid == 0) ncid = nc_open_file_readonly(fname, routine)
 
 ! The new SingleColumn (and unstructured grid) configurations
 ! do not have a 'lon' and 'lat' dimension. There is only 'lndgrid'
@@ -2722,7 +2717,7 @@
 endif
 
 if (cstat == 'close') then
-   call nc_check(nf90_close(ncid),routine,'close '//trim(fname) )
+   call nc_close_file(ncid, routine, fname)
    ncid = 0
 endif
 
@@ -2743,10 +2738,7 @@
 ! Make sure the variables are the right size ...
 ! at some point in the future ...
 
-if (ncid == 0) then ! we need to open it
-   call nc_check(nf90_open(trim(fname), nf90_nowrite, ncid), &
-       routine,'open '//trim(fname))
-endif
+if (ncid == 0) ncid = nc_open_file_readonly(fname, routine)
 
 ! The lat/lon matrices in the history file have been masked by
 ! the land values such that the wet cells are 'missing' values.
@@ -2782,7 +2774,7 @@
 where (LAT >  90.0_r8) LAT =  90.0_r8
 
 if (cstat == 'close') then
-   call nc_check(nf90_close(ncid),routine,'close '//trim(fname) )
+   call nc_close_file(ncid, routine, fname)


More information about the Dart-dev mailing list