Skip to content

Commit d8a8408

Browse files
committed
Use numpy rad2deg
1 parent 21d8175 commit d8a8408

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

polaris/tasks/ocean/customizable_viz/viz_horiz_field.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def run(self): # noqa:C901
3636
max_latitude = section.getfloat('max_latitude')
3737
min_longitude = section.getfloat('min_longitude')
3838
max_longitude = section.getfloat('max_longitude')
39-
lat_cell = ds_mesh['latCell'] * 180.0 / np.pi
40-
lon_cell = ds_mesh['lonCell'] * 180.0 / np.pi
39+
lat_cell = np.rad2deg(ds_mesh['latCell'])
40+
lon_cell = np.rad2deg(ds_mesh['lonCell'])
4141
if min_longitude < 0.0 and lon_cell.min().values > 0.0:
4242
max_longitude_copy = max_longitude
4343
max_longitude = 360.0 - min_longitude

polaris/viz/spherical.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ def plot_global_mpas_field(
148148
)
149149

150150
if enforce_aspect_ratio:
151-
min_latitude = mesh_ds.latCell.min().values * 180.0 / np.pi
152-
max_latitude = mesh_ds.latCell.max().values * 180.0 / np.pi
153-
min_longitude = mesh_ds.lonCell.min().values * 180.0 / np.pi
154-
max_longitude = mesh_ds.lonCell.max().values * 180.0 / np.pi
151+
min_latitude = np.rad2deg(mesh_ds.latCell.min().values)
152+
max_latitude = np.rad2deg(mesh_ds.latCell.max().values)
153+
min_longitude = np.rad2deg(mesh_ds.lonCell.min().values)
154+
max_longitude = np.rad2deg(mesh_ds.lonCell.max().values)
155155
geod = Geodesic()
156156
x_distance = geod.inverse(
157157
[min_longitude, min_latitude], [max_longitude, min_latitude]

0 commit comments

Comments
 (0)