[Thread Prev][Thread Next][Index]

Re: [ferret_users] precision problem on a difference between a same variable read from 2 files with the same structure



Hi,

Thank you Ansley for taking into account this report bug.

This is a quite annoying problem when you want to make comparisons.
When all file structures are the same and files are the sames too but you still
get differences, that is embarrassing.
Also I would put it at a very high priority if you mind.

Here is the simplest test script I can achieve:

$ more s1.cdl
netcdf f1 {
dimensions:
        lat = 1;
        lon = 1;
        nvert = 2 ;
        lev = 6 ;
variables:
        double lon(lon) ;
        double bounds_lon(lon, nvert) ;
        double lat(lat) ;
        double bounds_lat(lat, nvert) ;
        double lev(lev) ;
                lev:axis = "Z" ;
        double q(lev) ;
data:
 lon = 35 ;
 bounds_lon = 33, 37;
 lat = 87 ;
 bounds_lat = 85, 89;
 lev = 1000, 900, 800, 700, 600, 500;
 q = 1, 2, 3, 4, 5, 6;
}

$ ncgen -o s1.nc s1.cdl ; ncgen -o s2.nc s1.cdl

$ ferret -script bug1.jnl
use s1.nc
*** NOTE: Axis coordinates are decreasing-ordered. Reversing ordering for axis lev
use s2.nc
*** NOTE: Axis coordinates are decreasing-ordered. Reversing ordering for axis lev

list q[k=1,d=2]-q[k=1,d=1]
VARIABLE : Q[K=1,D=s2]-Q[K=1,D=s1]
Z : 500
-5.000

list q[k=6,d=2]-q[k=1,d=1]
VARIABLE : Q[K=6,D=s2]-Q[K=1,D=s1]
Z : 1000
0.0000

---> the first difference should be 0 since the 2 input files are strictly the same.
---> this bug occurs when there is an axis coordinates with a decreasing-order
and also presence of boundaries on X and Y (don't know why this last is related).

Best regards
Patrick

--
Data Analysis and Visualization Engineer / Project Manager
LSCE/IPSL, CEA-CNRS-UVSQ laboratory
LSCE - Climate and Environment Sciences Laboratory
IPSL - Institut Pierre Simon Laplace
--



De: "Ansley C. Manke" <ansley.b.manke@xxxxxxxx>
À: "ferret users" <ferret_users@xxxxxxxx>
Envoyé: Samedi 15 Juin 2019 02:07:14
Objet: Re: [ferret_users] precision problem on a difference between a same variable read from 2 files with the same structure



Hi Patrick, Yes, when the second file having the same name as an axis already in use by another file in the session, Ferret checks whether the axes are the same and if so, uses it in both grids.  I think you must be correct that this is the cause of the difference you're seeing. I think you are correct that this also has to do with the reversing of the axis coordinates and that for some reason this is done differently in the two cases. I'll look further into this.  Thank you for sending a detailed example. Ansley


On 6/14/2019 12:31 PM, Patrick Brockmann wrote:
Hi ferreters,

I encountered a problem when I compare a variable
read from 2 different files with exactly the same structure (same axis in particular).

The difference calculated with ferret has the following range: 
   Minimum value: -2.1516798E-11
   Maximum value: 2.15167981E-11
but the difference calculated with ncdiff has  the following range: 
   Minimum value: -2.79521E-20
   Maximum value: 2.87991E-20

--> I was expecting the same order of magnitude with ferret than with ncdiff.

More strange, if I change the name of a coordinate axis of one of the input file
then the difference calculated with ferret and ncdiff have the same order
of magnitude.

--> I suspect that the variable read from the 2nd file uses a downward axis
set from the read of the 1st file.

Attached the minimized problem with 3 small nc files and 2 test scripts.

Please try:
$ ferret -script test1.jnl
$ ferret -script test2.jnl

Tested with ferret 7.44 and 7.50
Any help welcome.

Regards
Patrick

--
Data Analysis and Visualization Engineer / Project Manager
LSCE/IPSL, CEA-CNRS-UVSQ laboratory
LSCE - Climate and Environment Sciences Laboratory
IPSL - Institut Pierre Simon Laplace
--
--
Ansley Manke
NOAA/PMEL Science Data Integration Group
7600 Sand Point Way NE
206-526-6246

Attachment: bug1.jnl
Description: Binary data

Attachment: s1.cdl
Description: Binary data


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement