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 ... wind_speed_east_knots wind_speed_north_knots
0 0F2 -97.7756 ... 1.032920 -2.357185
1 11R -96.3742 ... 1.692155 2.982564
2 2F5 -101.9018 ... -1.110056 -0.311412
3 3T5 -96.9500 ... 1.695097 3.018448
4 5C1 -98.6946 ... 1.271400 1.090743
[5 rows x 6 columns]
/home/travis/build/fatiando/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()
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.209 seconds)