anchor.diff:          character(len=*), intent(in) :: value_name
           integer :: error
           integer :: test_value
  -        
  +
           ! default return value assumes no error
           error = 0
  -        
  +
           call io_read_attribute(filename, value_name, test_value)
           if (abs(default_value - test_value)>1e-20) then
               error = 1
  
positive.code: 
          call io_getdims(filename,"vLUT",dims)
          do i=1,3
              if (dimensions(i,2)/=dims(i+1)) then
                  dims_match=.False.
                  return
              endif
          enddo
  
      end function dims_match
          
          
  
      function write_var(filename,varname,data_out, dimnames, open_new_file) result(error)
              implicit none
              ! We are writing 6D data, a nx, nz, ny, na, nb, nc grid. 
              integer, parameter :: ndims = 6
              
              ! This is the name of the file and variable we will write. 
              character(len=*), intent(in) :: filename, varname
              real,intent(in) :: data_out(:,:,:,:,:,:)
              character(len=*), optional, dimension(ndims), intent(in) :: dimnames
              logical, optional, intent(in) :: open_new_file
              integer :: error, i
              
              ! This will be the netCDF ID for the file and data variable.
              integer :: ncid, varid,dimids(ndims)
              character(len=MAXVARLENGTH), dimension(ndims) :: dims
              integer :: dim_length
              
              if (present(dimnames)) then
                  dims = dimnames
              else
                  dims = ["x","y","z","a","b","c"]
              endif
              
              ncid=-1
              ! Open the file. NF90_NOCLOBBER tells netCDF we want append to existing files
              if (present(open_new_file)) then
                  if (open_new_file) then
                      call check( nf90_create(filename, NF90_CLOBBER, ncid), filename)
                  endif
              endif
              if (ncid/=-1) then
                  call check( nf90_create(filename, NF90_NOCLOBBER, ncid), "write_var:creating file:"//filename )
              endif
              ! define the dimensions or test that the existing dim matches the size it should
              do i=1,ndims
                  dim_length = size(data_out, i)
                  error = error + (2**i) * setup_dim(ncid, dims(i), dimids(i), dim_length)
              end do
              
              varid = -1
              if (error==0) then
                  error = error + 2**(ndims+1) * setup_var(ncid, varname, varid, dimids, shape(data_out))
              endif
              
              ! End define mode. This tells netCDF we are done defining metadata.
              call check( nf90_enddef(ncid) )
              
              ! write the actual data to the file
              if (varid /= -1) then
                  call check( nf90_put_var(ncid, varid, data_out), trim(filename)//":"//trim(varname))
              endif
              
              ! Close the file, freeing all resources.
              call check( nf90_close(ncid), filename)
              
              ! return error
      end function write_var
  
  
      function setup_var(ncid, varname, varid, dimids, dims) result(error)
          implicit none
          
          integer, intent(in) :: ncid
          character(len=*), intent(in) :: varname
          integer, intent(out) :: varid
          integer, intent(in), dimension(:) :: dimids
          integer, intent(in), dimension(:) :: dims
          integer :: error
          
          integer, dimension(:), allocatable :: var_dimids
          integer :: i, dimlen, ndims, var_exist_error
          
          ndims = size(dimids)
          
          var_exist_error = nf90_inq_varid(ncid, varname, varid)
          ! if the variable doesn't exist, create it
          if (var_exist_error/=NF90_NOERR) then
              call check( nf90_def_var(ncid, varname, NF90_REAL, dimids, varid), "Creating var:"//trim(varname))
          endif
          
          ! ! find the number of dimensions
          ! call check(nf90_inquire_variable(ncid, varid, ndims = ndims),varname)
          allocate(var_dimids(ndims))
          call check(nf90_inquire_variable(ncid, varid, dimids = var_dimids),   trim(varname)//" dims")
          do i=1,ndims
              call check(nf90_inquire_dimension(ncid, var_dimids(i), len = dimlen), "inq "//trim(varname)//" dim:"//trim(str(i)))
  
negative.code:         character(len=*), intent(in) :: value_name
          integer :: error
          real :: test_value
  
          ! default return value assumes no error
          error = 0
  
          call io_read_attribute(filename, value_name, test_value)
          if (abs(default_value - test_value)>1e-20) then
              error = 1
  