-
-
Save jurand71/ff00ea928805c61d3df05c50169f96b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import geopandas | |
import cartopy.crs as ccrs | |
shpfilename = 'natural-earth-data/ne_10m_admin_0_countries_pol.shp' | |
# read the shapefile using geopandas | |
df_shp = geopandas.read_file(shpfilename) | |
# read Poland's geometry | |
poly = df_shp.loc[df_shp['ADM0_A3_PL'] == 'POL']['geometry'].values[0] | |
#create plot and set up basemap | |
plt.figure(figsize=(15,8)) | |
ax = plt.axes(projection=ccrs.PlateCarree(), frameon=False) | |
#set coordinate and map extent | |
ax.set_extent([13.5, 24.5, 48.5, 55.5], crs=ccrs.PlateCarree()) | |
#Poland's boundary | |
ax.add_geometries([poly], crs=ccrs.PlateCarree(), facecolor='none', edgecolor='0.6') | |
# data of seasonal annomalies in wind in December | |
first_period = df.ua10[0] | |
# przy values moze byc koniecznosc przekszalcenia do tablicy dwuwymiarowej jezeli przy sciaganiu | |
# danych z Copernicusa byłoby kilka okresów | |
# coordinates and wind values | |
values = first_period.values | |
lon, lat = np.meshgrid(first_period.longitude, first_period.latitude) | |
# countour from matplotlib | |
cs = ax.contourf(lon, lat, values, alpha = 0.3, transform=ccrs.PlateCarree(), levels=50, cmap="seismic", vmin=-2, vmax=1) | |
plt.colorbar(cs, orientation="vertical", ax=ax) | |
plt.title('Prognoza odstępstw od średniej wieloletniej prędkości wiatru na wysokości 10m w grudniu 2022') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment