A DataArray with gridded data, can be plotted in many different ways.
import mikeio
ds = mikeio.read("../tests/testdata/vu_tide_hourly.dfs1")
ds = ds.rename({"Tidal current component (geographic East)":"Tidal current u-comp"})
da = ds["Tidal current u-comp"]
da
<mikeio.DataArray> name: Tidal current u-comp dims: (time:721, x:11) time: 2021-08-01 00:00:00 - 2021-08-31 00:00:00 (721 records) geometry: Grid1D (nx=11, dx=0.09818)
da.geometry
<mikeio.Grid1D> axis: nx=11 points from x0=0 to x1=0.981768 with dx=0.0981768
steps = slice(0,10,2)
ax=da[steps].plot()
ax.legend(da[steps].time);
# plot all points on line as time series
da.plot.timeseries();
# first 48 hours...
da[:49].plot.pcolormesh();
da.sel(x=0.5).sel(time=slice("2021-08-01","2021-08-03")).plot();
da.plot.hist(bins=40);
da = mikeio.read("../tests/testdata/gebco_sound.dfs2")[0]
da
<mikeio.DataArray> name: Elevation dims: (time:1, y:264, x:216) time: 2020-05-15 11:04:52 (time-invariant) geometry: Grid2D (ny=264, nx=216)
da.geometry
<mikeio.Grid2D> x-axis: nx=216 points from x0=12.2021 to x1=13.0979 with dx=0.00416667 y-axis: ny=264 points from y0=55.2021 to y1=56.2979 with dy=0.00416667 Number of grid points: 57024
da.plot(figsize=(10,6));
da.plot.contourf(figsize=(10,6), levels=4);
ax = da.plot.contour(figsize=(8,8), cmap="plasma")
ax.set_xlim([12.5, 12.9]);
ax.set_ylim([55.8, 56]);
da.plot.hist(bins=20);
fn = "../tests/testdata/test_dfs3.dfs3"
dfs = mikeio.open(fn)
dfs
<mikeio.Dfs3> geometry: Grid3D(nz=34, ny=17, nx=21) items: 0: Temperature <Temperature> (degree Kelvin) time: 2 steps start time: 2020-12-30 00:00:00
dfs.geometry
<mikeio.Grid3D> x-axis: nx=21 points from x0=0 to x1=5 with dx=0.25 y-axis: ny=17 points from y0=0 to y1=4 with dy=0.25 z-axis: nz=34 points from z0=0 to z1=33 with dz=1
ds=dfs.read()
ds
<mikeio.Dataset> dims: (time:2, z:34, y:17, x:21) time: 2020-12-30 00:00:00 - 2020-12-30 01:00:00 (2 records) geometry: Grid3D(nz=34, ny=17, nx=21) items: 0: Temperature <Temperature> (degree Kelvin)
ds.Temperature.plot();
ax = ds.Temperature[:,0,:,:].plot.contourf();
ax.grid()
ds.Temperature[:,0,:,0].plot();
ds=dfs.read(layers=0)
ds
c:\users\jem\source\mikeio\mikeio\dfs3.py:261: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if layers == "bottom":
<mikeio.Dataset> dims: (time:2, y:17, x:21) time: 2020-12-30 00:00:00 - 2020-12-30 01:00:00 (2 records) geometry: Grid2D (ny=17, nx=21) items: 0: Temperature <Temperature> (degree Kelvin)
ds.Temperature.plot();