From c24075c2db0434b75c9ed8b5587cf8665b97f793 Mon Sep 17 00:00:00 2001 From: lupemba Date: Wed, 12 Nov 2025 15:42:04 +0000 Subject: [PATCH 1/2] Update readme after Pypi release. --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55da6de..cad5df3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It's a Python wrapper around [MetopDatasets.jl](https://github.com/eumetsat/Meto [MetopDatasets.jl](https://github.com/eumetsat/MetopDatasets.jl) is a package for reading products from the [METOP satellites](https://www.eumetsat.int/our-satellites/metop-series) using the native binary format specified for each product. The METOP satellites are part of the EUMETSAT-POLAR-SYSTEM (EPS) and have produced near real-time, global weather and climate observation since 2007. Learn more METOP and the data access on [EUMETSATs user-portal](https://user.eumetsat.int/dashboard). ## Status -MetopPy is under development and is not ready for use yet. +MetopPy is still in an early development phase. Some features from MetopDatasets.jl are not yet implemented, and the public API may undergo breaking changes in the near future. That said, the package is already useful in its current immature state, and we appreciate curious users trying it out and providing feedback through GitHub issues. ## Copyright and License This code is licensed under MIT license. See file LICENSE for details on the usage and distribution terms. @@ -15,11 +15,14 @@ This code is licensed under MIT license. See file LICENSE for details on the usa * Francesco Murdaca- *Contributor* - [EUMETSAT](http://www.eumetsat.int) ## Installation -(This still have to be implemented) ```bash pip install metoppy ``` +## Documentaion +MetopPy does not yet have its own dedicated documentation page. The best resource for now is the Examples section later in this README. + +Another useful resource is the [MetopDatasets.jl documentaion page](https://eumetsat.github.io/MetopDatasets.jl/dev/), which provides concrete examples of how to use the Julia version of the package, supported data formats, and additional information. ## Dependencies From 676d940057937d653fe9dc9cd4a016d811bc64bd Mon Sep 17 00:00:00 2001 From: lupemba Date: Mon, 17 Nov 2025 12:55:20 +0000 Subject: [PATCH 2/2] Add keyword arguments to open_dataset --- README.md | 4 ++-- metoppy/metopreader.py | 14 +++++++++----- metoppy/tests/test_basic_interface.py | 23 +++++++++++++++++++++++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index cad5df3..fc4d195 100644 --- a/README.md +++ b/README.md @@ -196,13 +196,13 @@ docker run -v ./:/usr/local/bin/metoppy -it python:3.12 /bin/bash ``` 3. Move to the repository and install the package for testing -``` +```bash cd /usr/local/bin/metoppy && pip install -e .[test] ``` 4. Modify the local code and test in the container. -``` +```bash pytest metoppy/tests ``` diff --git a/metoppy/metopreader.py b/metoppy/metopreader.py index 39b2fef..841bfc4 100644 --- a/metoppy/metopreader.py +++ b/metoppy/metopreader.py @@ -76,7 +76,7 @@ def shape(self, variable_or_j_array): """ return Main.size(variable_or_j_array) - def open_dataset(self, file_path: str, maskingvalue = Main.missing): + def open_dataset(self, file_path: str, **kwargs): """ Open a dataset from a record path using MetopDatasets.MetopDataset. @@ -85,9 +85,13 @@ def open_dataset(self, file_path: str, maskingvalue = Main.missing): file_path : str Path to the dataset record. - maskingvalue - The masking values are used to replace missing observations. Defaults to Julia Missing type. - A recommended alternative is float("nan") which increasse performance for float data. + + **kwargs + Keyword arguments forwarded to MetopDatasets.MetopDataset constructor. + + maskingvalue + The masking values are used to replace missing observations. Defaults to Julia Missing type. + A recommended alternative is float("nan") which increasse performance for float data. Returns ------- @@ -95,7 +99,7 @@ def open_dataset(self, file_path: str, maskingvalue = Main.missing): A MetopDataset object opened from the provided path. """ try: - return self._open_dataset(file_path, maskingvalue = maskingvalue) + return self._open_dataset(file_path, **kwargs) except Exception as e: raise RuntimeError(f"Failed to open dataset: {file_path}") from e diff --git a/metoppy/tests/test_basic_interface.py b/metoppy/tests/test_basic_interface.py index 12929e7..2428967 100644 --- a/metoppy/tests/test_basic_interface.py +++ b/metoppy/tests/test_basic_interface.py @@ -192,5 +192,28 @@ def test_different_file_types(metop_reader, test_file): assert ds is not None assert "record_start_time" in metop_reader.get_keys(ds) + # clean + metop_reader.close_dataset(ds) + + +@pytest.mark.parametrize("test_file", ["IASI_xxx"], indirect=True) +def test_no_auto_convert(metop_reader, test_file): + """ + Test the auto_convert=False. This should retun varibles in the data type + used to store them on disk. + """ + # arrange + from juliacall import Main as jl + ds = metop_reader.open_dataset(file_path=str(test_file), auto_convert=False) + + # act + start_time = ds["record_start_time"][2] + + # assert + assert jl.isa(start_time, jl.MetopDatasets.ShortCdsTime) + # ShortCdsTime stores the date as days and milliseconds since 00:00 1/1-2000 + assert start_time.day == 9034 + assert start_time.millisecond == 73275381 + # clean metop_reader.close_dataset(ds) \ No newline at end of file