-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Slice Explorer): adding inital version of the slice explorer
Adding Slice Explorer -- the main module in the `explorers` directory -- a driver example using python in `examples` -- a jupyter notebook demo example
- Loading branch information
Showing
5 changed files
with
635 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "503a3444-159b-4f8e-a877-dda66d4922b4", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Create an instance of a DatasetBuilder to initialize the Slice Explorer with\n", | ||
"\n", | ||
"from pan3d import DatasetBuilder\n", | ||
"builder = DatasetBuilder()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fc5f043e-00c4-4a04-8ea7-096ed987ea33", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Initialize the DatasetBuilder using an existing example configuration\n", | ||
"\n", | ||
"config_path = './example_config_xarray.json'\n", | ||
"builder.import_config(config_path)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1794f187-98bc-4c21-b390-e097bb33d10b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# New API to query the spatial extents for the data\n", | ||
"\n", | ||
"builder.extents" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a1881411-d67f-4f05-ac0b-8f8a29e5e2b9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Initialize the SliceExplorer using the configured DatasetBuilder\n", | ||
"\n", | ||
"from pan3d import SliceExplorer\n", | ||
"explorer = SliceExplorer(builder)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "105415d1-46c3-4e32-8f1d-918bc27f07fd", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Wait for the UI to render and view the Trame UI \n", | ||
"\n", | ||
"await explorer.ui.ready\n", | ||
"explorer.ui" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5a58d42e-0385-4f0a-a746-912d80cc2b9e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Interact with various properties of the SliceExplorer and watch the above Trame UI respond\n", | ||
"\n", | ||
"explorer.slice_dimension = \"level\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "530ad43e-d484-48f1-8465-9a11302b0ffe", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"explorer.slice_value = 800" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "460818e8-3b93-4258-b303-8abea84d23fe", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"explorer.view_mode = \"2D\"" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from argparse import ArgumentParser, BooleanOptionalAction | ||
|
||
from pan3d import DatasetBuilder | ||
from pan3d import SliceExplorer | ||
|
||
def serve(): | ||
parser = ArgumentParser( | ||
prog="Pan3D", | ||
description="Launch the Pan3D GeoTrame App", | ||
) | ||
|
||
parser.add_argument("--config_path") | ||
parser.add_argument("--server", action=BooleanOptionalAction) | ||
parser.add_argument("--debug", action=BooleanOptionalAction) | ||
args = parser.parse_args() | ||
|
||
builder = DatasetBuilder() | ||
builder.import_config(args.config_path) | ||
|
||
viewer = SliceExplorer(builder) | ||
viewer.start() | ||
|
||
if __name__ == "__main__": | ||
serve() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import logging | ||
from .dataset_builder import DatasetBuilder | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(logging.INFO) | ||
|
||
__version__ = "0.8.9" | ||
|
||
try: | ||
from .dataset_viewer import DatasetViewer | ||
|
||
__all__ = [DatasetBuilder, DatasetViewer] | ||
from .explorers.slice_explorer import SliceExplorer | ||
__all__ = [DatasetBuilder, DatasetViewer, SliceExplorer] | ||
except Exception: | ||
# Trame is not installed, DatasetViewer will not be accessible | ||
__all__ = [DatasetBuilder] | ||
__all__ = [DatasetBuilder] |
This file contains 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
Oops, something went wrong.