[Dart-dev] DART/branches Revision: 10732

dart at ucar.edu dart at ucar.edu
Mon Nov 7 14:38:42 MST 2016


hendric at ucar.edu
2016-11-07 14:38:41 -0700 (Mon, 07 Nov 2016)
216
using default restart file names if no input and/or
output restart file list is provided.

  input_filter_restart[_d0X].nc
  output_filter_restart[_d0X].nc
  input_pmo_restart[_d0X].nc
  output_pmo_restart[_d0X].nc




Modified: DART/branches/rma_fixed_filenames/io/io_filenames_mod.f90
===================================================================
--- DART/branches/rma_fixed_filenames/io/io_filenames_mod.f90	2016-11-07 18:59:17 UTC (rev 10731)
+++ DART/branches/rma_fixed_filenames/io/io_filenames_mod.f90	2016-11-07 21:38:41 UTC (rev 10732)
@@ -42,6 +42,7 @@
 use types_mod,            only : r4, r8, MISSING_R8
 use utilities_mod,        only : file_exist, E_ERR, E_MSG, error_handler, &
                                  nc_check, open_file, find_textfile_dims
+use mpi_utilities_mod,    only : my_task_id
 use state_structure_mod,  only : get_num_domains, get_dim_length, get_dim_name, &
                                  get_io_num_dims, get_num_variables, get_variable_name, &
                                  get_units, get_long_name, get_short_name, get_missing_value, &
@@ -290,12 +291,13 @@
       ! fixed filenames for perfect model obs. 
       !      restart_in_file  = input_perfect_restart
       !      restart_out_file = output_perfect_restart
+      if(my_task_id()==0) print*, "PERFECT MODEL RUN"
       file_info%restart_files_in%filenames(icopy, idom)  = construct_file_name_in( file_info, icopy, idom)
       file_info%restart_files_out%filenames(icopy, idom) = construct_file_name_out(file_info, icopy, idom)
    else
-      ! Read filenames from {input,output}_restart_file_list in &filter_nml
-      call read_file_lists(file_info, ens_size, idom, 'input_restarts')
-      call read_file_lists(file_info, ens_size, idom, 'output_restarts')
+      if(my_task_id()==0) print*, "READING LISTS FROM FILE"
+      call construct_restart_file_list(file_info, ens_size, idom, 'input_restarts')
+      call construct_restart_file_list(file_info, ens_size, idom, 'output_restarts')
    endif
 
    ! Construct the output files:
@@ -450,7 +452,7 @@
 
 !-------------------------------------------------------
 !> read file list names
-subroutine read_file_lists(file_info, ens_size, idom, list_type)
+subroutine construct_restart_file_list(file_info, ens_size, idom, list_type)
 type(file_info_type), intent(inout) :: file_info
 integer,              intent(in) :: ens_size 
 integer,              intent(in) :: idom 
@@ -460,6 +462,13 @@
 character(len=32) :: read_write
 integer :: nlines, icopy, iunit, ios
 
+if(trim(list_type) /= trim('input_restarts') .and. trim(list_type) /= trim('output_restarts')) then
+   write(msgstring,*) 'list_type must be either "input_restarts" or "output_restarts"', &
+                      'you have ', trim(list_type)
+   call error_handler(E_ERR,'construct_restart_file_list', msgstring, &
+                      source, revision, revdate)
+endif
+
 if (trim(list_type) == trim('input_restarts')) then
    allocate(restart_list(size(file_info%options%input_restart_list)))
    restart_list = file_info%options%input_restart_list
@@ -468,43 +477,49 @@
    allocate(restart_list(size(file_info%options%output_restart_list)))
    restart_list = file_info%options%output_restart_list
    read_write = "writing restarts to  : "
-else
-   write(msgstring,*) 'list_type must be either "input_restarts" or "output_restarts"', &
-                      'you have ', trim(list_type)
-   call error_handler(E_ERR,'read_file_lists', msgstring, &
-                      source, revision, revdate)
 endif
 
-write(msgstring,*) read_write, trim(restart_list(idom))
-call error_handler(E_MSG,'read_file_lists', &
-                   msgstring, source, revision, revdate)
 
