Open hsteptoe opened 5 years ago
Add notebook widgets to help explore rotated poles:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
def plotrp(pole_lat, pole_lon):
rotated_pole = ccrs.RotatedPole(pole_longitude=pole_lon, pole_latitude=pole_lat)
box_top = 30
x, y = [-44, -44, 45, 45, -44], [-45, box_top, box_top, -45, -45]
fig = plt.figure(figsize=(20,10))
ax = fig.add_subplot(1, 2, 1, projection=rotated_pole)
ax.stock_img()
ax.coastlines()
ax.plot(x, y, marker='o', transform=rotated_pole)
ax.fill(x, y, color='coral', transform=rotated_pole, alpha=0.4)
ax.gridlines()
ax = fig.add_subplot(1, 2, 2, projection=ccrs.PlateCarree())
ax.stock_img()
ax.coastlines()
ax.plot(x, y, marker='o', transform=rotated_pole)
ax.fill(x, y, transform=rotated_pole, color='coral', alpha=0.4)
ax.gridlines()
plt.show()
# def on_button_click(a):
# plotrp(pole_lat.value, pole_lon.value)
# pole_lat = widgets.IntSlider(value=45, min=0, max=90, step=1, description='Pole Latitude')
# pole_lon = widgets.IntSlider(value=180, min=0, max=360, step=1, description='Pole Longitude')
# display(pole_lat)
# display(pole_lon)
# button = widgets.Button(description="Plot")
# display(button)
# button.on_click(on_button_click)
interact_manual(plotrp, pole_lat=widgets.IntSlider(value=45, min=0, max=90, step=1, description='Pole Latitude'),
pole_lon=widgets.IntSlider(value=180, min=0, max=360, step=1, description='Pole Longitude'))
Add figure to help explain why we need to weight latitudes when finding areas averages
this probably needs a review since the updates to use CORDEX data
To do list for changes to Worksheets 2a & 2b for v2 release.