https://github.com/ianhi/maybe-compute
Avoid recomputing xarray datasets
https://github.com/ianhi/maybe-compute
Last synced: 4 days ago
JSON representation
Avoid recomputing xarray datasets
- Host: GitHub
- URL: https://github.com/ianhi/maybe-compute
- Owner: ianhi
- License: other
- Created: 2021-08-05T19:31:47.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-07T20:35:20.000Z (7 days ago)
- Last Synced: 2025-07-07T23:30:46.217Z (7 days ago)
- Language: Python
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# maybe-compute
[](https://github.com/ianhi/maybe-compute/raw/master/LICENSE)
[](https://pypi.org/project/maybe-compute)
[](https://python.org)
[](https://github.com/ianhi/maybe-compute/actions)
[](https://codecov.io/gh/ianhi/maybe-compute)to disk caching of computationally intensive functions.
I think this may be a bad idea - probably don't use this. But if you want to then use it like this:
```python
from maybe_compute import maybe_compute, set_maybe_compute_folder
import xarray as xr
import numpy as npdef dataset_maker(a, b):
"this docstring shows thanks to functools.wraps!"
return xr.Dataset({"images":xr.DataArray(np.random.randn(10,20)*a +b, dims=('a','b'))})set_maybe_compute_folder('sign-flip-cartoon')
maybe_compute(dataset_maker, 'yikes.nc')(4,5)```
## Install
```bash
pip install git+https://github.com/ianhi/maybe-compute
```