Skip to content

Commit

Permalink
Use sawtooth method for better performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Jan 15, 2023
1 parent c9b1afd commit 01d8bee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion glue/viewers/scatter/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _update_data(self):
# The full-sphere projections expect longitude angles in the range [-pi, pi]
# so we wrap angles to accommodate this
if full_sphere:
x = np.arctan2(np.sin(x), np.cos(x))
x = np.mod(x + np.pi, 2 * np.pi) - np.pi

if flip_lonaxis:
x = np.negative(x)
Expand Down
2 changes: 1 addition & 1 deletion glue/viewers/scatter/python_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def python_export_scatter_layer(layer, *args):
script += "x = {0}layer_data['{1}']{2}\n".format(x_transform_open, layer._viewer_state.x_att.label, x_transform_close)
script += "y = {0}layer_data['{1}']{2}\n".format(y_transform_open, layer._viewer_state.y_att.label, y_transform_close)
if full_sphere:
script += "x = np.arctan2(np.sin(x), np.cos(x))\n"
script += "x = np.mod(x + np.pi, 2 * np.pi) - np.pi\n"
if layer._viewer_state.flip_lonaxis:
script += "x = np.negative(x)\n"
if layer._viewer_state.flip_lataxis:
Expand Down

0 comments on commit 01d8bee

Please sign in to comment.