uxarray.Grid.to_geodataframe#
- Grid.to_geodataframe(periodic_elements='exclude', projection=None, cache=True, override=False, engine='spatialpandas', exclude_antimeridian=None, return_non_nan_polygon_indices=False, exclude_nan_polygons=True, **kwargs)#
Constructs a
GeoDataFrame
consisting of polygons representing the faces of the currentGrid
Periodic polygons (i.e. those that cross the antimeridian) can be handled using the
periodic_elements
parameter. Settingperiodic_elements='split'
will split each periodic polygon along the antimeridian. Settingperiodic_elements='exclude'
will exclude any periodic polygon from the computed GeoDataFrame. Settingperiodic_elements='ignore'
will compute the GeoDataFrame assuming no corrections are needed, which is best used for grids that do not initially include any periodic polygons.- Parameters:
periodic_elements (str, optional) – Method for handling periodic elements. One of [‘exclude’, ‘split’, or ‘ignore’]: - ‘exclude’: Periodic elements will be identified and excluded from the GeoDataFrame - ‘split’: Periodic elements will be identified and split using the
antimeridian
package - ‘ignore’: No processing will be applied to periodic elements.projection (ccrs.Projection, optional) – Geographic projection used to transform polygons. Only supported when periodic_elements is set to ‘ignore’ or ‘exclude’
cache (bool, optional) – Flag used to select whether to cache the computed GeoDataFrame
override (bool, optional) – Flag used to select whether to ignore any cached GeoDataFrame
engine (str, optional) – Selects what library to use for creating a GeoDataFrame. One of [‘spatialpandas’, ‘geopandas’]. Defaults to spatialpandas
exclude_antimeridian (bool, optional) – Flag used to select whether to exclude polygons that cross the antimeridian (Will be deprecated)
return_non_nan_polygon_indices (bool, optional) – Flag used to select whether to return the indices of any non-nan polygons
exclude_nan_polygons (bool, optional) – Flag to select whether to exclude any nan polygons
- Returns:
gdf – The output
GeoDataFrame
with a filled out “geometry” column of polygons.- Return type:
spatialpandas.GeoDataFrame or geopandas.GeoDataFrame