Skip to content

Commit eba4de4

Browse files
freva-xarray to xarray-prism
1 parent eee8263 commit eba4de4

12 files changed

Lines changed: 64 additions & 64 deletions

File tree

.github/workflows/release_ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
RC="${{ github.event_name == 'workflow_dispatch' && inputs.rc || '' }}"
4646
IS_PRERELEASE="false"
4747
if [ "$RC" ]; then
48-
python3 rc.py rc $RC freva_xarray -p . 1> tag.txt
48+
python3 rc.py rc $RC xarray_prism -p . 1> tag.txt
4949
IS_PRERELEASE="true"
5050
else
51-
python3 -c "exec(open('src/freva_xarray/_version.py').read()); print(__version__)" 1> tag.txt
51+
python3 -c "exec(open('src/xarray_prism/_version.py').read()); print(__version__)" 1> tag.txt
5252
fi
5353
echo "$IS_PRERELEASE" > is_prerelease.txt
5454
echo "is_prerelease=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"
@@ -116,7 +116,7 @@
116116

117117
- name: Update version for pre-release
118118
run: |
119-
sed -i "s/__version__ = .*/__version__ = \"${{ env.TAG }}\"/" src/freva_xarray/_version.py
119+
sed -i "s/__version__ = .*/__version__ = \"${{ env.TAG }}\"/" src/xarray_prism/_version.py
120120
121121
- name: Build package
122122
run: python -m build

.github/workflows/tests_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
uses: mamba-org/setup-micromamba@v1
4242
with:
4343
micromamba-version: "latest"
44-
environment-name: freva-xarray
44+
environment-name: xarray-prism
4545
cache-environment: true
4646
cache-downloads: true
4747
create-args: >-

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ and ability to register new data format and uri type for climate data.
55

