{ "cells": [ { "cell_type": "markdown", "id": "96c4d52c-3704-474c-baaa-8feb0fa019ab", "metadata": {}, "source": [ "# Inspecting the File content\n", "\n", "To get an overview of the file content, a tree-view representation is provided. It can be called using `.dump()`. This, however, is only possible in notebooks. Outside of it (e.g. in a normal python console) call `.sdump()` (string-dump) to get a \"raw\", non-interactive, tree view.\n", "\n", "However, we are in a notebook environment here, so let's use `dump()`:" ] }, { "cell_type": "code", "execution_count": 1, "id": "d0f77ed6-6668-41b2-9ceb-8487e7141cc5", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Failed to import module h5tbx\n" ] }, { "data": { "text/html": [ "\n", "
\n", "\n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import h5rdmtoolbox as h5tbx\n", "from h5rdmtoolbox import tutorial\n", "\n", "# get some example files:\n", "list_of_hdf_filenames = tutorial.Database.generate_test_files()\n", "\n", "# dump the content of the first file in the list:\n", "with h5tbx.File(list_of_hdf_filenames[0]) as h5:\n", " h5.dump()" ] }, { "cell_type": "markdown", "id": "baa082a3-77b9-4665-8131-bcf7843d5469", "metadata": {}, "source": [ "## User-defined representation\n", "\n", "Every convention that is selected may have a different way of displaying the content. For the built-in convention \"h5tbx\", the attribute \"units\" is put in square brackets behind the dataset name and thus is not listed as an attribute:" ] }, { "cell_type": "code", "execution_count": 2, "id": "ea58d4b0-6820-4665-a4a3-874240410159", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "\n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "h5tbx.use('h5tbx')\n", "\n", "with h5tbx.File(list_of_hdf_filenames[0]) as h5:\n", " h5.dump()" ] } ], "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.8.19" } }, "nbformat": 4, "nbformat_minor": 5 }