anchor.diff:      end subroutine io_read3d
   
   
  -    ! Same as io_read3d but assumes we only want a 2d output array
  -    ! also allows selecting an index from any extra dimensions (i.e. a single time slice)
  +    !>------------------------------------------------------------
  +    !! Same as io_read3d but for 2-dimensional data
  +    !!
  +    !! Reads in a variable from a netcdf file, allocating memory in data_in for it.  
  +    !!
  +    !! if extradim is provided specifies this index for any extra dimensions (dims>2)
  +    !!   e.g. we may only want one time slice from a 2d variable
  +    !!
  +    !! @param   filename    Name of NetCDF file to look at
  +    !! @param   varname     Name of the NetCDF variable to read
  +    !! @param[out] data_in     Allocatable 2-dimensional array to store output
  +    !! @param   extradim    OPTIONAL: specify the position to read for any extra (e.g. time) dimension
  +    !! @retval data_in     Allocated 2-dimensional array with the netCDF data
  +    !!
  +    !!------------------------------------------------------------
       subroutine io_read2d(filename,varname,data_in,extradim)
           implicit none
           ! This is the name of the data_in file and variable we will read. 
  
positive.code:         if (present(unit)) unit=io_newunit
      end function io_newunit
      
  end module io_routines
negative.code: !>------------------------------------------------------------
  !!  Basic file input/output routines
  !!  
  !!  @details
  !!  Primary use is io_read2d/3d
  !!  io_write* routines are more used for debugging
  !!  model output is performed in the output module
  !!
  !!  Generic interfaces are supplied for io_read and io_write
  !!  but most code still uses the explicit read/write 2d/3d/etc.
  !!  this keeps the code a little more obvious (at least 2D vs 3D)
  !!
  !!  @author
  !!  Ethan Gutmann (gutmann@ucar.edu)
  !!
  !!------------------------------------------------------------
  module io_routines
      use netcdf
      implicit none
      ! maximum number of dimensions for a netCDF file
      integer,parameter::io_maxDims=10
      
      !>------------------------------------------------------------
      !! Generic interface to the netcdf read routines
      !!------------------------------------------------------------
      interface io_read
          module procedure io_read2d, io_read3d, io_read6d, io_read2di
      end interface
  
      !>------------------------------------------------------------
      !! Generic interface to the netcdf write routines
      !!------------------------------------------------------------
      interface io_write
          module procedure io_write6d, io_write3d, io_write2d, io_write3di
      end interface
  
  !   All routines are public
  contains
  
      !>------------------------------------------------------------
      !! Tests to see if a file exists
      !!
      !! @param filename name of file to look for
      !! @retval logical true if file exists, false if it doesn't
      !!
      !!------------------------------------------------------------
      logical function file_exists(filename)
          character(len=*), intent(in) :: filename
          inquire(file=filename,exist=file_exists)
      end function file_exists
  
      !>------------------------------------------------------------
      !! Tests to see if a variable is present in a netcdf file
      !! returns true of it is, false if it isn't
      !!
      !! @param filename name of NetCDF file
      !! @param variable_name name of variable to search for in filename
      !! @retval logical True if variable_name is present in filename
      !!
      !!------------------------------------------------------------
      logical function io_variable_is_present(filename,variable_name)
          character(len=*), intent(in) :: filename
          character(len=*), intent(in) :: variable_name
  