Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#124 closed defect (fixed)

Lack of precison in some netCDF parameters

Reported by: Dave Offiler Owned by: Dave Offiler
Priority: normal Milestone: 1.1
Component: ropp_io Version: 1.0
Keywords: Precision, RoC, Impact Parameter Cc: Michael Rennie, Huw Lewis

Description

Axel reports that RoC and Impact Parameters in the ROPP netCDF files are saved at low-level in single-precsion (SP) despite being double-precison (DP) in the ROPP structures. With typical values of these parameters (64 megametres), this limits precision to no better than 1m (BUFR, at least theoretically, supports 0.1m). This limitation in precision is causing some subtle problems in the interpolation methods of the ROPP thinner where IPs are offset by the RoC.

Axel's recommended solution is to change the type definitions for RoC and IPs from SP to DP in ropp_io_write_ncdf_def.f90. This change is allegedly transparent to the user as the low-level netCDF interface should handle the type conversion on-the-fly for read & write.

He confirms that he can correctly read an old ROPP netCDF file (one with RoC saved in SP) with re-compiled ROPP reader code (with RoC defined in DP).

This change needs to be implemented in our local code and tested more throughly.

Change history (3)

comment:1 by Dave Offiler, 17 years ago

Cc: Huw Lewis added
Resolution: fixed
Status: newclosed

a) Saved Axel's (emailed) version of ropp_io_write_ncdf.def.f90 to my working tree and reviewed the changes - as described.

b) Moved untested changes to ropp_thin_*.f90 aside and replaced with v1.0 versions from repository (hence only target change being cleanly tested).

c) Ran 'make' using ifort (v9/Linux) configuration - no problems reported

d) Ran 'make install' (to $ROPP_ROOT/ifort/...)

Tested thus:

1) Confirm correct read of old SP data:

In ropp_io/data, ran:

$ROPP_ROOT/ifort/bin/ropp2ropp ropp_test.nc -t -o dp.dat

ran 'tkdiff' on dp.dat and existing ropp_test.dat - zero differences. So proving (for this one test file) that (a) the SP file can be read with a DP type and (b) the values for RoC & IP are unchanged in the translation to DP (as expected)

2) Confirm new file is truely outputting DP:

Ran:

$ROPP_ROOT/ifort/bin/ropp2ropp ropp_test.nc -o dp.nc

and did an 'ncdump -h' on ropp_test.nc and dp.nc directed to files, and then 'tkdiff' on them. This confirms that the RoC and IP entries change from type 'float' to type 'double'

3) Confirm loss of precision in old file and retention in new

a) edited dp.dat and changed RoC value in header from 6395730.0 to 6395731.1

b) > ropp2ropp dp.dat -o dp.nc (ie v1.o version of tool)

c) > ncdump -v roc dp.nc --> "roc = 6395731"

So confirming loss of precion from 0.1m to 1m

d) repeat a-c with new build of ropp2ropp: "roc = 6395731.1"

So confirming retention of precision after target change.

These tests strongly suggest that the change has the desired effect with no side-effects. This change now needs formal testing via the Test Folder system to confirm correct working with (a) other test files and (b) other compilers/platforms.

Ticket closed; re-open if full testing reveals any problems.

Code change committed as [1182]

comment:2 by (none), 16 years ago

Milestone: 1.1

Milestone 1.1 deleted

comment:3 by Huw Lewis, 16 years ago

Milestone: 1.1
Note: See TracTickets for help on using tickets.