Skip to content

Commit

Permalink
Merge pull request #110 from wri/CIF-346-ERA5HottestDay-returns-nan-f…
Browse files Browse the repository at this point in the history
…or-three-properties

Fixed missing values in ERA5 data
  • Loading branch information
kcartier-wri authored Jan 16, 2025
2 parents d2845ce + 271a83d commit 581091c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions city_metrix/layers/era_5_hottest_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 581091c

Please sign in to comment.