Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
alpha-beta-soup committed Jan 15, 2024
1 parent 0d371ed commit 56a0daf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@ raster2dggs h3 --resolution 13 --compression zstd --resampling nearest -a median

APA/Harvard

> Ardo, J., & Law, R. (2023). raster2dggs (0.2.4) [Computer software]. https://github.com/manaakiwhenua/raster2dggs
> Ardo, J., & Law, R. (2023). raster2dggs (0.2.4) [Computer software]. https://github.com/manaakiwhenua/raster2dggs
[![manaakiwhenua-standards](https://github.com/manaakiwhenua/raster2dggs/workflows/manaakiwhenua-standards/badge.svg)](https://github.com/manaakiwhenua/manaakiwhenua-standards)
16 changes: 10 additions & 6 deletions raster2dggs/h3.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"decimals": 1,
"warp_mem_limit": 12000,
"resampling": "average",
"tempdir": tempfile.tempdir
"tempdir": tempfile.tempdir,
}

DEFAULT_PARENT_OFFSET = 6
Expand Down Expand Up @@ -219,7 +219,9 @@ def process(window):
)


def _h3_parent_groupby(df, resolution: int, aggfunc: Union[str, Callable], decimals: int):
def _h3_parent_groupby(
df, resolution: int, aggfunc: Union[str, Callable], decimals: int
):
"""
Function for aggregating the h3 resolution values per parent partition. Each partition will be run through with a
pandas .groupby function. This step is to ensure there are no duplicate h3 values, which will happen when indexing a
Expand Down Expand Up @@ -288,7 +290,7 @@ def _address_boundary_issues(
engine="pyarrow",
write_index=True,
append=False,
name_function=lambda i: f'{uniqueh3[i]}.parquet',
name_function=lambda i: f"{uniqueh3[i]}.parquet",
compression=kwargs["compression"],
)
)
Expand Down Expand Up @@ -371,7 +373,7 @@ def _address_boundary_issues(
"--tempdir",
default=DEFAULTS["tempdir"],
type=click.Path(),
help="Temporary data is created during the execution of this program. This parameter allows you to control where this data will be written."
help="Temporary data is created during the execution of this program. This parameter allows you to control where this data will be written.",
)
@click.version_option(version=__version__)
def h3(
Expand Down Expand Up @@ -421,8 +423,10 @@ def h3(
), # Input raster must be converted to WGS84 (4326) for H3 indexing
"warp_mem_limit": warp_mem_limit,
}
if aggfunc == 'mode':
logging.warning('Mode aggregation: arbitrary behaviour: if there is more than one mode when aggregating, only the first value will be recorded.')
if aggfunc == "mode":
logging.warning(
"Mode aggregation: arbitrary behaviour: if there is more than one mode when aggregating, only the first value will be recorded."
)
aggfunc = lambda x: pd.Series.mode(x)[0]
kwargs = {
"upscale": upscale,
Expand Down

0 comments on commit 56a0daf

Please sign in to comment.