Version: dev

data_dir

Stable function · Cache

Tier: stable · Kind: function · Topic: Cache

PythonJuliaRust
resolve_cache_rootdatadirdata_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).

Source

Example (data_dir)

root = earthsciio.resolve_cache_root(cache_root)
assert Path(root) == cache_root

From docs/api/examples/python/fetch.py

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).

Source

Example (data_dir)

@assert datadir() isa String

From docs/api/examples/julia/fetch.jl

Rust

pub fn data_dir() -> PathBuf

Resolve the cache root $EARTHSCIDATADIR.

EARTHSCIDATADIR wins when set and non-empty; otherwise /scratch.local/$USER/earthsci-cache.

Source · Rust docs

Example (data_dir)

assert!(!earthsciio::data_dir().as_os_str().is_empty());

From docs/api/examples/rust/fetch.rs