1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
-
!
-
!
-
|
!
-
!
-
!
-
!
-
!
| import netCDF4 as nc
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
dataset = nc.Dataset('Z__C_RJTD_20230621022000_RDR_JMAGPV_Gll2p5km_Phhlv_ANAL_grib2.ncdf')
data = dataset.variables['var0_15_192_surface']
lat = dataset.variables['latitude'][:]
lon = dataset.variables['longitude'][:]
ax = plt.axes(projection=ccrs.PlateCarree())
ax.contourf(lon, lat, data[0, ...], levels=20, transform=ccrs.PlateCarree(), cmap='jet')
ax.add_feature(cfeature.COASTLINE, linewidth=0.5)
plt.title('NetCDF Data with World Map')
plt.show()
dataset.close()
|