Professional Documents
Culture Documents
In [9]: dset
Out[9]: xarray.Dataset
▼ Coordinates:
► Attributes: (0)
In [10]: dset.lat
▼ Coordinates:
units : degrees_north
long_name : Latitude
In [11]: dset['lat']
▼ Coordinates:
units : degrees_north
long_name : Latitude
In [12]: dset.hs
maritim.bmkg.go.id:8111/nbconvert/html/bimtek/01_Adnan Dendy Cilacap/Belajar_netCDF.ipynb?download=false 1/15
4/11/2021 Belajar_netCDF
▼ Coordinates:
▼ Coordinates:
In [15]: mask_lat
In [17]: hs_cilacap.plot()
In [19]: hs_cilacap.data
In [20]: import os
os.environ["PROJ_LIB"] = '/home/opn/anaconda3/pkgs/proj-7.1.0-h966b41f_1/share/proj'
plt.show()
In [28]: dir_cilacap.plot()
In [29]: dir_cilacap
In [30]: u = np.cos(dir_cilacap)
v = np.sin(dir_cilacap)
In [31]: skip = 10
arah = m.quiver(
x[::skip, ::skip],
y[::skip, ::skip],
u[::skip, ::skip],
v[::skip, ::skip],
units='inches',
scale=25,
pivot='mid',
width=0.0099
)
plt.show()
"#E74941",
"#CE2C38",
"#EF37CE",
"#B5349C"])
cmap.set_over('indigo')
bounds = [0, 0.5, 0.75, 1, 1.25, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7]
norm = mcl.BoundaryNorm(bounds, cmap.N)
lons, lats = np.meshgrid(hs_cilacap.lon.data, hs_cilacap.lat.data)
x,y = m(lons,lats)
wh=m.contourf(x, y, hs_cilacap.data,
cmap=cmap,
norm=norm,
levels=bounds,
extend='max'
)
skip = 10
arah = m.quiver(
x[::skip, ::skip],
y[::skip, ::skip],
u[::skip, ::skip],
v[::skip, ::skip],
units='inches',
scale=25,
pivot='mid',
width=0.0099
)
cb=m.colorbar(wh, 'bottom',
ticks=bounds,
spacing='uniform',
extendfrac='auto',
pad=0.2)
bnds = ['0', '0.5', '0.75', '1', '1.25', '1.5', '2', '2.5', '3', '3.5', '4', '5', '6',
cb.set_ticklabels(bnds)
cb.ax.tick_params(labelsize=7)
plt.show()
In [35]: #######################################################################################
urcrnrlon=(right),
llcrnrlat=(bottom),
urcrnrlat=(top),
resolution='i'
)
m.drawcoastlines(linewidth=0.2)
m.drawstates()
m.drawcountries(linewidth=0.2)
m.fillcontinents(lake_color='grey')
m.drawparallels(np.arange(bottom, top, 1),
labels=[1, 0, 0, 0],
dashes=[1, 0],
linewidth=0.3,
color='w',
fontsize=5)
m.drawmeridians(np.arange(left, right, 1),
labels=[0, 0, 0, 1],
dashes=[1, 0],
linewidth=0.3,
color='w',
fontsize=5)
skip = 10
arah = m.quiver(
x[::skip, ::skip],
y[::skip, ::skip],
u[::skip, ::skip],
v[::skip, ::skip],
units='inches',
scale=25,
pivot='mid',
width=0.0099
)
cb=m.colorbar(wh, 'bottom',
maritim.bmkg.go.id:8111/nbconvert/html/bimtek/01_Adnan Dendy Cilacap/Belajar_netCDF.ipynb?download=false 9/15
4/11/2021 Belajar_netCDF
ticks=bounds,
spacing='uniform',
extendfrac='auto',
pad=0.2)
bnds = ['0', '0.5', '0.75', '1', '1.25', '1.5', '2', '2.5', '3', '3.5', '4', '5', '6',
cb.set_ticklabels(bnds)
cb.ax.tick_params(labelsize=7)
plt.title('SIGNIFICANT WAVE HEIGHT')
plt.show()
dir0 = dset.dir[:]
dir_cilacap = dir0.where(mask_lon & mask_lat, drop=True)
u = np.mean(np.cos(dir_cilacap), axis=0)
v = np.mean(np.sin(dir_cilacap), axis=0)
m = Basemap(projection='merc',
llcrnrlon=(left),
urcrnrlon=(right),
llcrnrlat=(bottom),
urcrnrlat=(top),
resolution='i'
)
m.drawcoastlines(linewidth=0.2)
m.drawstates()
m.drawcountries(linewidth=0.2)
m.fillcontinents(lake_color='grey')
m.drawparallels(np.arange(bottom, top, 1),
labels=[1, 0, 0, 0],
dashes=[1, 0],
linewidth=0.3,
color='w',
fontsize=5)
m.drawmeridians(np.arange(left, right, 1),
labels=[0, 0, 0, 1],
dashes=[1, 0],
linewidth=0.3,
color='w',
fontsize=5)
skip = 10
arah = m.quiver(
x[::skip, ::skip],
y[::skip, ::skip],
u[::skip, ::skip],
v[::skip, ::skip],
units='inches',
scale=25,
pivot='mid',
width=0.0099
)
cb=m.colorbar(wh, 'bottom',
ticks=bounds,
spacing='uniform',
extendfrac='auto',
pad=0.2)
bnds = ['0', '0.5', '0.75', '1', '1.25', '1.5', '2', '2.5', '3', '3.5', '4', '5', '6',
cb.set_ticklabels(bnds)
cb.ax.tick_params(labelsize=7)
plt.title('Significant wave height')
plt.show()
time
Out[42]: <AxesSubplot:xlabel='time'>
In [ ]: