diff --git a/src/nwp_consumer/internal/repositories/raw_repositories/ecmwf_mars.py b/src/nwp_consumer/internal/repositories/raw_repositories/ecmwf_mars.py index 0c48245..d166fa0 100644 --- a/src/nwp_consumer/internal/repositories/raw_repositories/ecmwf_mars.py +++ b/src/nwp_consumer/internal/repositories/raw_repositories/ecmwf_mars.py @@ -320,7 +320,7 @@ def _convert(path: pathlib.Path) -> ResultE[list[xr.DataArray]]: ) del dss - if "ens" in ECMWFMARSRawRepository.model().name: + if "ens" in ECMWFMARSRawRepository.model().name.lower(): # Add in missing coordinates for mean/std data if "enfo-es" in path.name: ds = ds.expand_dims(dim={"ensemble_stat": ["std"]}) diff --git a/src/nwp_consumer/internal/repositories/raw_repositories/test_ecmwf_mars.py b/src/nwp_consumer/internal/repositories/raw_repositories/test_ecmwf_mars.py index fbc2fb8..eae9d85 100644 --- a/src/nwp_consumer/internal/repositories/raw_repositories/test_ecmwf_mars.py +++ b/src/nwp_consumer/internal/repositories/raw_repositories/test_ecmwf_mars.py @@ -1,7 +1,9 @@ import dataclasses import datetime as dt +import os import pathlib import unittest +from unittest.mock import patch from returns.result import Failure, ResultE, Success @@ -12,6 +14,7 @@ class TestECMWFMARSEModelREpository(unittest.TestCase): """Test the business methods of the ECMWFRealTimeS3RawRepository class.""" + @patch.dict(os.environ, {"MODEL": "ens-stat-uk"}, clear=True) def test__convert(self) -> None: """Test the _convert method.""" @@ -50,7 +53,6 @@ class TestCase: for t in tests: with self.subTest(name=t.filename): - # Attempt to convert the file result = ECMWFMARSRawRepository._convert( path=pathlib.Path(__file__).parent.absolute() / "test_gribs" / t.filename, ) @@ -66,3 +68,4 @@ class TestCase: self.assertIsInstance(region_result, Failure, msg=f"{region_result}") else: self.assertIsInstance(region_result, Success, msg=f"{region_result}") +