Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mov run #994

Merged
merged 18 commits into from
Nov 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
clean up
  • Loading branch information
lee1043 committed Nov 30, 2023
commit 1baba965c9fa770675858113a1c847303c368fd6
8 changes: 2 additions & 6 deletions pcmdi_metrics/variability_mode/lib/plot_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ def plot_map_cartopy(
lat_min = lat.min().item()
lat_max = lat.max().item()

if debug:
print(lon_min, lon_max, lat_min, lat_max)

debug_print("Central longitude setup starts", debug)
debug_print("proj: " + proj, debug)

Expand Down Expand Up @@ -266,17 +263,14 @@ def plot_map_cartopy(
# the bottom left and go round anticlockwise, creating a boundary point
# every 1 degree so that the result is smooth:
# https://stackoverflow.com/questions/43463643/cartopy-albersequalarea-limit-region-using-lon-and-lat

vertices = [
(lon - 180, lat_min) for lon in range(int(lon_min), int(lon_max + 1), 1)
] + [(lon - 180, lat_max) for lon in range(int(lon_max), int(lon_min - 1), -1)]
boundary = mpath.Path(vertices)
ax.set_boundary(
boundary, transform=ccrs.PlateCarree(central_longitude=180)
) # Here, 180 should be hardcoded, otherwise AMO map will be at out of figure box

ax.set_extent([lon_min, lon_max, lat_min, lat_max], crs=ccrs.PlateCarree())

if gridline:
gl = ax.gridlines(
draw_labels=True,
Expand All @@ -295,6 +289,8 @@ def plot_map_cartopy(
right_label = ea.get_position()[0] > 0
if right_label:
ea.set_visible(False)
else:
sys.exit("Projection, " + proj + ", is not defined.")

debug_print("projection completed", debug)

Expand Down