66
> [!Important]
77
> If you deal with a data that `freva` engine is not able to open that, please
8-
> report the data [here](https://github.com/freva-org/freva-xarray/issues/new)
8+
> report the data [here](https://github.com/freva-org/xarray-prism/issues/new)
99
> to let us improve this engine to be able to be versitile and work with all
1010
> sort of climate data.
1111
@@ -15,13 +15,13 @@ and ability to register new data format and uri type for climate data.
1515
### Install via PyPI
1616

1717
```bash
18-
pip install freva-xarray
18+
pip install xarray-prism
1919
```
2020

2121
### Install via Conda
2222

2323
```bash
24-
conda install freva-xarray
24+
conda install xarray-prism
2525
```
2626

2727
## Quick Start
@@ -138,14 +138,14 @@ xr.open_dataset(
138138
>
139139
> Unlike Zarr or HDF5, these formats don't support partial/chunk reads over the network.
140140
>
141-
> By default, freva-xarray caches files in the system temp directory.
141+
> By default, xarray-prism caches files in the system temp directory.
142142
> This works well for most cases.
143143
> If temp storage is a concern (e.g., limited space or cleared on reboot),
144144
> you can specify a persistent cache:
145145
>
146146
> | Option | How |
147147
> |--------|-----|
148-
> | Environment variable | `export FREVA_XARRAY_CACHE=/path/to/cache` |
148+
> | Environment variable | `export xarray_prism_CACHE=/path/to/cache` |
149149
> | Per-call | `storage_options={"simplecache": {"cache_storage": "/path"}}` |
150150
> | Default | System temp directory |
151151
@@ -154,31 +154,31 @@ xr.open_dataset(
154154

155155
### Custom Format Detectors and URI Types
156156

157-
You can extend **freva-xarray** with custom *format detectors*, *URI types*, and *open handlers* by providing a small plugin package.
157+
You can extend **xarray-prism** with custom *format detectors*, *URI types*, and *open handlers* by providing a small plugin package.
158158
Registration happens **at import time**, so importing the plugin activates it.
159159

160160
### Plugin structure
161161

162162
```text
163-
freva_xarray_myplugin/
163+
xarray_prism_myplugin/
164164
__init__.py # imports the plugin module (triggers registration)
165165
plugin.py # detectors, URI types, and open handlers
166166
pyproject.toml
167167
```
168168

169169
### Plugin implementation
170170

171-
`freva_xarray_myplugin/__init__.py`
171+
`xarray_prism_myplugin/__init__.py`
172172

173173
```python
174174
from .plugin import * # noqa: F401,F403
175175
```
176176

177-
`freva_xarray_myplugin/plugin.py`
177+
`xarray_prism_myplugin/plugin.py`
178178

179179
```python
180180
import xarray as xr
181-
from freva_xarray import register_detector, register_uri_type, registry
181+
from xarray_prism import register_detector, register_uri_type, registry
182182

183183

184184
@register_uri_type(priority=100)
@@ -210,20 +210,20 @@ def open_foo_from_myfs(uri: str, **kwargs):
210210

211211
```toml
212212
[project]
213-
name = "freva-xarray-myplugin"
213+
name = "xarray-prism-myplugin"
214214
version = "0.1.0"
215-
dependencies = ["freva-xarray"]
215+
dependencies = ["xarray-prism"]
216216

217-
[project.entry-points."freva_xarray.plugins"]
218-
myplugin = "freva_xarray_myplugin"
217+
[project.entry-points."xarray_prism.plugins"]
218+
myplugin = "xarray_prism_myplugin"
219219
```
220220

221221
### Using the plugin
222222

223223
After installing the plugin package, **import it once** to activate the registrations:
224224

225225
```python
226-
import freva_xarray_myplugin # activates detectors and handlers
226+
import xarray_prism_myplugin # activates detectors and handlers
227227

228228
import xarray as xr
229229
ds = xr.open_dataset("myfs://bucket/path/data.foo", engine="freva")
@@ -239,8 +239,8 @@ ds = xr.open_dataset("myfs://bucket/path/data.foo", engine="freva")
239239
docker-compose -f dev-env/docker-compose.yaml up -d --remove-orphans
240240

241241
# Create conda environment
242-
conda create -n freva-xarray python=3.12 -y
243-
conda activate freva-xarray
242+
conda create -n xarray-prism python=3.12 -y
243+
conda activate xarray-prism
244244

245245
# Install package in editable mode with dev dependencies
246246
pip install -e ".[dev]"

dev-env/docker-compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33

44
minio:
55
networks:
6-
- freva-xarray
6+
- xarray-prism
77
image: quay.io/minio/minio
88
hostname: minio
99
environment:
@@ -21,7 +21,7 @@ services:
2121

2222
setup-minio:
2323
networks:
24-
- freva-xarray
24+
- xarray-prism
2525
image: quay.io/minio/mc
2626
environment:
2727
MINIO_ROOT_USER: minioadmin
@@ -46,5 +46,5 @@ services:
4646
- ./thredds/content/catalog.xml:/usr/local/tomcat/content/thredds/catalog.xml
4747
- ../data:/data:ro
4848
networks:
49-
freva-xarray:
49+
xarray-prism:
5050
driver: bridge

pyproject.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name = "freva-xarray"
6+
name = "xarray-prism"
77
dynamic = ["version"]
88
description = "A multi-format and multi-storage xarray engine with automatic engine detection, and ability to register new data format and uri type for climate data."
99
readme = "README.md"
@@ -50,19 +50,19 @@ dev = [
5050
]
5151

5252
[project.urls]
53-
Issues = "https://github.com/freva-org/freva-xarray/issues"
54-
Source = "https://github.com/freva-org/freva-xarray/"
53+
Issues = "https://github.com/freva-org/xarray-prism/issues"
54+
Source = "https://github.com/freva-org/xarray-prism/"
5555

5656
# IMPORTANT: Register as xarray backend, auto-discovered by xarray
5757
[project.entry-points."xarray.backends"]
58-
freva = "freva_xarray.entrypoint:FrevaBackendEntrypoint"
58+
freva = "xarray_prism.entrypoint:FrevaBackendEntrypoint"
5959
[tool.codespell]
6060
ignore-words-list = "iterm"
6161
[tool.setuptools.dynamic]
62-
version = {attr = "freva_xarray._version.__version__"}
62+
version = {attr = "xarray_prism._version.__version__"}
6363
[tool.setuptools.packages.find]
6464
where = ["src"]
65-
include = ["freva_xarray*"]
65+
include = ["xarray_prism*"]
6666

6767
[tool.pytest.ini_options]
6868
testpaths = ["tests"]
@@ -84,7 +84,7 @@ python_version = "3.10"
8484
warn_return_any = true
8585
warn_unused_configs = true
8686
ignore_missing_imports = true
87-
files = "src/freva_xarray"
87+
files = "src/xarray_prism"
8888
strict = false
8989
follow_imports = "silent"
9090

@@ -95,7 +95,7 @@ target-version = ["py39", "py310", "py311", "py312", "py313", "py314"]
9595
[tool.isort]
9696
profile = "black"
9797
line_length = 88
98-
known_first_party = ["freva_xarray"]
98+
known_first_party = ["xarray_prism"]
9999

100100
[tool.flake8]
101101
ignore = ["F405", "F403", "E704", "W503", "C901"]
@@ -140,7 +140,7 @@ deps =
140140
-e .[dev]
141141
pytest-env
142142
commands =
143-
python3 -m pytest -vv --cov=freva_xarray --cov-report=html:coverage_report --cov-report=xml --junitxml=report.xml tests/ {posargs}
143+
python3 -m pytest -vv --cov=xarray_prism --cov-report=html:coverage_report --cov-report=xml --junitxml=report.xml tests/ {posargs}
144144
python3 -m coverage report --fail-under=80 --precision=2
145145
146146
[testenv:lint]
@@ -152,10 +152,10 @@ deps =
152152
flake8
153153
codespell
154154
commands =
155-
python3 -m isort --check --profile black -t py39 -l 88 src/freva_xarray
156-
python3 -m black --check src/freva_xarray tests
157-
python3 -m flake8 src/freva_xarray --count --max-complexity=10 --ignore=F405,F403,E704,W503,C901 --max-line-length=88 --statistics --show-source
158-
codespell --quiet-level=2 src/freva_xarray
155+
python3 -m isort --check --profile black -t py39 -l 88 src/xarray_prism
156+
python3 -m black --check src/xarray_prism tests
157+
python3 -m flake8 src/xarray_prism --count --max-complexity=10 --ignore=F405,F403,E704,W503,C901 --max-line-length=88 --statistics --show-source
158+
codespell --quiet-level=2 src/xarray_prism
159159
160160
[testenv:types]
161161
description = "Static type checking."
@@ -164,16 +164,16 @@ deps =
164164
mypy
165165
types-setuptools
166166
commands =
167-
python3 -m mypy src/freva_xarray --ignore-missing-imports
167+
python3 -m mypy src/xarray_prism --ignore-missing-imports
168168
169169
[testenv:format]
170170
description = "Auto-format code."
171171
deps =
172172
black
173173
isort
174174
commands =
175-
python3 -m isort --profile black -t py39 -l 88 src/freva_xarray tests
176-
python3 -m black src/freva_xarray tests
175+
python3 -m isort --profile black -t py39 -l 88 src/xarray_prism tests
176+
python3 -m black src/xarray_prism tests
177177
178178
[testenv:release]
179179
description = "Tag a new release."
@@ -183,7 +183,7 @@ deps =
183183
requests
184184
tomli
185185
commands =
186-
python3 bump.py tag freva_xarray -p .
186+
python3 bump.py tag xarray_prism -p .
187187
allowlist_externals =
188188
rm
189189
curl
@@ -200,7 +200,7 @@ deps =
200200
requests
201201
tomli
202202
commands =
203-
python3 bump.py deploy freva_xarray -p .
203+
python3 bump.py deploy xarray_prism -p .
204204
allowlist_externals =
205205
rm
206206
curl

src/freva_xarray/_registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Registry for custom backends for freva_xarray."""
1+
"""Registry for custom backends for xarray_prism."""
22

33
from __future__ import annotations
44

src/freva_xarray/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
"""Version information for freva-xarray."""
1+
"""Version information for xarray-prism."""
22

33
__version__ = "2512.0.14"

src/freva_xarray/backends/cloud.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
def _get_cache_dir(storage_options: Optional[Dict] = None) -> Path:
2020
"""Get cache directory."""
21-
env_cache = os.environ.get("FREVA_XARRAY_CACHE")
21+
env_cache = os.environ.get("XARRAY_PRISM_CACHE")
2222
# 1. Environment variable
2323
if env_cache:
2424
cache_root = Path(env_cache)
@@ -32,7 +32,7 @@ def _get_cache_dir(storage_options: Optional[Dict] = None) -> Path:
3232
cache_root.mkdir(parents=True, exist_ok=True)
3333
return cache_root
3434
# 3. Default temp directory
35-
cache_root = Path(tempfile.gettempdir()) / "freva-xarray-cache"
35+
cache_root = Path(tempfile.gettempdir()) / "xarray-prism-cache"
3636
cache_root.mkdir(parents=True, exist_ok=True)
3737
return cache_root
3838

src/freva_xarray/entrypoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class FrevaBackendEntrypoint(BackendEntrypoint):
7373
"and entrypoint registry for new formats and URI types."
7474
)
7575

76-
url = "https://github.com/freva-org/freva-xarray"
76+
url = "https://github.com/freva-org/xarray-prism"
7777
open_dataset_parameters = ("filename_or_obj", "drop_variables")
7878

7979
ENGINE_MAP: Dict[str, str] = {

tests/test_backends.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99
import xarray as xr
1010

11-
from freva_xarray.backends import open_cloud, open_posix
11+
from xarray_prism.backends import open_cloud, open_posix
1212

1313

1414
class TestPosixBackend:
@@ -106,7 +106,7 @@ def test_open_netcdf_from_s3(self, s3_env: dict):
106106
def test_open_grib_from_s3_with_cache(self, s3_env: dict, temp_cache_dir: Path):
107107
"""Open a GRIB file from S3 with local caching."""
108108
uri = "s3://testdata/test.grib2"
109-
os.environ["FREVA_XARRAY_CACHE"] = str(temp_cache_dir)
109+
os.environ["xarray_prism_CACHE"] = str(temp_cache_dir)
110110

111111
try:
112112
ds = open_cloud(
@@ -128,7 +128,7 @@ def test_open_grib_from_s3_with_cache(self, s3_env: dict, temp_cache_dir: Path):
128128
pytest.skip(f"S3/cfgrib setup issue: {e}")
129129
raise
130130
finally:
131-
os.environ.pop("FREVA_XARRAY_CACHE", None)
131+
os.environ.pop("xarray_prism_CACHE", None)
132132

133133
@pytest.mark.requires_minio
134134
def test_open_geotiff_from_s3(self, s3_env: dict):
@@ -172,18 +172,18 @@ class TestCacheConfiguration:
172172

173173
def test_cache_dir_from_env(self, temp_cache_dir: Path):
174174
"""Cache directory should be configurable via environment."""
175-
from freva_xarray.backends.cloud import _get_cache_dir
175+
from xarray_prism.backends.cloud import _get_cache_dir
176176

177-
os.environ["FREVA_XARRAY_CACHE"] = str(temp_cache_dir)
177+
os.environ["xarray_prism_CACHE"] = str(temp_cache_dir)
178178
try:
179179
cache_dir = _get_cache_dir()
180180
assert cache_dir == temp_cache_dir
181181
finally:
182-
os.environ.pop("FREVA_XARRAY_CACHE", None)
182+
os.environ.pop("xarray_prism_CACHE", None)
183183

184184
def test_cache_dir_from_storage_options(self, temp_cache_dir: Path):
185185
"""Cache directory should be configurable via storage_options."""
186-
from freva_xarray.backends.cloud import _get_cache_dir
186+
from xarray_prism.backends.cloud import _get_cache_dir
187187

188188
storage_options = {
189189
"simplecache": {"cache_storage": str(temp_cache_dir)},
@@ -193,11 +193,11 @@ def test_cache_dir_from_storage_options(self, temp_cache_dir: Path):
193193

194194
def test_cache_dir_default(self):
195195
"""Default cache should be in temp directory."""
196-
from freva_xarray.backends.cloud import _get_cache_dir
196+
from xarray_prism.backends.cloud import _get_cache_dir
197197
import tempfile
198198

199-
os.environ.pop("FREVA_XARRAY_CACHE", None)
199+
os.environ.pop("xarray_prism_CACHE", None)
200200

201201
cache_dir = _get_cache_dir()
202202
assert cache_dir.parent == Path(tempfile.gettempdir())
203-
assert "freva-xarray-cache" in str(cache_dir)
203+
assert "xarray-prism-cache" in str(cache_dir)

0 commit comments

Comments
 (0)