-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import unittest | ||
from pathlib import Path | ||
import pandas as pd | ||
import pandas.testing as pdt | ||
from lisfloodutilities.lfcoords import Config | ||
from lilisfloodutilities.lfcoords.finer_grid import coordinates_fine | ||
from llisfloodutilities.lfcoords.coarser_grid import coordinates_coarse | ||
|
||
|
||
class TestCatchStats(unittest.TestCase): | ||
|
||
path = Path('tests/data/lfcoords') | ||
|
||
def test_lfcoords(self): | ||
|
||
# compute test values | ||
cfg = Config(self.path / 'config.yml') | ||
stations_HR = coordinates_fine(cfg, save=False) | ||
test = coordinates_coarse(cfg, stations_HR, save=False) | ||
|
||
|
||
# maps = read_inputmaps(self.path / 'maps') | ||
# masks = read_masks(self.path / 'masks') | ||
# weight = read_pixarea(self.path / 'pixarea_iberian_01min.nc') | ||
# test = catchment_statistics(maps, masks, ['mean', 'std', 'min', 'max', 'count'], weight=weight, output=None).to_pandas() | ||
|
||
# load expected values | ||
expected = pd.read_csv(self.path / 'expected.csv', index_col='id') | ||
expected.index =expected.index.astype(test.index.dtype) | ||
|
||
# check | ||
try: | ||
pdt.assert_frame_equal(test, expected) | ||
except AssertionError as e: | ||
print(e) |