Created
August 17, 2021 22:42
-
-
Save tommylees112/9838c79a5a9e455b2d71926af0c19510 to your computer and use it in GitHub Desktop.
Open xarray image in napari
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import napari | |
import xarray as xr | |
from pathlib import Path | |
data_dir = Path("/path/to/data") | |
# open data | |
ds = xr.open_dataset(data_dir / "data.nc") | |
da = ds["VARIABLE_NAME"] | |
# initialise viewer and view | |
viewer = napari.Viewer() | |
new_layer = viewer.add_image(da, colormap="magma") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment