Experimental support for plotting SCHISM output#187
Conversation
243ab1b to
9f181b8
Compare
SCHISM datasets define many variables on the node grid of the dataset, unlike COMPAS datasets with their data on the face grid. emsarray can open SCHISM datasets but didn't know how to plot them till now. This support is experimental and the API is likely to change. There are no tests yet.
Now the convention can decide how to plot a variable / tuple of variables, perhaps by determining which grid they are on. The collection of new plot functions on the Convention also give more flexibility to callers. The animation functions have not been updated to match yet. This is a partial implementation of the work required for #175
9f181b8 to
171146f
Compare
|
You can now do something like this: ds = emsarray.open_dataset(...)
ds.ems.plot("face_based_variable")
ds.ems.plot("node_based_variable")
ds.ems.plot(("u", "v"))and emsarray will pick the right thing to do. You can stack plots by supplying more variables as: ds = emsarray.open_dataset(...)
ds = ds.isel(time=0, depth=0)
ds.ems.plot("temp", ("u", "v"))Each convention knows how to plot some kinds of variables, and a particular convention can add support for plotting more kinds of variables. A "variable" here means either a data array, or a tuple of data arrays. The tuple form is useful for plotting vectors, for example, where the individual data arrays form components of the whole variable. The base Convention knows how to plot scalar variables on the default polygon grid, and face centred vectors from two component variables. The UGrid convention knows how to plot variables defined on nodes as a TriMesh with gouraud shading. Once more tests have been written this could be merged as is, but this is not the final form. ArakawaC grids also have node based data, for example, and those should be plotable by reusing the code. This would require moving the trimesh code somewhere reusable instead of being in the UGrid convention. My proposed approach is detailed in #121. The triangulation code also needs some changes. The fix added here is temporary. A better approach is documented in #189. |
|
Closing in favour of #205, which does this but more thoroughly. |
SCHISM datasets define many variables on the node grid of the dataset, unlike COMPAS datasets with their data on the face grid. emsarray can open SCHISM datasets but didn't know how to plot them till now.
This support is experimental and the API is likely to change. There are no tests yet.
This is preliminary work to add temporary support for SCHISM. A full rework to generically support extended plotting options is coming in the future but is not part of this work.