-{"variant":"Code", "content":["{\"code\":\"import freva_client\\nimport xarray as xr\\nimport matplotlib.pyplot as plt\\nimport cartopy.crs as ccrs\\nimport cartopy.feature as cfeature\\nimport numpy as np\\n\\n# 1. Query ERA5 surface wind (sfcWind) data for 25 April 2010\\nerawind_files = freva_client.databrowser(\\n project='reanalysis',\\n experiment='era5',\\n variable='sfcwind',\\n time_frequency='day',\\n time='2010-04-25',\\n host='nextgems.dkrz.de')\\n\\n# 2. Load the data\\nds = xr.open_mfdataset(list(erawind_files), combine='by_coords')\\nwind = ds['sfcWind'].sel(time='2010-04-25').squeeze()\\n\\n# 3. Prepare lon/lat grid\\nd_lon = ds['lon']\\nd_lat = ds['lat']\\nlon2d, lat2d = np.meshgrid(d_lon, d_lat)\\n\\n# 4. Plotting\\nfig, ax = plt.subplots(figsize=(12,6), subplot_kw={'projection': ccrs.PlateCarree()})\\nlevels = np.linspace(np.nanmin(wind), np.nanmax(wind), 60)\\ncf = ax.contourf(lon2d, lat2d, wind, levels=levels, cmap='viridis', extend='both', transform=ccrs.PlateCarree())\\nax.add_feature(cfeature.COASTLINE)\\nax.add_feature(cfeature.BORDERS, linestyle=':')\\nplt.colorbar(cf, orientation='horizontal', pad=0.05, aspect=50, label='Surface Wind (m/s)')\\nplt.title('ERA5 Surface Wind on 2010-04-25')\\nplt.tight_layout()\\nplt.show()\"}","daily_wind_plot"]}
0 commit comments