Raw File
interactivetool_climate_notebook.xml
<tool id="interactive_tool_climate_notebook" tool_type="interactive" name="Interactive Climate Notebook" version="0.4" profile="22.01">
    <requirements>
        <container type="docker">quay.io/nordicesmhub/docker-climate-notebook:2021-03-18</container>
    </requirements>
    <entry_points>
        <entry_point name="Climate Interactive Tool" requires_domain="True">
            <port>8888</port>
            <url>ipython/lab</url>
        </entry_point>
    </entry_points>
    <environment_variables>
        <environment_variable name="HISTORY_ID">$__history_id__</environment_variable>
        <environment_variable name="REMOTE_HOST">$__galaxy_url__</environment_variable>
        <environment_variable name="GALAXY_WEB_PORT">8080</environment_variable>
        <environment_variable name="GALAXY_URL">$__galaxy_url__</environment_variable>
        <environment_variable name="API_KEY" inject="api_key" />
    </environment_variables>
    <command><![CDATA[
        #import re
        export GALAXY_WORKING_DIR=`pwd` &&
        mkdir -p ./jupyter/outputs/ &&
        mkdir -p ./jupyter/data &&

        #if $input:
            #set $cleaned_name = re.sub('[^\w\-\.]', '_', str($input.element_identifier))
            get -t hid -i '${input.hid}' &&
            ln -sf '/import/${input.hid}' './jupyter/data/${cleaned_name}' &&
        #end if

        ## change into the directory where the notebooks are located
        cd ./jupyter/ &&
        export HOME=/home/jovyan/ &&
        export PATH=/home/jovyan/.local/bin:\$PATH &&

        #if $mode.mode_select == 'scratch':
            ## copy default notebook
            cp '$__tool_directory__/default_notebook.ipynb' ./ipython_galaxy_notebook.ipynb &&
            jupyter trust ./ipython_galaxy_notebook.ipynb &&
            jupyter lab --allow-root --no-browser --NotebookApp.shutdown_button=True &&
            cp ./ipython_galaxy_notebook.ipynb '$jupyter_notebook'

        #else:
            #set $cleaned_name = re.sub('[^\w\-\.]', '_', str($mode.ipynb.element_identifier))
            get -t hid -i '${mode.ipynb.hid}' &&
            ln -sf '/import/${mode.ipynb.hid}' './data/${cleaned_name}' &&
            jupyter trust ./data/${cleaned_name} &&

            #if $mode.run_it:
                jupyter nbconvert --to notebook --execute --output ./ipython_galaxy_notebook.ipynb --allow-errors  ./*.ipynb &&
            #else:
                jupyter lab --allow-root --no-browser --NotebookApp.shutdown_button=True &&
            #end if
            cp ./ipython_galaxy_notebook.ipynb '$jupyter_notebook'
        #end if

    ]]>
    </command>
    <inputs>

        <conditional name="mode">
            <param name="mode_select" type="select" label="Do you already have a notebook?" help="If not, no problem we will provide you with a default one.">
                <option value="scratch">Start with a fresh notebook</option>
                <option value="previous">Load a previous notebook</option>
            </param>
            <when value="scratch"/>
            <when value="previous">
                <param name="ipynb" type="data" format="ipynb" label="IPython Notebook"/>
                <param name="run_it" type="boolean" truevalue="true" falsevalue="false" label="Execute notebook and return a new one."
                    help="This option is useful in workflows when you just want to execute a notebook and not dive into the webfrontend."/>
            </when>
        </conditional>
        <param name="input" type="data" optional="true" label="Include data into the environment"/>

    </inputs>
    <outputs>
        <data name="jupyter_notebook" format="ipynb" label="Executed Climate Notebook"></data>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="mode" value="previous" />
            <param name="ipynb" value="test.ipynb" />
            <param name="run_it" value="true" />
            <output name="jupyter_notebook" file="test.ipynb" ftype="ipynb"/>
        </test>
    </tests>
    <help>
    The Climate Notebook is based on Jupyter an open-source web application that allows you to create and share documents that contain live code, equations,
    visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization,
    machine learning, and much more.

    Galaxy offers you to use Jupyter Notebooks directly in Galaxy accessing and interacting with Galaxy datasets as you like. A very common use-case is to
    do the heavy lifting and data reduction steps in Galaxy and the plotting and more `interactive` part on smaller datasets in Jupyter.

    You can start with a new Jupyter notebook from scratch or load an already existing one, e.g. from your collegue and execute it on your dataset.
    If you have a defined input dataset you can even execute a Jupyter notebook in a workflow, given that the notebook is writing the output back to the history.

    You can import data into the notebook via a predefined `get()` function and write results back to Galaxy with a `put()` function.

    The Climate version of the Jupyter Notebook offers a lot of preinstalled tools for climate science. The list of packages is based on what is available
	on the [Pangeo](http://pangeo.io/) platform and [Pangeo stacks](https://pangeo-data.github.io/pangeo-stacks/).

    - **Core scipy packages**: numpy, scipy, matplotlib, pandas, xarray, sparse and sympy
    - **Data science**: scikit-image, scikit-learn, dask-ml, tensorflow, keras, pytorch-cpu, dask_labextension
    - **Visualization**: holoviews, panel, geoviews, hvplot, geoviews, datashader, seaborn, altair, descartes, folium, vega,
	                     vega_datasets, palettable, cmocean,plotly, psy-maps, psy-reg, psyplot, psyplot-gui, psy-maps, psy-reg,
						 geopy, branca
	- **Geospatial**: iris, cartopy, basemap, basemap-data-hires, geopandas, rasterio, netcdf4, erddapy, pydap, h5py, h5netcdf, regionmask and rio-cogeo
    - **Geoscience related**: climlab, metpy, satpy, gsw, eofs, esmpy, xesmf, windspharm, rasterstats, geojsoncontour
	- **Climate related**: pyaerocom, cdo, cdsapi, cfgrib, cis. esmvaltool, nc-time-axis, nco
	- **Intake related**: intake, intake-xarray, intake-esm, fsspec and intake-stac
    - **zarr related**: zarr, numcodecs, python-blosc, lz4, gcsfs, s3fs, tiledb-py
    - **jupyter related**: ipyleaflet, papermill, jupytext, ipydatawidgets, sidecar
    - **xarray related**: xgcm, xrft, xhistogram, xlrd, xrviz, climpred, pytide, pyinterp
    - **misc**: python-wget, prefect, requests, pillow, pip, nbgitpuller, pysplit, biopython, bioblend and galaxy-ie-helpers

    </help>
</tool>
back to top