Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions docs/guides/handedness.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ scale for each layer. This is good enough for many cases, but it sub-par when
the data coordinates have an absolute correspondence to physical space — as is
the case for latitude and longitude, for example:

```{code-cell} python
---
tags: [hide-input]
---
# function to convert xarray metadata to napari layer metadata
def get_scale_translate(dataset, array_name):
array = getattr(dataset, array_name)
dims = [getattr(dataset, dim) for dim in array.dims]
translate = [float(d[0]) for d in dims]
scale = [float(d[1] - d[0]) for d in dims]
return {'scale': scale, 'translate': translate}
```

```{code-cell} python
import napari
import xarray as xr
Expand All @@ -58,10 +45,8 @@ sst = xr.tutorial.open_dataset('ersstv5')
viewer, sst_layer = napari.imshow(
sst.sst,
name='sea surface temp',
**get_scale_translate(sst, 'sst'),
colormap='magma',
)
viewer.dims.axis_labels = sst.sst.dims
viewer.scene.overlays.axes.visible = True
```

Expand Down
Loading