Skip to content

NEW FEATURE: Visualization of UGRID elements defined on the nodes #32

@Chilipp

Description

@Chilipp

Summary

Within the UGRID conventions it is possible to defined variables to live on the nodes, rather than the faces. Within psyplot, we do visualize them at the the moment, but silently this provides wrong results.

Reason

It should be possible to visualize these elements, too.

Detailed explanation

Within the get_cell_node_coord method of the UGRID decoder, we generate triangles using a delauney triangulation.

https://github.com/psyplot/psyplot/blob/36a23ce964d58e41468fd1f97188b75454c14b7d/psyplot/data.py#L1807

I think this is fine for now as we do not have generic methods to generate grids from the nodes. What grid is the best is a very scientific question and should rather be answered by a custom decoder class for the data.

None the less, the current implementation in psy-maps (and psy-simple) is wrong. In the _polycolor method, we say transformed, array=arr.ravel(). For variables on a node however, this does not generate correct results because the length of the array (which is the same as the number of nodes) is not the same as for transformed, which has the length of the number of triangles.

So array should actually be the mean of the nodes for each generated face element (i.e. for each generated triangle).

Examples

matplotlibs tripcolor method is doing exactly this: https://github.com/matplotlib/matplotlib/blob/e097bf4baf8f275fda91f224b537076caf17dd91/lib/matplotlib/tri/tripcolor.py#L108

ping @platipodium

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugchange featureRequest for changing a feature in the packagenew featureRequest for adding a new feature to the package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions