# for each column.
# Make a copy of the z cross data. Let's use regular numpy arrays for this.
# values and copy these to the missing elements below.
# Let's find the lowest index that isn't filled. The nonzero function
# finds all unmasked values greater than 0. Since 0 is a valid value
# for wspd, let's change that threshold to be -200 wspd instead.
end_point= end_point)
# Get the lat/lon points
lats, lons = latlon_coords(tc)
# Get the cartopy projection object
cart_proj = get_cartopy(tc)
# Create a figure that will have 3 subplots
fig = plt.figure(figsize=(12,9))
ax_wspd = fig.add_subplot(1,1,1)
#ax_dbz = fig.add_subplot(1,1,1)
# Make the contour plot for wind speed
levels = np.linspace(6, 31, num=26)
#levels = np.linspace(-10, 12, num=23)
xs = np.arange(0, wspd_cross.shape[-1], 1)
ys = to_np(wspd_cross.coords["vertical"])
wspd_contours = ax_wspd.contourf(xs,
ys,
to_np(wspd_cross_filled),20,levels=levels,cmap=get_cmap("jet"))
# Add the color bar
cb_wspd = fig.colorbar(wspd_contours, ax=ax_wspd)
cb_wspd.ax.tick_params(labelsize=10)
cb_wspd.set_label('m s-1', rotation=0)
# Fill in the mountain area
ht_fill = ax_wspd.fill_between(xs, -30, ter_line,
facecolor="saddlebrown")
# Set the x-ticks to use latitude and longitude labels
coord_pairs = to_np(wspd_cross.coords["xy_loc"])
x_ticks = np.arange(coord_pairs.shape[0])
x_labels = [pair.latlon_str() for pair in to_np(coord_pairs)]
# Set the desired number of x ticks below
num_ticks = 5
thin = int((len(x_ticks) / num_ticks) + .5)
coord_pairs = wspd_cross.coords["xy_loc"]
x_ticks = np.arange(coord_pairs.shape[0])
x_labels = [pair.latlon_str() for pair in to_np(coord_pairs)]
ax_wspd.set_xticks(x_ticks[0:150:15])
ax_wspd.set_xticklabels(x_labels[0:150:15], rotation=22.5, fontsize=9)
# Set the x-axis and y-axis labels
ax_wspd.set_xlabel("Latitude, Longitude", fontsize=12)
ax_wspd.set_ylabel("Height (m)", fontsize=12)
ax_wspd.set_ylim([-30,700])
# Add a title
ax_wspd.set_title("Cross-Section of wind speed over Bautino 27th of January 2100", {"fontsize" : 14})