Skip to content

Commit

Permalink
Added test cdd map for cdd unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
doc78 committed Oct 24, 2023
1 parent a76b556 commit 554e5e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Binary file added tests/data/cdd_temp_map.nc
Binary file not shown.
Binary file modified tests/data/template_test.nc
100644 → 100755
Binary file not shown.
17 changes: 10 additions & 7 deletions tests/test_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_interpolation_use_scipy_nearest(self):
shape_target = PCRasterReader(config_dict['interpolation.latMap']).values.shape
assert shape_target == values_resampled.shape

@pytest.mark.slow
#@pytest.mark.slow
def test_interpolation_create_scipy_invdist(self):
d = deepcopy(config_dict)
d['interpolation.create'] = True
Expand All @@ -45,7 +45,7 @@ def test_interpolation_create_scipy_invdist(self):
assert shape_target == values_resampled.shape
os.unlink('tests/data/tbl_pf10tp_550800_scipy_invdist.npy.gz')

@pytest.mark.slow
#@pytest.mark.slow
def test_interpolation_create_scipy_adw(self):
d = deepcopy(config_dict)
d['interpolation.create'] = True
Expand All @@ -72,8 +72,11 @@ def test_interpolation_create_scipy_cdd(self):
d['interpolation.create'] = True
d['interpolation.parallel'] = True
d['interpolation.mode'] = 'cdd'
d['interpolation.cdd_map'] = 'tests/data/cdd_map.nc'
d['interpolation.lonMap'] = 'tests/data/template_test.nc'
d['interpolation.latMap'] = 'tests/data/template_test.nc'
d['interpolation.cdd_map'] = 'tests/data/cdd_temp_map.nc'
d['interpolation.cdd_options'] = None
d['interpolation.cdd_mode'] = 'MixHofstraShepard'
d['interpolation.use_broadcasting'] = True
file = d['input.file']
reader = GRIBReader(file)
Expand All @@ -87,7 +90,7 @@ def test_interpolation_create_scipy_cdd(self):
values_resampled = interpolator.interpolate_scipy(lats, lons, values_in, grid_id, messages.grid_details)
shape_target = PCRasterReader(d['interpolation.latMap']).values.shape
assert shape_target == values_resampled.shape
os.unlink('tests/data/tbl_pf10tp_550800_scipy_adw.npy.gz')
os.unlink('tests/data/tbl_input_360000_scipy_cdd.npy.gz')

@pytest.mark.slow
def test_interpolation_create_scipy_bilinear(self):
Expand All @@ -112,7 +115,7 @@ def test_interpolation_create_scipy_bilinear(self):
values_resampled = interpolator.interpolate_scipy(lats, lons, values_in, grid_id, messages.grid_details)
shape_target = PCRasterReader(d['interpolation.latMap']).values.shape
assert shape_target == values_resampled.shape
os.unlink('tests/data/tbl_era5t2avg_441_scipy_bilinear.npy.gz')
os.unlink('tests/data/tbl_era5t2avg_360000_scipy_bilinear.npy.gz')

@pytest.mark.slow
def test_interpolation_create_scipy_triangulation(self):
Expand All @@ -137,7 +140,7 @@ def test_interpolation_create_scipy_triangulation(self):
values_resampled = interpolator.interpolate_scipy(lats, lons, values_in, grid_id, messages.grid_details)
shape_target = PCRasterReader(d['interpolation.latMap']).values.shape
assert shape_target == values_resampled.shape
os.unlink('tests/data/tbl_era5t2avg_441_scipy_triangulation.npy.gz')
os.unlink('tests/data/tbl_era5t2avg_360000_scipy_triangulation.npy.gz')

@pytest.mark.slow
def test_interpolation_create_scipy_bilinear_delaunay(self):
Expand All @@ -162,7 +165,7 @@ def test_interpolation_create_scipy_bilinear_delaunay(self):
values_resampled = interpolator.interpolate_scipy(lats, lons, values_in, grid_id, messages.grid_details)
shape_target = PCRasterReader(d['interpolation.latMap']).values.shape
assert shape_target == values_resampled.shape
os.unlink('tests/data/tbl_era5t2avg_441_scipy_bilinear_delaunay.npy.gz')
os.unlink('tests/data/tbl_era5t2avg_360000_scipy_bilinear_delaunay.npy.gz')

@pytest.mark.slow
def test_interpolation_create_eccodes_nearest(self):
Expand Down

0 comments on commit 554e5e9

Please sign in to comment.