-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
596 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ | |
"faker", | ||
"coverage", | ||
"moto >= 5", | ||
"responses < 0.24.0", | ||
"twine", | ||
"wheel", | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2024, CS GROUP - France, http://www.c-s.fr | ||
# | ||
# This file is part of EODAG project | ||
# https://www.github.com/CS-SI/EODAG | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2024, CS GROUP - France, http://www.c-s.fr | ||
# | ||
# This file is part of EODAG project | ||
# https://www.github.com/CS-SI/EODAG | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from pathlib import Path | ||
from tempfile import TemporaryDirectory | ||
|
||
import xarray as xr | ||
|
||
from eodag_cube.types import XarrayDict | ||
from tests import EODagTestCase | ||
from tests.context import AwsDownload, EOProduct, PluginConfig, path_to_uri | ||
from tests.utils import populate_directory_with_heterogeneous_files | ||
|
||
|
||
class TestEOProductXarray(EODagTestCase): | ||
def test_to_xarray_local(self): | ||
"""to_xarray must build a Dataset from found local paths""" | ||
with TemporaryDirectory(prefix="eodag-cube-tests") as tmp_dir: | ||
product = EOProduct( | ||
self.provider, self.eoproduct_props, productType=self.product_type | ||
) | ||
product.register_downloader(AwsDownload("foo", PluginConfig()), None) | ||
product.location = path_to_uri(tmp_dir) | ||
populate_directory_with_heterogeneous_files(tmp_dir) | ||
|
||
xarray_dict = product.to_xarray() | ||
|
||
self.assertIsInstance(xarray_dict, XarrayDict) | ||
self.assertEqual(len(xarray_dict), 2) | ||
for key, value in xarray_dict.items(): | ||
self.assertIn(Path(key).suffix, {".nc", ".jp2"}) | ||
self.assertIsInstance(value, xr.Dataset) | ||
|
||
for ds in xarray_dict.values(): | ||
ds.close() |
Oops, something went wrong.