Orthographic projection gives wrong results when considering lines crossing international date line

Bug #1175545 reported by Damiano Monelli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake Hazard Library
Fix Released
High
Damiano Monelli

Bug Description

The method ``openquake.hazardlib.geo.utils.get_orthographic_projection`` provides inconsistent results when applying the projection function to a line that crosses the international date line.

In particular given a line that crosses the IDL, converting the coordinates to the cartesian space and then back to spherical coordinates does not give the original values, below an example:

>>> from openquake.hazardlib.geo import utils
>>>
>>>
>>> west = 179.0
>>> east = -179.0
>>> south = -1.
>>> north = 1.
>>> proj = utils.get_orthographic_projection(west, east, south, north)
>>>
>>> lons = [179.0, -179.0]
>>> lats = [-1, 1]
>>>
>>> xx, yy = proj(lons, lats)
>>>
>>> new_lons, new_lats = proj(xx, yy, reverse=True)
>>> new_lons
array([-181., -179.])

The original longitudes ([179.0, -179.0]) are not reproduced, what I get is ([-181., -179.0])

This error has been found when running a hazard calculation with OpenQuake with a source model considering a fault crossing the IDL, in this case OQ gives an error because longitude values are not in the expected range [-180., 180]

Changed in oq-hazardlib:
importance: Undecided → High
assignee: nobody → Damiano Monelli (monelli)
Revision history for this message
Lars Butler (lars-butler) wrote :
Changed in oq-hazardlib:
status: New → Fix Committed
Revision history for this message
Lars Butler (lars-butler) wrote :

Another patch to cover more cases: https://github.com/gem/oq-hazardlib/pull/117

Changed in oq-hazardlib:
milestone: none → 0.12
Changed in oq-hazardlib:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.