For example I have a netCDF file with ubar data on the western boundary as follows:
Code: Select all
netcdf roms_bry {
dimensions:
xi_u = 79 ;
eta_u = 89 ;
time_fix = 1 ;
variables:
float time_fix(time_fix) ;
short ubar_west(time_fix, eta_u) ;
ubar_west:time = "time_fix" ;
ubar_west:add_offset = -0.000152594875864068 ;
ubar_west:scale_factor = 0.000305189751728137 ;
// global attributes:
:type = "Boundary forcing file" ;
data:
ubar_west =
20, 11, -14, -55, -20, 43, -3, -122, -64, 254, 442, 301, 176, 182, 260,
299, 257, 200, 139, 82, 22, -10, 6, 34, 50, 41, 40, 42, 37, 24, 5, -13,
-24, -24, -18, -9, -1, 4, 10, 15, 16, 11, 1, -6, -6, 1, 5, 6, 5, 3, 3,
2, 4, 6, 7, 6, 2, -1, -1, 1, 3, 5, 2, -3, -6, 1, 6, 8, 7, 5, 3, 1, 3,
8, 13, 18, 19, 18, 14, 12, 12, 8, 6, 12, 20, 17, -3, -27, -38 ;
}
This file is being read by GET_NGFLD, which reports
Code: Select all
GET_NGFLD - 2D u-momentum western boundary condition, t = 0 00:00:00
(Rec=0001, Index=2, File: roms_bry.nc)
(Tmin= 0.0000 Tmax= 0.0000)
(Min = -1.14097461E-05 Max = 4.11216564E-05)
With a bit of debugging in get_ngfld.F, I see the data in question are being read from the netCDF file at lines 400-404 by function NETCDF_GET_FVAR, then the minimum and maximum values are calculated at lines 410-421 and written to stdout at lines 432-434. The scale_factor attribute was previously read from the file (line 147) and stored in Finfo(10,ifield,ng). This scale factor is applied in the calculation of the minimum and maximum at lines 410-421, but the data returned by NETCDF_GET_FVAR have already been scaled inside that function and are between -0.0374 and 0.1347, so the extra scaling causes the numbers to be much too small.
I'm not 100% sure but I think the scale factor in Finfo(10,ifield,ng) is also passed out of GET_NGFLD and used to scale the values used in the hydrodynamic simulation, leading to unrealistic results.
I think the same problem applies to point data processed by GET_2DFLD, see lines 448-456 in get_2dfld.F.