{"action":"created","issue":{"url":"https://api.github.com/repos/CubeBrowser/cube-explorer/issues/7","repository_url":"https://api.github.com/repos/CubeBrowser/cube-explorer","labels_url":"https://api.github.com/repos/CubeBrowser/cube-explorer/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/CubeBrowser/cube-explorer/issues/7/comments","events_url":"https://api.github.com/repos/CubeBrowser/cube-explorer/issues/7/events","html_url":"https://github.com/CubeBrowser/cube-explorer/issues/7","id":137855189,"number":7,"title":"colocated cube pair","user":{"login":"marqh","id":1557321,"avatar_url":"https://avatars.githubusercontent.com/u/1557321?v=3","gravatar_id":"","url":"https://api.github.com/users/marqh","html_url":"https://github.com/marqh","followers_url":"https://api.github.com/users/marqh/followers","following_url":"https://api.github.com/users/marqh/following{/other_user}","gists_url":"https://api.github.com/users/marqh/gists{/gist_id}","starred_url":"https://api.github.com/users/marqh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marqh/subscriptions","organizations_url":"https://api.github.com/users/marqh/orgs","repos_url":"https://api.github.com/users/marqh/repos","events_url":"https://api.github.com/users/marqh/events{/privacy}","received_events_url":"https://api.github.com/users/marqh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-02T11:57:52Z","updated_at":"2016-03-02T11:59:44Z","closed_at":null,"body":"Co-located cubes shall be rendered as sets, with shared sliders across non-plot dimensions, producing similar results to\r\n\r\n```\r\nimport os\r\n\r\nimport iris\r\nimport iris.plot as iplt\r\nimport matplotlib.pyplot as plt\r\nimport requests\r\n\r\ndef get_files():\r\n\r\n    # http://docs.python-requests.org/en/master/api/?highlight=iter_content#requests.Response.iter_content\r\n    # The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can take place.\r\n    chunk_size = 2**20\r\n\r\n    if not os.path.exists('files'):\r\n        os.mkdir('files')\r\n\r\n    uris = ['http://thredds.3dvis.informaticslab.co.uk/thredds/fileServer/testLab/umqvaa_cloud_volume_fraction_in_atmosphere_layer_20160301T0900Z_pc002.nc',\r\n            'http://thredds.3dvis.informaticslab.co.uk/thredds/fileServer/testLab/umqvaa_cloud_volume_fraction_in_atmosphere_layer_20160301T0900Z_pc004.nc',\r\n            'http://thredds.3dvis.informaticslab.co.uk/thredds/fileServer/testLab/umqvaa_cloud_volume_fraction_in_atmosphere_layer_20160301T0900Z_pc006.nc',\r\n        'http://thredds.3dvis.informaticslab.co.uk/thredds/fileServer/testLab/umqvaa_air_temperature_20160301T0900Z_pc002.nc',\r\n            'http://thredds.3dvis.informaticslab.co.uk/thredds/fileServer/testLab/umqvaa_air_temperature_20160301T0900Z_pc004.nc',\r\n            'http://thredds.3dvis.informaticslab.co.uk/thredds/fileServer/testLab/umqvaa_air_temperature_20160301T0900Z_pc006.nc',\r\n            'http://thredds.3dvis.informaticslab.co.uk/thredds/fileServer/testLab/ukv_orog.pp']\r\n\r\n    for uri in uris:\r\n        filename = 'files/{}'.format(uri.split('/')[-1])\r\n        if not os.path.isfile(filename):\r\n            print('downloading {}'.format(uri))\r\n            print('...')\r\n            r = requests.get(uri, stream=True)\r\n            with open(filename, 'wb') as fd:\r\n                for chunk in r.iter_content(chunk_size):\r\n                    fd.write(chunk)\r\n\r\ndef load_data():\r\n    iris.FUTURE.netcdf_promote = True\r\n    cubes = iris.load('files/*')\r\n    cubes = cubes.concatenate()\r\n\r\n    # for cube in cubes:\r\n    #     print cube\r\n    return cubes\r\n\r\ndef axes_pair(a, b, i):\r\n    if not os.path.exists('pics'):\r\n        os.mkdir('pics')\r\n    plt.subplot(1, 2, 1)\r\n    iplt.contour(b)\r\n    plt.title(b.name())\r\n    plt.gca().coastlines()\r\n    plt.subplot(1, 2, 2)\r\n    iplt.pcolormesh(a)\r\n    plt.title(a.name())\r\n    plt.gca().coastlines()\r\n    plt.savefig('pics/{}.png'.format(i))\r\n\r\ndef plot_slices(cubes):\r\n    airt = cubes.extract('air_temperature', strict=True)\r\n    airt.coord(axis='x').guess_bounds()\r\n    airt.coord(axis='y').guess_bounds()\r\n    airt_2d_hz = airt.slices([airt.coord(axis='x'), airt.coord(axis='y')])\r\n    cloudv = cubes.extract('cloud_volume_fraction_in_atmosphere_layer', strict=True)\r\n    cloudv_2d_hz = cloudv.slices([cloudv.coord(axis='x'), cloudv.coord(axis='y')])\r\n\r\n    for i, (at, cv) in enumerate(zip(airt_2d_hz, cloudv_2d_hz)):\r\n        axes_pair(at, cv, i)\r\n\r\ndef main():\r\n    get_files()\r\n    cubes = load_data()\r\n    plot_slices(cubes)\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/CubeBrowser/cube-explorer/issues/comments/191211282","html_url":"https://github.com/CubeBrowser/cube-explorer/issues/7#issuecomment-191211282","issue_url":"https://api.github.com/repos/CubeBrowser/cube-explorer/issues/7","id":191211282,"user":{"login":"philippjfr","id":1550771,"avatar_url":"https://avatars.githubusercontent.com/u/1550771?v=3","gravatar_id":"","url":"https://api.github.com/users/philippjfr","html_url":"https://github.com/philippjfr","followers_url":"https://api.github.com/users/philippjfr/followers","following_url":"https://api.github.com/users/philippjfr/following{/other_user}","gists_url":"https://api.github.com/users/philippjfr/gists{/gist_id}","starred_url":"https://api.github.com/users/philippjfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philippjfr/subscriptions","organizations_url":"https://api.github.com/users/philippjfr/orgs","repos_url":"https://api.github.com/users/philippjfr/repos","events_url":"https://api.github.com/users/philippjfr/events{/privacy}","received_events_url":"https://api.github.com/users/philippjfr/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T11:59:44Z","updated_at":"2016-03-02T11:59:44Z","body":"Thanks @marqh! Should have an example by the next meeting."}}