From 0db9c4d79bebead8f18eab35850f9c4612a774f8 Mon Sep 17 00:00:00 2001 From: Peter Powers <pmpowers@usgs.gov> Date: Mon, 21 Dec 2020 07:10:52 -0700 Subject: [PATCH] revert location precision --- .../usgs/earthquake/nshmp/geo/Locations.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/gov/usgs/earthquake/nshmp/geo/Locations.java b/src/main/java/gov/usgs/earthquake/nshmp/geo/Locations.java index 99a9106c..b70365cb 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/geo/Locations.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/geo/Locations.java @@ -468,8 +468,20 @@ public final class Locations { } /* - * Helper assumes supplied values in radians and kilometers. Returned location - * is rounded to 6 decimal places, sub-meter scale precision. + * Helper assumes supplied values in radians and kilometers. + * + * TODO revisit. Introduced rounding of result in refactoring for JSON. This + * changes hazard, most significantly when creating pseudo-sources for grid + * source optimization tables. I think it would be nice to have locations be + * lower precision when resampling traces or splitting location lists. + * Consider introducing a rounding flag. + * + * Interestingly the Locations tests did not fail when the formatting was + * removed + * + * Location.create( Maths.round(lon2 * Maths.TO_DEGREES, 5), Maths.round(lat2 + * * Maths.TO_DEGREES, 5), Maths.round(depth + Δv, 5)); + * */ private static Location location( double lon, @@ -486,10 +498,7 @@ public final class Locations { double cosD = cos(ad); double lat2 = asin(sinLat1 * cosD + cosLat1 * sinD * cos(az)); double lon2 = lon + atan2(sin(az) * sinD * cosLat1, cosD - sinLat1 * sin(lat2)); - return Location.create( - Maths.round(lon2 * Maths.TO_DEGREES, 5), - Maths.round(lat2 * Maths.TO_DEGREES, 5), - Maths.round(depth + Δv, 5)); + return Location.create(lon2 * Maths.TO_DEGREES, lat2 * Maths.TO_DEGREES, depth + Δv); } /** -- GitLab