Skip to content

Commit 0d2f288

Browse files
committed
add TESSERA_DATA_DIR to override cache location
1 parent c177c0a commit 0d2f288

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,31 @@ GeoTessera provides access to geospatial embeddings from the [Tessera foundation
2525
pip install git+https://github.com/ucam-eo/geotessera
2626
```
2727

28+
## Configuration
29+
30+
GeoTessera automatically caches downloaded data to improve performance. By default, files are cached in the system's default cache directory (`~/.cache/geotessera` on Unix-like systems).
31+
32+
### Custom Cache Directory
33+
34+
You can customize the cache location using the `TESSERA_DATA_DIR` environment variable:
35+
36+
```bash
37+
# Set custom cache directory
38+
export TESSERA_DATA_DIR=/path/to/your/cache/directory
39+
40+
# Or set for a single command
41+
TESSERA_DATA_DIR=/tmp/tessera geotessera info
42+
```
43+
44+
You can also specify the cache directory programmatically:
45+
46+
```python
47+
from geotessera import GeoTessera
48+
49+
# Use custom cache directory
50+
tessera = GeoTessera(cache_dir="/path/to/your/cache")
51+
```
52+
2853
## Usage
2954

3055
### Command Line Interface

geotessera/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def _initialize_pooch(self):
9696
base_url=f"{TESSERA_BASE_URL}/{self.version}/global_0.1_degree_representation/",
9797
version=self.version,
9898
registry=None,
99+
env="TESSERA_DATA_DIR",
99100
)
100101

101102
# Registry files will be loaded lazily when needed
@@ -110,6 +111,7 @@ def _initialize_pooch(self):
110111
base_url=f"{TESSERA_BASE_URL}/{self.version}/global_0.1_degree_tiff_all/",
111112
version=self.version,
112113
registry=None,
114+
env="TESSERA_DATA_DIR", # CR:avsm FIXME this should be a separate subdir
113115
)
114116

115117
# Load land mask registry dynamically

0 commit comments

Comments
 (0)