Skip to content

Commit

Permalink
use numpy instead of math
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc2 committed Nov 18, 2024
1 parent e3dce0a commit 074a0ea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions uxarray/grid/coordinates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import xarray as xr
import numpy as np
import math
import warnings

from uxarray.conventions import ugrid
Expand Down Expand Up @@ -53,8 +52,8 @@ def _xyz_to_lonlat_rad_no_norm(
Latitude in radians
"""

lon = math.atan2(y, x)
lat = math.asin(z)
lon = np.atan2(y, x)
lat = np.asin(z)

# set longitude range to [0, pi]
lon = np.mod(lon, 2 * np.pi)
Expand Down Expand Up @@ -102,8 +101,8 @@ def _xyz_to_lonlat_rad_scalar(
y /= denom
z /= denom

lon = math.atan2(y, x)
lat = math.asin(z)
lon = np.atan2(y, x)
lat = np.asin(z)

# set longitude range to [0, pi]
lon = np.mod(lon, 2 * np.pi)
Expand Down

0 comments on commit 074a0ea

Please sign in to comment.