Note
Click here to download the full example code
Wind speed data from TexasΒΆ
This is average wind speed and air temperature for data for the state of Texas, USA, on February 26 2018. The original data was downloaded from Iowa State University.
Out:
station_id longitude latitude air_temperature_c wind_speed_east_knots wind_speed_north_knots
0 0F2 -97.7756 33.6017 9.236111 1.032920 -2.357185
1 11R -96.3742 30.2189 14.214306 1.692155 2.982564
2 2F5 -101.9018 32.7479 7.069444 -1.110056 -0.311412
3 3T5 -96.9500 29.9100 14.496761 1.695097 3.018448
4 5C1 -98.6946 29.7239 12.958333 1.271400 1.090743
/home/leo/src/verde/data/examples/texas-wind.py:42: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.
plt.tight_layout()
/home/leo/src/verde/data/examples/texas-wind.py:43: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
plt.show()
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import verde as vd
# The data are in a pandas.DataFrame
data = vd.datasets.fetch_texas_wind()
print(data.head())
# Make a Mercator map of the data using Cartopy
plt.figure(figsize=(8, 6))
ax = plt.axes(projection=ccrs.Mercator())
ax.set_title("Wind speed and air temperature for Texas")
# Plot the air temperature as colored circles and the wind speed as vectors.
plt.scatter(
data.longitude,
data.latitude,
c=data.air_temperature_c,
s=100,
cmap="plasma",
transform=ccrs.PlateCarree(),
)
plt.colorbar().set_label("Air temperature (C)")
ax.quiver(
data.longitude.values,
data.latitude.values,
data.wind_speed_east_knots.values,
data.wind_speed_north_knots.values,
width=0.003,
transform=ccrs.PlateCarree(),
)
# Use an utility function to add tick labels and land and ocean features to the map.
vd.datasets.setup_texas_wind_map(ax)
plt.tight_layout()
plt.show()
Total running time of the script: ( 0 minutes 0.141 seconds)