{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## The new intake GUI - built with panel\n", "\n", "It is often useful to explore catalog data using a Graphical User Interface. The previous iteration of the intake GUI was built in ipywidgets - which limited you to use from within the notebook. The new version is implemented in [panel](https://panel.pyviz.org) which means that in addition to rendering in the notebook - it also can easily be served and deployed as a tornado application. \n", "\n", "\n", "**NOTE:** This work depends on the latest released versions of panel and bokeh" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import intake" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The intake GUI is composed of various sub-panels that can be opened and closed using control buttons. Try clicking the + button to get started. With that pane open, navigate to a catalog of interest and click the \"Add Catalog\" button." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "intake.gui" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The \"Add Catalog\" mechanism is also exposed through the API:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "intake.gui.add('./us_crime/us_crime.yaml')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Try loading remote catalogs available at: \n", " - https://s3.amazonaws.com/earth-data/UCMerced_LandUse/catalog.yml\n", " - https://raw.githubusercontent.com/ContinuumIO/anaconda-package-data/master/catalog/anaconda_package_data.yaml\n", " - https://raw.githubusercontent.com/pangeo-data/pangeo-datastore/master/intake-catalogs/master.yaml" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Once you have selected from the \"Sources\" pane, that selection can be found at `intake.gui.sources`:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "intake.gui.sources" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This consists of a list of regular intake data source entries. Let's look at the first one:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "source = intake.gui.source_instance\n", "source.to_dask().head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also look at the GUI just for that source:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "source.gui" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "OR you can get just one sub-panel from the gui and work with that directly:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "intake.gui.source.description" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also initialize a gui straight from a catalog to jump directly into the part of the gui that deals with selecting and viewing entries. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cat = intake.open_catalog('./us_crime/us_crime.yaml')\n", "cat.gui" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `cat.gui` also exposes the list of selected sources on the `sources` attribute." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "us_crime = cat.gui.sources[0]\n", "us_crime.gui" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is just a source entry that can be loaded, read, and plotted. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "intake.output_notebook()\n", "\n", "us_crime = us_crime() # load CatalogEntry into Source object\n", "us_crime.plot.bivariate('Burglary rate', 'Property crime rate', legend=False, width=500, height=400) * \\\n", "us_crime.plot.scatter( 'Burglary rate', 'Property crime rate', color='black', size=15, legend=False) +\\\n", "us_crime.plot.table(['Burglary rate', 'Property crime rate'], width=350, height=350)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Future Work\n", "\n", "There are many plans for how this GUI could be expanded. In the near future, we anticipate adding a mechanism for inputting user parameters, adding some basic custom plotting, and allowing the editing and saving of catalogs. See [GH#225](https://github.com/intake/intake/issues/225) for a full discussion of the plan." ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }