https://github.com/benjaminleighton/xarrayfrac
example custom xarray backend that dynamically generates mandelbrot fractals
https://github.com/benjaminleighton/xarrayfrac
custom-backend dask fractal mandelbrot xarray
Last synced: about 2 months ago
JSON representation
example custom xarray backend that dynamically generates mandelbrot fractals
- Host: GitHub
- URL: https://github.com/benjaminleighton/xarrayfrac
- Owner: benjaminleighton
- License: other
- Created: 2022-01-08T10:46:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-18T04:35:55.000Z (over 3 years ago)
- Last Synced: 2025-03-27T18:51:31.765Z (3 months ago)
- Topics: custom-backend, dask, fractal, mandelbrot, xarray
- Language: Jupyter Notebook
- Homepage:
- Size: 254 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README

# xarrayfracA dynamic generative mandelbrot custom backend for xarray
```
pip install xarrayfrac
``````
import numpy as np
import xarray as xr
from matplotlib import pyplot as plt# request a 10 billion pixel lazy xarray fractal
ds = xr.open_dataset(None, engine="xarrayfrac", resolution=100000, chunks={"x": 2000, "y": 2000})
# sample 1 in every 10000 pixels
sampled = ds.frac.isel(x=slice(0, 100000, 100), y=slice(0, 100000, 100))
# compute and display
plt.imshow(sampled)
```
```
# request a 10 billion pixel lazy xarray fractal
ds = xr.open_dataset(None, engine="xarrayfrac", resolution=100000, chunks={"x": 2000, "y": 2000})
# zoom
window = ds.sel(x=slice(-0.1, 0.1), y=slice(0.9, 1.0))
# plot every hundredth pixel of the window
plt.imshow(window.frac[::10, ::10])
```