Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/framework/MOM_horizontal_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ subroutine horiz_interp_and_extrap_tracer_record(filename, varnam, conversion,
real, dimension(:), allocatable :: lat_inp, last_row
real :: max_lat, min_lat, pole, max_depth, npole
real :: roundoff ! The magnitude of roundoff, usually ~2e-16.
real :: add_offset, scale_factor
logical :: add_np
character(len=8) :: laynum
type(horiz_interp_type) :: Interp
Expand Down Expand Up @@ -376,6 +377,13 @@ subroutine horiz_interp_and_extrap_tracer_record(filename, varnam, conversion,
if (rcode /= 0) call MOM_error(FATAL,"error finding missing value for "//&
trim(varnam)//" in file "// trim(filename)//" in hinterp_extrap")

rcode = NF90_GET_ATT(ncid, varid, "add_offset", add_offset)
if (rcode /= 0) add_offset = 0.0

rcode = NF90_GET_ATT(ncid, varid, "scale_factor", scale_factor)
if (rcode /= 0) scale_factor = 1.0


if (allocated(lon_in)) deallocate(lon_in)
if (allocated(lat_in)) deallocate(lat_in)
if (allocated(z_in)) deallocate(z_in)
Expand Down Expand Up @@ -499,7 +507,7 @@ subroutine horiz_interp_and_extrap_tracer_record(filename, varnam, conversion,
do i=1,id
if (abs(tr_inp(i,j)-missing_value) > abs(roundoff*missing_value)) then
mask_in(i,j) = 1.0
tr_inp(i,j) = tr_inp(i,j) * conversion
tr_inp(i,j) = (tr_inp(i,j)*scale_factor+add_offset) * conversion
else
tr_inp(i,j) = missing_value
endif
Expand Down