diff --git a/city_metrix/layers/era_5_hottest_day.py b/city_metrix/layers/era_5_hottest_day.py index 44718eb..019f6a0 100644 --- a/city_metrix/layers/era_5_hottest_day.py +++ b/city_metrix/layers/era_5_hottest_day.py @@ -136,8 +136,8 @@ def hourly_mean_temperature(image): for file in glob.glob(f'download_{i}.grib*'): os.remove(file) - an_data = xr.concat(an_list, dim='time') - fc_data = xr.concat(fc_list, dim='time') + an_data = xr.concat(an_list, dim='time').dropna(dim='time') + fc_data = xr.concat(fc_list, dim='time').dropna(dim='time') fc_data = fc_data.sel(time=~fc_data.indexes['time'].duplicated()) fc_data = fc_data.transpose(*an_data.dims) diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 5c6e85f..d8634db 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -27,6 +27,8 @@ def test_built_land_without_tree_cover(): @pytest.mark.skipif(EXECUTE_IGNORED_TESTS == False, reason="CDS API needs personal access token file to run") def test_era_5_met_preprocess_portland(): indicator = era_5_met_preprocessing(OR_PORTLAND_NO_TILE_ZONE) + has_nan_values = indicator.direct_rad.isna().any() + assert has_nan_values == False assert len(indicator) == 24