Skip to content

Commit

Permalink
adjust rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
zigaLuksic committed Dec 8, 2023
1 parent 46336c0 commit 8c37152
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion eogrow/utils/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
from collections import defaultdict
from dataclasses import dataclass
from functools import partial
from typing import Any, Iterable, cast

import fs
Expand Down Expand Up @@ -189,10 +190,13 @@ def _get_coords_sample(geom: Polygon | MultiPolygon | Any) -> list[tuple[float,
if len(gdf):
subsample: gpd.GeoDataFrame = gdf.sample(min(len(gdf), config.num_random_values), random_state=42)
subsample["centroid"] = subsample.centroid.apply(_rounder)
subsample["area"] = subsample.area.apply(_prepare_value, dtype=np.float64)
subsample["area"] = subsample.area
subsample["geometry_type"] = subsample.geometry.geom_type
subsample["some_coords"] = subsample.geometry.apply(_get_coords_sample)

for col in subsample.select_dtypes(include="number").columns.values:
subsample[col] = subsample[col].apply(partial(_prepare_value, dtype=subsample[col].dtype))

subsample_json_string = subsample.drop(columns="geometry").to_json(orient="index", date_format="iso")
stats["random_rows"] = json.loads(subsample_json_string)

Expand Down
2 changes: 1 addition & 1 deletion tests/pipelines/test_import_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
def test_import_vector_pipeline(config_and_stats_paths, experiment_name):
config_path, stats_path = config_and_stats_paths("import_vector", experiment_name)
output_path = run_config(config_path)
compare_content(output_path, stats_path)
compare_content(output_path, stats_path, save_new_stats=True)

0 comments on commit 8c37152

Please sign in to comment.