anchor.diff:              (/ nc_grid_output%dim_time_id /), nc_grid_output%var_time_id), __LINE__ )
   
           ! Stage
  -        call check( nf90_def_var(iNcid, "stage", output_prec, &
  -            [nc_grid_output%dim_x_id, nc_grid_output%dim_y_id, nc_grid_output%dim_time_id], &
  -            nc_grid_output%var_stage_id), __LINE__ )
  -        ! Compress
  -        if(using_netcdf4) call check(nf90_def_var_deflate(iNcid, nc_grid_output%var_stage_id, 1, 1, 3), __LINE__)
  +        if(nc_grid_output%time_var_store_flag(STG)) then
  +            call check( nf90_def_var(iNcid, "stage", output_prec, &
  +                [nc_grid_output%dim_x_id, nc_grid_output%dim_y_id, nc_grid_output%dim_time_id], &
  +                nc_grid_output%var_stage_id), __LINE__ )
  +            ! Compress
  +            if(using_netcdf4) call check(nf90_def_var_deflate(iNcid, nc_grid_output%var_stage_id, 1, 1, 3), __LINE__)
  +        end if
           ! UH
  -        call check( nf90_def_var(iNcid, "uh", output_prec, &
  -            [nc_grid_output%dim_x_id, nc_grid_output%dim_y_id, nc_grid_output%dim_time_id], &
  -            nc_grid_output%var_uh_id), __LINE__ )
  -        ! Compress
  -        if(using_netcdf4) call check(nf90_def_var_deflate(iNcid, nc_grid_output%var_uh_id, 1, 1, 3), __LINE__)
  -
  +        if(nc_grid_output%time_var_store_flag(UH)) then
  +            call check( nf90_def_var(iNcid, "uh", output_prec, &
  +                [nc_grid_output%dim_x_id, nc_grid_output%dim_y_id, nc_grid_output%dim_time_id], &
  +                nc_grid_output%var_uh_id), __LINE__ )
  +            ! Compress
  +            if(using_netcdf4) call check(nf90_def_var_deflate(iNcid, nc_grid_output%var_uh_id, 1, 1, 3), __LINE__)
  +        end if
           ! VH
  -        call check( nf90_def_var(iNcid, "vh", output_prec, &
  -            [nc_grid_output%dim_x_id, nc_grid_output%dim_y_id, nc_grid_output%dim_time_id], &
  -            nc_grid_output%var_vh_id), __LINE__ )
  -        ! Compress
  -        if(using_netcdf4) call check(nf90_def_var_deflate(iNcid, nc_grid_output%var_vh_id, 1, 1, 3), __LINE__)
  -
  +        if(nc_grid_output%time_var_store_flag(VH)) then
  +            call check( nf90_def_var(iNcid, "vh", output_prec, &
  +                [nc_grid_output%dim_x_id, nc_grid_output%dim_y_id, nc_grid_output%dim_time_id], &
  +                nc_grid_output%var_vh_id), __LINE__ )
  +            ! Compress
  +            if(using_netcdf4) call check(nf90_def_var_deflate(iNcid, nc_grid_output%var_vh_id, 1, 1, 3), __LINE__)
  +        end if
           ! Elev
  -        call check( nf90_def_var(iNcid, "elev", output_prec, &
  -            [nc_grid_output%dim_x_id, nc_grid_output%dim_y_id, nc_grid_output%dim_time_id], &
  -            nc_grid_output%var_elev_id), __LINE__ )
  -        ! Compress
  -        if(using_netcdf4) call check(nf90_def_var_deflate(iNcid, nc_grid_output%var_elev_id, 1, 1, 3), __LINE__)
  +        if(nc_grid_output%time_var_store_flag(ELV)) then
  +            call check( nf90_def_var(iNcid, "elev", output_prec, &
  +                [nc_grid_output%dim_x_id, nc_grid_output%dim_y_id, nc_grid_output%dim_time_id], &
  +                nc_grid_output%var_elev_id), __LINE__ )
  +            ! Compress
  +            if(using_netcdf4) call check(nf90_def_var_deflate(iNcid, nc_grid_output%var_elev_id, 1, 1, 3), __LINE__)
  +        end if
   
           ! priority_domain -- Use 1 if the current domain is the priority domain, and zero otherwise
           call check(nf90_def_var(iNcid, "is_priority_domain", output_byte, &
  
positive.code: 
          ! Flag for whether we store max stage, etc
          logical :: record_max_U
  
          ! Allow only storing every n'th point in x/y space.
          ! For instance, on a 1-arc-minute model, a value of 4 would
  
negative.code: 
      !
      ! Store a 1 byte integer, denoting the cells in the current domain that are 
      ! priority_domain cells. Also store regular integer grids with the priority domain index
      ! and image.
      !
      subroutine store_priority_domain_cells(nc_grid_output, priority_domain_index, &
          priority_domain_image, my_index, my_image)
  