NETCDF_CHECK_VAR too strict?

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

NETCDF_CHECK_VAR too strict?

#1 Unread post by m.hadfield »

I've run into a problem--not to difficult to work around I hope, with the NETCDF_CHECK_VAR subroutine introduce in the recent coordinate transformation overhaul

viewtopic.php?t=1233

My run stops with the message

Code: Select all

 NETCDF_CHECK_VAR - inconsistent value of variable: theta_b    2.000000E-01  2.000000E-01
                    in file: roms_ini.nc
It's complaining that theta_b set in the model run (2.000000E-01) does not equal theta_b read from the initial-fields file (2.000000E-01). They look pretty similar to me!

I think it's just a precision mismatch: I generated the initial-conditions file with a script that stored theta_b as a netCDF FLOAT value, while theta_b in the model run is double-precision. So I'm regenerating the initial-conditions file with all its vertical coordinate data in DOUBLE precision. We'll see if that works.

However, perhaps NETCDF_CHECK_VAR should check for equality within some small tolerance?

PS: the checks performed in NETCDF_CHECK_VAR are a good idea. Some years ago I used an initial-conditions file with vertical-grid parameters that didn't match the model run. This lead to very weird results.

User avatar
arango
Site Admin
Posts: 1356
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: NETCDF_CHECK_VAR too strict?

#2 Unread post by arango »

Yes, I was able to reproduce the problem. Thank you. As you suspected it is due to round-off. I corrected this problem by checking the absolute of the difference whitin ad round-off value. See the following :arrow: track ticket.

Post Reply