From 2e4436c0e4b21a7190668d74bed351628eef93a9 Mon Sep 17 00:00:00 2001 From: Olivier Bonte Date: Wed, 11 Mar 2026 21:50:54 +0100 Subject: [PATCH 1/3] Add sedtion project.optional dependencies Allows user to download extra dependencies to the main package for io and viz --- pyproject.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 25d532be..03e0b74c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,13 +15,17 @@ dependencies = [ "matplotlib>=3.9.0", "prefect>=3.3.0", "zarr", + "julia>=0.6.2", ] -[dependency-groups] +[project.optional-dependencies] viz = ["matplotlib<3.9.1", "cmcrameri"] -prefect = ["prefect>=3.3.0"] io = ["netcdf4", "zarr"] julia = ["julia"] +example = ["xbitinfo[viz,io]","pooch","jupyter>=1.1"] + +[dependency-groups] +prefect = ["prefect>=3.3.0"] test = ["pytest", "pooch", "netcdf4", "dask", "zarr", "julia", "cmcrameri", "cfgrib", "prefect>=3.3.0", "prefect_dask"] docs = [ "sphinx", From e0bcb1ef7584c6fd6a4bfdf6b5c183487f84f51e Mon Sep 17 00:00:00 2001 From: Olivier Bonte Date: Thu, 12 Mar 2026 10:01:27 +0100 Subject: [PATCH 2/3] Add "xbitinfo[example]" to example description --- README.md | 16 ++++++++++++++-- docs/ArtificialInformation_Filter.ipynb | 8 +++++++- docs/chunking.ipynb | 8 +++++++- docs/quick-start.ipynb | 14 ++++++++++---- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 73b60bd7..6bf55c9f 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,17 @@ one might choose one installation option over the other. ``` pip install xbitinfo ``` -or +We also maintain other dependency sets for different subsets of functionality: +``` +pip install "xbitinfo[viz]" # Optional dependencies for visualisation +pip install "xbitinfo[io]" # Optional dependencies for IO +``` + +For conda ``` conda install -c conda-forge xbitinfo-python ``` +the IO and visualisation dependencies are included by default. ### Installation including optional Julia backend ``` @@ -46,11 +53,16 @@ conda install -c conda-forge xbitinfo ``` or ``` -pip install xbitinfo # julia needs to be installed manually +pip install "xbitinfo[julia]" # julia needs to be installed manually ``` ## How to use +To install all dependencies needed to run this example, +``` +pip install "xbitinfo[example]" +``` +is recommended ```python import xarray as xr import xbitinfo as xb diff --git a/docs/ArtificialInformation_Filter.ipynb b/docs/ArtificialInformation_Filter.ipynb index 23c4b944..33d8c721 100644 --- a/docs/ArtificialInformation_Filter.ipynb +++ b/docs/ArtificialInformation_Filter.ipynb @@ -9,7 +9,13 @@ "\n", "In simple terms the bitinformation is retrieved by checking how variable a bit pattern is. However, this approach cannot distinguish between actual information content and artifical information content. By studying the distribution of the information content the user can often identify clear cut-offs of real information content and artificial information content.\n", "\n", - "The following example shows how such a separation of real information and artificial information can look like. To do so, artificial information is artificially added to an example dataset by applying linear quantization. Linear quantization is often applied to climate datasets (e.g. ERA5) and needs to be accounted for in order to retrieve meaningful bitinformation content. An algorithm that aims at detecting this artificial information itself is introduced." + "The following example shows how such a separation of real information and artificial information can look like. To do so, artificial information is artificially added to an example dataset by applying linear quantization. Linear quantization is often applied to climate datasets (e.g. ERA5) and needs to be accounted for in order to retrieve meaningful bitinformation content. An algorithm that aims at detecting this artificial information itself is introduced.\n", + "\n", + "To install all dependencies needed to run this example,\n", + "```\n", + "pip install \"xbitinfo[example]\"\n", + "```\n", + "is recommended " ] }, { diff --git a/docs/chunking.ipynb b/docs/chunking.ipynb index 5ced36ff..d0cd096b 100644 --- a/docs/chunking.ipynb +++ b/docs/chunking.ipynb @@ -17,7 +17,13 @@ "\n", "By default the number of bits that need to be kept (`keepbits`) to preserve the requested amount of information is determined based on the entire dataset. This approach doesn't always result in the best compression rates as it preserves too many keepbits in regions with anomalously low information density. The following steps show how the `keepbits` can be retrieved and applied on subsets. In this case, subsets are defined as dataset chunks.\n", "\n", - "This work is a result of the ECMWF Code4Earth 2023. Please have a look at the [presentation of this project](https://youtu.be/IOi4XvECpsQ?si=hwZkppNRa-J2XVZ9) for additional details." + "This work is a result of the ECMWF Code4Earth 2023. Please have a look at the [presentation of this project](https://youtu.be/IOi4XvECpsQ?si=hwZkppNRa-J2XVZ9) for additional details.\n", + "\n", + "To install all dependencies needed to run this example,\n", + "```\n", + "pip install \"xbitinfo[example]\"\n", + "```\n", + "is recommended " ] }, { diff --git a/docs/quick-start.ipynb b/docs/quick-start.ipynb index fe18d4d7..9e8c90d2 100644 --- a/docs/quick-start.ipynb +++ b/docs/quick-start.ipynb @@ -20,7 +20,13 @@ "1. Analysis of the bitwise information content of a dataset\n", "2. Decision on a threshold of real information to preserve (e.g. 99%)\n", "3. Bitround dataset accordingly (bitrounding)\n", - "4. Apply lossless compression of choice (e.g. zlib, blosc, zstd) and store the dataset" + "4. Apply lossless compression of choice (e.g. zlib, blosc, zstd) and store the dataset\n", + "\n", + "To install all dependencies needed to run this example,\n", + "```\n", + "pip install \"xbitinfo[example]\"\n", + "```\n", + "is recommended " ] }, { @@ -110,7 +116,7 @@ "id": "9a431133", "metadata": {}, "source": [ - "Without installing pooch, you will not be able to download and load the example datasets, which may result in errors or unexpected behavior." + "Without installing pooch, you will not be able to download and load the example datasets, which may result in errors or unexpected behavior. Alternatively, follow the example installation instructions above." ] }, { @@ -323,7 +329,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "xbitinfo (3.13.5)", "language": "python", "name": "python3" }, @@ -337,7 +343,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.13.5" }, "toc-autonumbering": true }, From 973c8077057de1cfea387fdd682c9368ea428370 Mon Sep 17 00:00:00 2001 From: Olivier Bonte Date: Thu, 12 Mar 2026 10:02:25 +0100 Subject: [PATCH 3/3] Add s3fs to example deps --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 03e0b74c..b82d8702 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ dependencies = [ viz = ["matplotlib<3.9.1", "cmcrameri"] io = ["netcdf4", "zarr"] julia = ["julia"] -example = ["xbitinfo[viz,io]","pooch","jupyter>=1.1"] +example = ["xbitinfo[viz,io]","pooch","jupyter>=1.1","s3fs] [dependency-groups] prefect = ["prefect>=3.3.0"]