From 3e8fed48b9a2d9d3208a6dc2abbba843b40316fb Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Tue, 12 Nov 2024 16:54:09 -0500 Subject: [PATCH] Move up one level --- .../python/h3ronpy/{arrow/__init__.py => arrow.py} | 0 h3ronpy/python/h3ronpy/pandas/raster.py | 13 +++++++------ h3ronpy/python/h3ronpy/pandas/vector.py | 9 ++++----- h3ronpy/python/h3ronpy/polars/raster.py | 8 ++++---- h3ronpy/python/h3ronpy/{arrow => }/raster.py | 7 +++---- h3ronpy/python/h3ronpy/{arrow => }/util.py | 0 h3ronpy/python/h3ronpy/{arrow => }/vector.py | 5 ++--- 7 files changed, 20 insertions(+), 22 deletions(-) rename h3ronpy/python/h3ronpy/{arrow/__init__.py => arrow.py} (100%) rename h3ronpy/python/h3ronpy/{arrow => }/raster.py (97%) rename h3ronpy/python/h3ronpy/{arrow => }/util.py (100%) rename h3ronpy/python/h3ronpy/{arrow => }/vector.py (98%) diff --git a/h3ronpy/python/h3ronpy/arrow/__init__.py b/h3ronpy/python/h3ronpy/arrow.py similarity index 100% rename from h3ronpy/python/h3ronpy/arrow/__init__.py rename to h3ronpy/python/h3ronpy/arrow.py diff --git a/h3ronpy/python/h3ronpy/pandas/raster.py b/h3ronpy/python/h3ronpy/pandas/raster.py index 5b03d25..8890700 100644 --- a/h3ronpy/python/h3ronpy/pandas/raster.py +++ b/h3ronpy/python/h3ronpy/pandas/raster.py @@ -1,15 +1,16 @@ +import typing + import geopandas as gpd import numpy as np import pandas as pd -import typing -from ..arrow import raster as arrow_raster +from .. import raster from .vector import cells_dataframe_to_geodataframe -__doc__ = arrow_raster.__doc__ +__doc__ = raster.__doc__ -nearest_h3_resolution = arrow_raster.nearest_h3_resolution -rasterize_cells = arrow_raster.rasterize_cells +nearest_h3_resolution = raster.nearest_h3_resolution +rasterize_cells = raster.rasterize_cells def raster_to_dataframe( @@ -39,7 +40,7 @@ def raster_to_dataframe( :return: pandas `DataFrame` or `GeoDataFrame` """ - df = arrow_raster.raster_to_dataframe( + df = raster.raster_to_dataframe( in_raster, transform, h3_resolution, diff --git a/h3ronpy/python/h3ronpy/pandas/vector.py b/h3ronpy/python/h3ronpy/pandas/vector.py index 73e4e96..bf99946 100644 --- a/h3ronpy/python/h3ronpy/pandas/vector.py +++ b/h3ronpy/python/h3ronpy/pandas/vector.py @@ -3,11 +3,10 @@ import pyarrow as pa import shapely -from h3ronpy.arrow.vector import cells_to_wkb_polygons - -from .. import DEFAULT_CELL_COLUMN_NAME, H3_CRS, ContainmentMode -from ..arrow import util as _arrow_util -from ..arrow import vector as _av +from h3ronpy import DEFAULT_CELL_COLUMN_NAME, H3_CRS, ContainmentMode +from h3ronpy import util as _arrow_util +from h3ronpy import vector as _av +from h3ronpy.vector import cells_to_wkb_polygons def cells_dataframe_to_geodataframe( diff --git a/h3ronpy/python/h3ronpy/polars/raster.py b/h3ronpy/python/h3ronpy/polars/raster.py index fd8208b..f7b6b8d 100644 --- a/h3ronpy/python/h3ronpy/polars/raster.py +++ b/h3ronpy/python/h3ronpy/polars/raster.py @@ -1,9 +1,9 @@ -from ..arrow import raster as arrow_raster +from h3ronpy import raster -nearest_h3_resolution = arrow_raster.nearest_h3_resolution -rasterize_cells = arrow_raster.rasterize_cells +nearest_h3_resolution = raster.nearest_h3_resolution +rasterize_cells = raster.rasterize_cells -__doc__ = arrow_raster.__doc__ +__doc__ = raster.__doc__ __all__ = [ nearest_h3_resolution.__name__, diff --git a/h3ronpy/python/h3ronpy/arrow/raster.py b/h3ronpy/python/h3ronpy/raster.py similarity index 97% rename from h3ronpy/python/h3ronpy/arrow/raster.py rename to h3ronpy/python/h3ronpy/raster.py index 98adc55..bbce849 100644 --- a/h3ronpy/python/h3ronpy/arrow/raster.py +++ b/h3ronpy/python/h3ronpy/raster.py @@ -33,11 +33,10 @@ import numpy as np import pyarrow as pa +from h3ronpy import DEFAULT_CELL_COLUMN_NAME +from h3ronpy.arrow import _to_arrow_array, _to_uint64_array from h3ronpy.h3ronpyrs import raster - -from .. import DEFAULT_CELL_COLUMN_NAME -from . import _to_arrow_array, _to_uint64_array -from .vector import cells_bounds, cells_to_wkb_polygons +from h3ronpy.vector import cells_bounds, cells_to_wkb_polygons try: # affine library is used by rasterio diff --git a/h3ronpy/python/h3ronpy/arrow/util.py b/h3ronpy/python/h3ronpy/util.py similarity index 100% rename from h3ronpy/python/h3ronpy/arrow/util.py rename to h3ronpy/python/h3ronpy/util.py diff --git a/h3ronpy/python/h3ronpy/arrow/vector.py b/h3ronpy/python/h3ronpy/vector.py similarity index 98% rename from h3ronpy/python/h3ronpy/arrow/vector.py rename to h3ronpy/python/h3ronpy/vector.py index c06c29b..0884efa 100644 --- a/h3ronpy/python/h3ronpy/arrow/vector.py +++ b/h3ronpy/python/h3ronpy/vector.py @@ -2,11 +2,10 @@ from arro3.core import Array, DataType, RecordBatch +from h3ronpy import ContainmentMode +from h3ronpy.arrow import _to_arrow_array, _to_uint64_array from h3ronpy.h3ronpyrs import vector -from .. import ContainmentMode -from . import _to_arrow_array, _to_uint64_array - def cells_to_coordinates(arr, radians: bool = False) -> RecordBatch: """