Skip to content

Commit

Permalink
Use nc file instead of grib to test to_xarray
Browse files Browse the repository at this point in the history
  • Loading branch information
amarandon committed Dec 5, 2024
1 parent f50d67b commit ec02e78
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/units/test_eoproduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from tests import (
TEST_GRIB_FILE_PATH,
TEST_GRIB_FILENAME,
TEST_GRIB_PRODUCT_PATH,
TEST_RESOURCES_PATH,
EODagTestCase,
)
Expand Down Expand Up @@ -253,13 +252,17 @@ def test_get_rio_env(self):
def populate_directory_with_heterogeneous_files(self, destination):
"""
Put various files in the destination directory:
- a grib file
- an .idx file that often comes with grib files
- a NetCDF file
- a JPEG2000 file
- an XML file
"""
# Copy all files from a grib product
shutil.copytree(TEST_GRIB_PRODUCT_PATH, destination, dirs_exist_ok=True)
cams_air_quality_product_path = os.path.join(
TEST_RESOURCES_PATH,
"products",
"cams-europe-air-quality-forecasts",
)
shutil.copytree(cams_air_quality_product_path, destination, dirs_exist_ok=True)

# Copy files from an S2A product
s2a_path = os.path.join(
Expand All @@ -282,5 +285,5 @@ def test_build_xarray_dict(self):
self.assertIsInstance(xarray_dict, XarrayDict)
self.assertEqual(len(xarray_dict), 2)
for key, value in xarray_dict.items():
self.assertIn(Path(key).suffix, {".grib", ".jp2"})
self.assertIn(Path(key).suffix, {".nc", ".jp2"})
self.assertIsInstance(value, xr.Dataset)

0 comments on commit ec02e78

Please sign in to comment.