[Dart-dev] DART/branches Revision: 10908

dart at ucar.edu dart at ucar.edu
Tue Jan 17 15:36:13 MST 2017


hendric at ucar.edu
2017-01-17 15:36:13 -0700 (Tue, 17 Jan 2017)
149
reading a single file in for lorenz_96. very model
specific but appears to be bitwise with the trunk.

only works with a single task at the moment.




Modified: DART/branches/rma_single_file/io/io_filenames_mod.f90
===================================================================
--- DART/branches/rma_single_file/io/io_filenames_mod.f90	2017-01-17 22:33:50 UTC (rev 10907)
+++ DART/branches/rma_single_file/io/io_filenames_mod.f90	2017-01-17 22:36:13 UTC (rev 10908)
@@ -303,7 +303,8 @@
 integer :: nlines, icopy, iunit, ios, idom
 integer :: offset
 
-if (my_copy_start <= 0) return
+if (my_copy_start <= 0)    return
+if (file_info%single_file) return
 
 offset = my_copy_start - 1
 

Modified: DART/branches/rma_single_file/io/state_vector_io_mod.f90
===================================================================
--- DART/branches/rma_single_file/io/state_vector_io_mod.f90	2017-01-17 22:33:50 UTC (rev 10907)
+++ DART/branches/rma_single_file/io/state_vector_io_mod.f90	2017-01-17 22:36:13 UTC (rev 10908)
@@ -186,6 +186,12 @@
 
 logical :: inflation_handles = .false.
 
+! NetCDF IO variables
+integer :: ncid, varid, ret, icopy, ivar, istart, iend
+integer :: ens_size = 20
+character(len=256) :: fname
+real(r8) :: var_block(40) !>todo remove hard-coded
+
 if ( .not. module_initialized ) call state_vector_io_init() ! to read the namelist
 
 ! check whether file_info handle is initialized
@@ -222,8 +228,32 @@
 endif
 
 if (get_single_file(file_info)) then
-   call error_handler(E_ERR,'read_state:', &
+   call error_handler(E_MSG,'read_state:', &
       'Writing single file restarts is in progress')
+   ! call read_single_file(state_ens_handle, file_info, read_time_from_file, time)
+   fname = 'filter_input.nc'
+
+   ret = nf90_open(fname, NF90_NOWRITE, ncid)
+   call nc_check(ret, 'read_transpose_single_task: nf90_open', fname)
+
+   ret = nf90_inq_varid(ncid, 'state', varid)
+   call nc_check(ret, 'read_transpose_single_task: nf90_inq_varid', fname)
+
+   do icopy = 1, ens_size
+      ret = nf90_get_var(ncid, varid, var_block, start=(/1,icopy,1/))
+      call nc_check(ret, 'read_transpose_single_task: nf90_get_var', fname)
+      istart = 1
+      iend   = 40
+      state_ens_handle%copies(icopy, istart:iend) = var_block
+      write(*,*) 'var_block : '
+      do ivar = 1, 40
+         write(*,*) var_block(ivar)
+      enddo
+   enddo
+   
+   ret = nf90_close(ncid)
+   call nc_check(ret, 'read_transpose_single_task: nf90_close', fname)
+   ! call exit(0) 
 else
    call read_restart_direct(state_ens_handle, file_info, read_time_from_file, time)
 endif


More information about the Dart-dev mailing list