|
13 | 13 | import holoviews as hv |
14 | 14 | from holoviews.operation.datashader import rasterize as hds_rasterize |
15 | 15 |
|
16 | | -from uxarray.plot.constants import N_FACE_THRESHOLD |
17 | | - |
18 | 16 |
|
19 | 17 | import numpy as np |
20 | 18 |
|
21 | | - |
22 | 19 | import uxarray.plot.utils |
23 | 20 |
|
24 | 21 |
|
25 | 22 | def plot(uxda, **kwargs): |
26 | | - """Default Plotting Method for UxDataArray.""" |
| 23 | + """Default plotting method for a ``UxDataArray``.""" |
| 24 | + |
27 | 25 | if uxda._face_centered(): |
28 | | - # default to polygon plot |
29 | | - if uxda.uxgrid.n_face < N_FACE_THRESHOLD: |
30 | | - # vector polygons for small datasets |
31 | | - if "exclude_antimeridian" in kwargs: |
32 | | - return polygons(uxda, **kwargs) |
33 | | - else: |
34 | | - return polygons(uxda, exclude_antimeridian=False, **kwargs) |
35 | | - |
36 | | - else: |
37 | | - # rasterized polygons for larger datasets |
38 | | - return rasterize(uxda, method="polygon", **kwargs) |
39 | | - elif uxda._node_centered(): |
40 | | - # default to point plots |
41 | | - return points(uxda, **kwargs) |
42 | | - elif uxda._edge_centered(): |
43 | | - # default to edge plots |
44 | | - return points(uxda, **kwargs) |
| 26 | + return rasterize(uxda, method="polygon", **kwargs) |
| 27 | + |
| 28 | + elif uxda._edge_centered() or uxda._node_centered(): |
| 29 | + return rasterize(uxda, method="point", **kwargs) |
45 | 30 |
|
46 | 31 | else: |
47 | | - raise ValueError("Data must be either node or face centered.") |
| 32 | + raise ValueError( |
| 33 | + "Plotting variables on unstructured grids requires the data variable to be mapped to either the nodes, edges, or faces." |
| 34 | + ) |
48 | 35 |
|
49 | 36 |
|
50 | 37 | def datashade( |
|
0 commit comments