xml export of gmfs - significant digits

26 views
Skip to first unread message

Clotaire Michel

unread,
Aug 20, 2015, 5:26:43 AM8/20/15
to OpenQuake Users
Dear developers,
there have recently been a change in the number of significant digits in the xml export of ground motion fields: the latitude was in the past exported using 6 significant digits (5 for the longitude), but recently it changed to 5 which is not enough. Could you please change back to the original values?
thanks a lot

Michele Simionato

unread,
Aug 22, 2015, 4:21:50 AM8/22/15
to OpenQuake Users
No, the change was made because we discovered that the 6 digits were not significant. In other words, two sites which were different at the 6-th digit level were sometimes considered equal internally (by PostGIS) and the computation failed due to an UNIQUE constraint on the locations. So there is no turning back. Notice that 5 digits are enough to specify a location with a precision better than 1 meter. The 6-th digit would make a difference of the order of centimeters, which would not make sense, considering that the are several error factors in the determination of locations on the Earth surface.

Clotaire Michel

unread,
Aug 24, 2015, 4:28:23 AM8/24/15
to OpenQuake Users
Dear Michele,
I think you are mixing significant digits and precision: for our latitudes (47...) 5 significant digits means a precision of 0.001 that corresponds to about 100m (too low). To be fair, concerning longitude, 5 significant digits for longitudes above 100° would even be a precision of 1km. So, if you think in terms of significant digits, you would need 7 on longitude and 6 on attitude to reach a 10m precision which is probably enough for our purposes. I am surprised that you had problems with PostGIS because I used it in the past with even higher precision without any problem.
Of course the best way would be to think in terms of precision, where 1e-4 is the minimum we need.
In any case, 5 significant digits cannot be used for building by building applications, at least in Europe.

Michele Simionato

unread,
Aug 24, 2015, 4:51:56 AM8/24/15
to OpenQuake Users
I think you are missing a couple of zeros in your calculations.

Consider two points at longitude 47 degrees:

P1 = (0, 47)
P2 = (0.00001, 47)

The difference is on the 5th digit. Their distance is 76 cm, less than 1 meter. From where do you get the figure of 100 meters?



Michele Simionato

unread,
Aug 24, 2015, 5:20:48 AM8/24/15
to OpenQuake Users
Ops. I meant latitude here, of course.

You can compute the distances in spherical coordinates with hazardlib:

from openquake.hazardlib.geo.geodetic import geodetic_distance
print geodetic_distance(0, 47., 0.00001, 47.) * 1000


(multiply by 1000 since hazardlib works in kilometers).

Clotaire Michel

unread,
Aug 24, 2015, 11:53:26 AM8/24/15
to OpenQuake Users
5 significant digits for latitude can be tested for instance looking at the distance between (6,47) and (6,47.001), this is 100m. Again the concept of "significant digits" is not very good for this problem because, you are right, at a 0 value for latitude, the distance (6,0) to (6,0.0001) is indeed much smaller. But it is very rare to be at 0 latitude...

Michele Simionato

unread,
Aug 25, 2015, 3:39:11 AM8/25/15
to OpenQuake Users


Il giorno lunedì 24 agosto 2015 17:53:26 UTC+2, Clotaire Michel ha scritto:
5 significant digits for latitude can be tested for instance looking at the distance between (6,47) and (6,47.001), this is 100m. Again the concept of "significant digits" is not very good for this problem because, you are right, at a 0 value for latitude, the distance (6,0) to (6,0.0001) is indeed much smaller. But it is very rare to be at 0 latitude...


I see the source of the confusion. I meant 5 significant digits *after* the decimal point. We can represent 47.00001 which is 7 digits in total, i.e. 1 m and not 100 m.

Michele Simionato

unread,
Aug 25, 2015, 3:55:41 AM8/25/15
to OpenQuake Users
BTW, even if internally we use 5 digits after the decimal point, when exporting the GMFs we use a lesser precision as you correctly pointed out. I am going to change that.

Clotaire Michel

unread,
Aug 25, 2015, 4:06:51 AM8/25/15
to OpenQuake Users
You got the point, thanks for the correction

Michele Simionato

unread,
Aug 25, 2015, 8:59:32 AM8/25/15
to OpenQuake Users
The export precision of the GMFs has been increased. You will find the correction in the nightly builds of tomorrow morning.
Reply all
Reply to author
Forward
0 new messages