anchor.diff:          else
               call check(nf90_get_var(ncid, varid, data_in),trim(filename)//":"//trim(varname))
           endif
  +        data_in = data_in * scale + offset
           ! Close the file, freeing all resources.
           call check( nf90_close(ncid),filename)
   
  
positive.code:         call check(nf90_open(filename, NF90_NOWRITE, ncid),filename)
          ! Get the varid of the data_in variable, based on its name.
          call check(nf90_inq_varid(ncid, varname, varid),trim(filename)//":"//trim(varname))
  
          ! Read the data_in. skip the slowest varying indices if there are more than 3 dimensions (typically this will be time)
          if (diminfo(1)>2) then
  
negative.code:         call check(nf90_open(filename, NF90_NOWRITE, ncid),filename)
          ! Get the varid of the data_in variable, based on its name.
          call check(nf90_inq_varid(ncid, varname, varid),trim(filename)//":"//trim(varname))
          err = nf90_get_att(ncid,varid,'scale_factor', scale)
          if (err/=0) scale=1
          err = nf90_get_att(ncid,varid,'add_offset', offset)
          if (err/=0) offset=0
  
  
          ! Read the data_in. skip the slowest varying indices if there are more than 3 dimensions (typically this will be time)
          if (diminfo(1)>3) then
  