subroutine get_v2d_netcdf_R4(filename, name, array, Xdim, Ydim, rc)
use netcdf
implicit none
character(len=*), intent(in) :: name, filename
integer, intent(in) :: Xdim, Ydim
real, dimension(Xdim,Ydim), intent(out) :: array
integer, optional, intent(out) :: rc
integer :: status
integer :: ncid, varid
real :: scale_factor, add_offset
integer :: iret
call check_nc_status(nf90_open(trim(fileName), NF90_NOWRITE, ncid), _RC)
call check_nc_status(nf90_inq_varid(ncid, name, varid), _RC)
call check_nc_status(nf90_get_var(ncid, varid, array), _RC)
iret = nf90_get_att(ncid, varid, 'scale_factor', scale_factor)
if(iret .eq. 0) array = array * scale_factor
!
iret = nf90_get_att(ncid, varid, 'add_offset', add_offset)
if(iret .eq. 0) array = array + add_offset
!
call check_nc_status(nf90_close(ncid), _RC)
_RETURN(_SUCCESS)
end subroutine get_v2d_netcdf_R4