data_dir
Stable function · Cache
Tier: stable · Kind: function · Topic: Cache
| Python | Julia | Rust |
|---|---|---|
resolve_cache_root | datadir | data_dir |
Python
resolve_cache_root(explicit: Optional[os.PathLike] = None) -> pathlib.Path
Resolve the cache root directory.
Precedence: an explicit argument, then $EARTHSCIDATADIR, then the
/scratch.local default. The environment variable always wins over the
default — only an explicit in-process argument overrides it (used by tests
and by callers that point at, e.g., the conformance corpus).
Example (data_dir)
root = earthsciio.resolve_cache_root(cache_root)
assert Path(root) == cache_root
Julia
datadir()
datadir() -> String
Resolve $EARTHSCIDATADIR (spec/cache-format.md §5). The env var always wins;
the fallback default lives on /scratch.local, NEVER /u (the home inode quota
cannot absorb many small NetCDF slices — a hard rule).
Example (data_dir)
@assert datadir() isa String
Rust
pub fn data_dir() -> PathBuf
Resolve the cache root $EARTHSCIDATADIR.
EARTHSCIDATADIR wins when set and non-empty; otherwise
/scratch.local/$USER/earthsci-cache.
Example (data_dir)
assert!(!earthsciio::data_dir().as_os_str().is_empty());