Skip to content

Plotting responsiveness - optimizing from_region()? #234

@johnomotani

Description

@johnomotani

Some operations, such as poloidal-plane plots/animations, can be annoyingly slow. This can happen even when a plot on the x-theta logical grid is fast, in which case the slow-down probably comes from the from_region() operation.

Slow down is probably due to combining coordinates (as in #220). In plotting functions, no Dataset/DataArray is returned, so most of the coordinates are not needed or used.

Responsiveness (e.g. of poloidal-plane plots/animations) might be significantly improved by:

  • dropping unused coordinates somewhere before the concatenation operations here

    xBOUT/xbout/region.py

    Lines 1738 to 1745 in 12c0088

    # get inner x-guard cells for result from the global array
    result = _concat_inner_guards(result, ds_or_da, mxg)
    # get outer x-guard cells for result from the global array
    result = _concat_outer_guards(result, ds_or_da, mxg)
    # get lower y-guard cells from the global array
    result = _concat_lower_guards(result, ds_or_da, mxg, myg)
    # get upper y-guard cells from the global array
    result = _concat_upper_guards(result, ds_or_da, mxg, myg)
  • optionally change the coords and compat arguments to xr.concat() to less-safe but faster settings. A good method might be to add an argument to various functions to switch between the current settings and 'fast'/'unsafe' settings; this argument could then be passed from within plotting methods, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions