-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data Structures & Helpers for Visualization #354
Conversation
…Y/uxarray into philipc2/wrapped-polygons
I see this PR has cool pictures!! kudos on the good work - @ifranda and @philipc2 ! Possible to add an example notebook? - potentially something with geographic national showing some the grid and some temp/etc. data. minor note: It'd be good to have some more documentation about the introduction of geometry.py (maybe on top of that file). Geometry means very different things in different context. |
This is currently in the works as a separate cookbook, not directly included in our usage examples (link here). However a usage example notebook under our documentation detailing the algorithm and implementation would be good.
I agree, I chose the name |
What else would this be useful for? any other geometry type operations or purely for viz purposes only? face transformations for visualisation or 2d element utils would be better. |
I can see it being used to store functionality related to geometric data structures, such as KDTrees, so not necessarily visualization-only functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This look great! Nice work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this significant work! Please see my inline comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for resolving a lot of things! Please see my second review's comments below
I can rename it to |
The purpose of decorating functions with properties is to allow for our I need to look into it, however the memory footprint of these properties should only become an issue if there has been a call to them, since the internal attribute that is accessed by the property is initialized to None. @property
def antimeridian_face_indices(self):
"""Index of each face that crosses the antimeridian."""
if self._antimeridian_face_indices is None:
self._antimeridian_face_indices = _build_antimeridian_face_indices(
self)
return self._antimeridian_face_indices
I already have these set up as helper functions, as seen above in the example. I can modify the construction code for the GeoDataFrame and PolyCollection to use the helper functions directly instead of the properties. I'll remove these as properties for now and we can handle exposing these to the user at a later date. |
Would it to be confusing to use only "cache" and "override" instead? Or maybe use one of "cache_result", or "cache_output", or "cache_gdf" and "cache_polycollection"? |
These are all good points, and we should talk about all of these during our later discussion on this. For now, I think we should clean the following leftover from grid.py:
and maybe other leftovers after these last minutes changes? |
The caching happens at the |
Good catch on the leftover attributes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Approved but please see one inline comment below. Regardless of your response to it, feel free to merge it.
Closes #171, #362, #365
Overview
Grid
into a format that can be used with visualization packages (Matplotlib, Holoviews, Datashader)New Dependencies
matplotlib
shapely
spatialpandas
antimeridian
Helper Functions & Attributes
Grid.polygon_shells
Grid.corrected_polygon_shells
Grid.corrected_shells_to_original_faces
Grid.original_to_corrected_indices
Grid.antimeridian_face_indices
grid.geometry.grid_to_polygons
grid.geometry._build_polygon_shells
grid.geometry._build_corrected_polygon_shells
grid.geometry._build_antimeridian_face_indices
grid.geometry._grid_to_polygon_geodataframe
Conversion Methods
Grid.to_geodataframe()
UxDataArray.to_geodataframe()
Grid.to_polycollection()
UxDataArray.to_polycollection()
Expected Usage
Visualization Examples
CSne30 (GeoDataFrame)
Grid, No Projection
Orthographic Projection centered around Antemeridian
GeoFlow (GeoDataFrame)
Grid, No Projection
Orthographic Projection centered around Antemeridian
MPAS (PolyCollection)
Shaded Polygons based on Ocean Depth, Robinson projection
Shaded Polygons based on Ocean Depth, Orthographic projection centered around Antemeridian
PR Checklist
General
Testing
Documentation
_
) and have been added todocs/internal_api/index.rst
docs/user_api/index.rst