-!>@todo FIXME JPH: need to check if {input,ouput}_restart files exist then can use default names
-!> for filter
+
+! No restart list provided. Using default filter, pmo names
+!  input_filter_restart[_d0X].nc
+!  output_filter_restart[_d0X].nc
+!  input_pmo_restart[_d0X].nc
+!  output_pmo_restart[_d0X].nc
+if (trim(restart_list(idom)) == trim('null')) then
+  write(msgstring,*) 'NO restart_file_list provided using default names'
+  call error_handler(E_MSG,'construct_restart_file_list', &
+                     msgstring, source, revision, revdate)
+   do icopy = 1, ens_size
+      if (list_type == 'input_restarts') then
+         file_info%restart_files_in%filenames(icopy, idom) = construct_file_name_in(file_info, icopy, idom)
+      else
+         file_info%restart_files_out%filenames(icopy, idom) = construct_file_name_out(file_info, icopy, idom)
+      endif
+   enddo
+   return
+endif 
+
+! read files from restart file list
 if ( .not. file_exist(restart_list(idom)) ) then
    msgstring = 'io_filenames_mod:'//trim(restart_list(idom))//&
                ' not found'
-   call error_handler(E_ERR,'read_file_lists', msgstring, &
+   call error_handler(E_ERR,'construct_restart_file_list', msgstring, &
                       source, revision, revdate)
 
-   !>@todo FIXME Should we have a default file list if no restart_list is provided?
-   ! do icopy = 1, ens_size
-   !    if (list_type == 'input_restarts') then
-   !       file_info%restart_files_in%filenames(icopy, idom) = construct_file_name_in(file_info, icopy, idom)
-   !    else
-   !       file_info%restart_files_out%filenames(icopy, idom) = construct_file_name_out(file_info, icopy, idom)
-   !    endif
-   ! enddo
-   ! return
 endif
 
+write(msgstring,*) read_write, trim(restart_list(idom))
+call error_handler(E_MSG,'construct_restart_file_list', &
+                   msgstring, source, revision, revdate)
+
 ! Check the dimensions of the pointer file
 call find_textfile_dims(trim(restart_list(idom)), nlines)
 if( nlines < ens_size) then
    write(msgstring,*) 'io_filenames_mod: expecting ',ens_size, &
                       'files in ', trim(restart_list(idom)),  &
                       'and only found ', nlines
-   call error_handler(E_ERR,'read_file_lists', msgstring, &
+   call error_handler(E_ERR,'construct_restart_file_list', msgstring, &
                       source, revision, revdate)
 endif 
 
@@ -519,7 +534,7 @@
    endif
 enddo
 
-end subroutine read_file_lists
+end subroutine construct_restart_file_list
 
 !-------------------------------------------------------
 !> Write output file name and description

Modified: DART/branches/rma_fixed_filenames/io/state_vector_io_mod.f90
===================================================================
--- DART/branches/rma_fixed_filenames/io/state_vector_io_mod.f90	2016-11-07 18:59:17 UTC (rev 10731)
+++ DART/branches/rma_fixed_filenames/io/state_vector_io_mod.f90	2016-11-07 21:38:41 UTC (rev 10732)
@@ -134,7 +134,6 @@
 logical :: io_output_output    = .true.
 
 ! Global variables for which copies to write
-logical :: io_output_inflation = .false.
 logical :: io_output_restarts  = .true.
 logical :: io_output_mean      = .false.
 logical :: io_output_sd        = .false.
@@ -673,7 +672,6 @@
 enddo
 
 ! copies to write
-io_output_inflation = output_inflation
 io_output_restarts  = output_restarts
 io_output_mean      = output_mean
 io_output_sd        = output_sd
@@ -683,7 +681,6 @@
    write(*,*) 'io_output_preassim  ', io_output_preassim
    write(*,*) 'io_output_postassim ', io_output_postassim
    write(*,*) 'io_output_output    ', io_output_output
-   write(*,*) 'io_output_inflation ', io_output_inflation
    write(*,*) 'io_output_restarts  ', io_output_restarts 
    write(*,*) 'io_output_mean      ', io_output_mean     
    write(*,*) 'io_output_sd        ', io_output_sd       


More information about the Dart-dev mailing list