geofare-pipeline / tests /test_data.py
david-thrower's picture
dataset sanity tests
4144b72 verified
Raw History Blame Contribute Delete
672 Bytes
"""Sanity checks on the generated dataset."""
from pathlib import Path
import numpy as np
DATA = Path(__file__).resolve().parent.parent / "data" / "train.csv"
def test_data_shape():
arr = np.genfromtxt(DATA, delimiter=",", skip_header=1)
assert arr.shape == (12000, 7)
def test_data_clean():
arr = np.genfromtxt(DATA, delimiter=",", skip_header=1)
assert not np.isnan(arr).any()
assert set(np.unique(arr[:, 6])) <= {0.0, 1.0}
def test_geo_in_grid():
arr = np.genfromtxt(DATA, delimiter=",", skip_header=1)
assert arr[:, 0].min() >= 40.60 and arr[:, 0].max() <= 40.725
assert arr[:, 1].min() >= -74.02 and arr[:, 1].max() <= -73.70