forked from equinor/xtgeo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLN: Port x_rotation_conv.c to python
- Loading branch information
Showing
5 changed files
with
72 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from math import degrees, radians | ||
|
||
|
||
def _deg_angle2azimuth(deg: float) -> float: | ||
"""Converts an angle from X-axis anti-clockwise orientation | ||
to Y-axis clockwise azimuth. | ||
""" | ||
return (-deg + 90) % 360 | ||
|
||
|
||
def _deg_azimuth2angle(deg: float) -> float: | ||
"""Converts azimuth from Y-axis clockwise orientation to X-axis | ||
anti-clockwise angle. | ||
""" | ||
return (450 - deg) % 360 | ||
|
||
|
||
def _rad_angle2azimuth(rad: float) -> float: | ||
"""Converts an angle from X-axis anti-clockwise orientation to Y-axis clockwise | ||
azimuth in radians. | ||
""" | ||
return radians(_deg_angle2azimuth(degrees(rad))) | ||
|
||
|
||
def _rad_azimuth2angle(deg: float) -> float: | ||
"""Converts azimuth from Y-axis clockwise orientation to X-axis anti-clockwise | ||
angle in radians. | ||
""" | ||
return radians(_deg_azimuth2angle(degrees(deg))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters