diff --git a/doc/jupyter/JsonClass.ipynb b/doc/jupyter/JsonClass.ipynb deleted file mode 100644 index 699c2cd99..000000000 --- a/doc/jupyter/JsonClass.ipynb +++ /dev/null @@ -1,764 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "PMP Json Formatted I/O\n", - "======================\n", - "\n", - "# Reading in PMP's json files\n", - "\n", - "This section will sohw how to read in json files generated by PMP and select pieces of it.\n", - "\n", - "We are assuming you're running this notebook from its directory in the [pcmdi_metrics](https://github.com/pcmdi/pcmdi_metrics) repo\n" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/1Tb/miniconda3/envs/nightly/lib/python3.6/site-packages/dask/config.py:168: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.\n", - " data = yaml.load(f.read()) or {}\n", - "/1Tb/miniconda3/envs/nightly/lib/python3.6/site-packages/distributed/config.py:20: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.\n", - " defaults = yaml.load(f)\n" - ] - } - ], - "source": [ - "# Setup the notebook\n", - "from __future__ import print_function\n", - "import pcmdi_metrics\n", - "json1 = \"../../tests/pcmdi_install_test_results/metrics_results/installationTest/tas_2.5x2.5_regrid2_linear_metrics.json\"\n", - "json2 = \"../../tests/pcmdi_install_test_results/metrics_results/installationTest/tos_2.5x2.5_esmf_linear_metrics_2.json\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Reader object\n", - "\n", - "Let's create our Json reader object by pointing it to the desired files" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "J1 = pcmdi_metrics.io.base.JSONs([json1, json2])" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Querying the reader object\n", - "\n", - "Let's query the object, first what are the axes available?\n", - "i.e what is the overall json structure of the files read in" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['variable', 'model', 'reference', 'rip', 'region', 'statistic', 'season']" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "J1.getAxisIds()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Now we get a little more info by getting the actual cdms2 axes that would be generated by reading everything in.\n", - "\n", - "Note now that the axes length include the **total** possible number of values, for example in this example each file contains **ONE** variable , but the resulting reading would have **TWO** variables" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ id: variable\n", - " Length: 2\n", - " First: tas\n", - " Last: tos\n", - " Python id: 0x7fe15e1d9ba8, id: model\n", - " Length: 2\n", - " First: GFDL-ESM2G\n", - " Last: GFDL-ESM2Gb\n", - " Python id: 0x7fe15e1d9a58, id: reference\n", - " Length: 2\n", - " First: SimulationDescription\n", - " Last: defaultReference\n", - " Python id: 0x7fe15e1d9940, id: rip\n", - " Length: 2\n", - " First: r1i1p1\n", - " Last: r2i1p1\n", - " Python id: 0x7fe15e1d9e10, id: region\n", - " Length: 6\n", - " First: NHEX\n", - " Last: terre\n", - " Python id: 0x7fe15e1d9908, id: statistic\n", - " Length: 16\n", - " First: bias_xy\n", - " Last: std_xyt\n", - " Python id: 0x7fe15e1d9c18, id: season\n", - " Length: 5\n", - " First: ann\n", - " Last: son\n", - " Python id: 0x7fe15e1d9da0]" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "J1.getAxisList()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We can also retrieve only a specific axis" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - " id: statistic\n", - " Length: 16\n", - " First: bias_xy\n", - " Last: std_xyt\n", - " Python id: 0x7fe15e1d99b0" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "J1.getAxis(\"statistic\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Let's print all the values in the axis" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array(['bias_xy', 'cor_xy', 'mae_xy', 'mean-obs_xy', 'mean_xy',\n", - " 'rms_devzm', 'rms_xy', 'rms_xyt', 'rms_y', 'rmsc_xy', 'std-obs_xy',\n", - " 'std-obs_xy_devzm', 'std-obs_xyt', 'std_xy', 'std_xy_devzm',\n", - " 'std_xyt'], dtype='