Skip to content

Commit

Permalink
fix: debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
fspoettel committed Jul 1, 2022
1 parent 8657bd7 commit 62da080
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions geoclustering/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import geoclustering.io as io


def print_debug(s):
click.secho(s, fg="bright_black")


@click.command(
help="Tool to cluster geolocations. A cluster is created when a certain number of points (--size) each are within a given distance (--distance) of at least one other point in the cluster. Input is supplied as a csv file. At a minimum, each row needs to have a 'lat' and a 'lon' column. Other rows are reflected to the output."
)
Expand Down Expand Up @@ -54,12 +50,13 @@ def print_debug(s):
@click.option("--debug", is_flag=True, help="Print debug output.")
@click.argument("filename", type=click.Path(exists=True))
def main(distance, size, output, filename, algorithm, open, debug):
if debug:
print_debug(f"Reading input from {Path(filename).absolute()}")
def print_debug(s):
if debug:
click.secho(s, fg="bright_black")


df = io.read_csv_file(filename)
if debug:
print_debug(f"Read {len(df)} valid coordinates")
print_debug(f"Read {len(df)} valid coordinates from {Path(filename).absolute()}")

clusters = clustering.cluster_locations(
df=df, algorithm=algorithm, radius_km=distance, min_cluster_size=size
Expand Down

0 comments on commit 62da080

Please sign in to comment.