#!/usr/bin/env python # coding: utf-8 # # DataArray - Dfs123 plotting # # A DataArray with gridded data, can be plotted in many different ways. # In[1]: import mikeio # ## Dfs1 # In[2]: 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 # In[3]: da.geometry # In[4]: steps = slice(0,10,2) ax=da[steps].plot() ax.legend(da[steps].time); # In[5]: # plot all points on line as time series da.plot.timeseries(); # In[6]: # first 48 hours... da[:49].plot.pcolormesh(); # In[7]: da.sel(x=0.5).sel(time=slice("2021-08-01","2021-08-03")).plot(); # In[8]: da.plot.hist(bins=40); # ## Dfs2 # In[9]: da = mikeio.read("../tests/testdata/gebco_sound.dfs2")[0] da # In[10]: da.geometry # In[11]: da.plot(figsize=(10,6)); # In[12]: da.plot.contourf(figsize=(10,6), levels=4); # In[13]: ax = da.plot.contour(figsize=(8,8), cmap="plasma") ax.set_xlim([12.5, 12.9]); ax.set_ylim([55.8, 56]); # In[14]: da.plot.hist(bins=20); # ## Dfs3 # In[15]: fn = "../tests/testdata/test_dfs3.dfs3" dfs = mikeio.open(fn) dfs # In[16]: dfs.geometry # In[17]: ds=dfs.read() ds # In[18]: ds.Temperature.plot(); # In[19]: ax = ds.Temperature[:,0,:,:].plot.contourf(); ax.grid() # In[20]: ds.Temperature[:,0,:,0].plot(); # In[21]: ds=dfs.read(layers=0) ds # In[22]: ds.Temperature.plot(); # In[ ]: