This commit is contained in:
Florent Guiotte 2021-03-10 15:13:24 +01:00
parent ff78742113
commit 6948386ad9

View File

@ -460,13 +460,13 @@
},
{
"cell_type": "code",
"execution_count": 92,
"execution_count": 99,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8dc0bfb8a4b047c79e40f7d6bb2aaa83",
"model_id": "66018424ba894f8d89736b36481ef5f3",
"version_major": 2,
"version_minor": 0
},
@ -476,53 +476,6 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Traceback (most recent call last):\n",
" File \"/usr/lib/python3.9/site-packages/matplotlib/cbook/__init__.py\", line 224, in process\n",
" func(*args, **kwargs)\n",
" File \"/usr/lib/python3.9/site-packages/matplotlib/widgets.py\", line 1555, in release\n",
" self._release(event)\n",
" File \"/usr/lib/python3.9/site-packages/matplotlib/widgets.py\", line 2112, in _release\n",
" self.onselect(self.eventpress, self.eventrelease)\n",
" File \"<ipython-input-90-109bd0669182>\", line 27, in line_select_callback\n",
" filter_dtm()\n",
" File \"<ipython-input-90-109bd0669182>\", line 86, in filter_dtm\n",
" X = t.get_attribute(model['x'])\n",
" File \"/home/florent/.local/lib/python3.9/site-packages/sap/trees.py\", line 288, in get_attribute\n",
" compute = getattr(hg, 'attribute_' + attribute_name)\n",
"TypeError: can only concatenate str (not \"Dropdown\") to str\n",
"<ipython-input-90-109bd0669182>:30: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.\n",
"Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\n",
" model['dtm_y1'], model['dtm_x1'] = np.int(eclick.xdata), np.int(eclick.ydata)\n",
"<ipython-input-90-109bd0669182>:31: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.\n",
"Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\n",
" model['dtm_y2'], model['dtm_x2'] = np.int(erelease.xdata), np.int(erelease.ydata)\n",
"<ipython-input-90-109bd0669182>:37: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.\n",
"Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\n",
" pmask = np.zeros_like(model['im'], dtype=np.bool)\n",
"Traceback (most recent call last):\n",
" File \"/usr/lib/python3.9/site-packages/matplotlib/cbook/__init__.py\", line 224, in process\n",
" func(*args, **kwargs)\n",
" File \"/usr/lib/python3.9/site-packages/matplotlib/widgets.py\", line 1555, in release\n",
" self._release(event)\n",
" File \"/usr/lib/python3.9/site-packages/matplotlib/widgets.py\", line 2112, in _release\n",
" self.onselect(self.eventpress, self.eventrelease)\n",
" File \"<ipython-input-90-109bd0669182>\", line 32, in dtm_select_callback\n",
" filter_nodes()\n",
" File \"<ipython-input-90-109bd0669182>\", line 41, in filter_nodes\n",
" show_spectrum()\n",
" File \"<ipython-input-90-109bd0669182>\", line 49, in show_spectrum\n",
" ps = sap.spectrum2d(model['tree_cache'], x, y, 200, 100, x_log, y_log)\n",
" File \"/home/florent/.local/lib/python3.9/site-packages/sap/spectra.py\", line 160, in spectrum2d\n",
" x = tree.get_attribute(x_attribute)\n",
" File \"/home/florent/.local/lib/python3.9/site-packages/sap/trees.py\", line 288, in get_attribute\n",
" compute = getattr(hg, 'attribute_' + attribute_name)\n",
"TypeError: can only concatenate str (not \"Dropdown\") to str\n"
]
}
],
"source": [
@ -533,6 +486,11 @@
"\n",
"model['x'] = ipw.Dropdown(description='Attribute X', options=sap.available_attributes().keys())\n",
"model['y'] = ipw.Dropdown(description='Attribute Y', options=sap.available_attributes().keys())\n",
"model['x_log'] = ipw.Checkbox(description='X log')\n",
"model['y_log'] = ipw.Checkbox(description='Y log')\n",
"model['overlay'] = ipw.Checkbox(description='Filtering overlay')\n",
"model['highlight'] = ipw.Checkbox(description='Spectrum higlight')\n",
"\n",
"\n",
"def load_change(change):\n",
" print('Loading tile...')\n",
@ -552,71 +510,12 @@
"\n",
"ipw.VBox([\n",
" ipw.HBox([model['tile_name'], model['lidar_feature'], model['tree_type'] , load_button]),\n",
" ipw.HBox([model['x'], model['y']])\n",
" ipw.HBox([model['x'], model['x_log']]),\n",
" ipw.HBox([model['y'], model['y_log']]),\n",
" model['highlight'],\n",
" model['overlay']\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {},
"outputs": [],
"source": [
"tree_type.value = sap.trees.MinTree"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'ndsm'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lidar_feature.value"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"def feature_change(change):\n",
" print(feature)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"<ipython-input-18-012395bc2283>:1: DeprecationWarning: on_trait_change is deprecated in traitlets 4.1: use observe instead\n",
" lidar_feature.on_trait_change(ld)\n"
]
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {