Skip to content

Instantly share code, notes, and snippets.

@maxhutch
Last active August 29, 2015 14:26
Show Gist options
  • Save maxhutch/f28ebd7561ddd946fd2c to your computer and use it in GitHub Desktop.
Save maxhutch/f28ebd7561ddd946fd2c to your computer and use it in GitHub Desktop.

Demo Jupyter notebook for remote data access with globus

Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# CSGF +1 Demo"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#data_store = \"alcf#dtn_mira/projects/alpha-nek/experiments/\"\n",
"data_store = \"maxhutch#alpha-admin/pub/\"\n",
"data_set = \"Wilk/Wilk_kmin_2.5/Wilk_kmin_2.5\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from glopen import glopen\n",
"import json\n",
"with glopen(\"{:s}.json\".format(data_set), mode='r', endpoint=data_store) as f:\n",
" p = json.load(f)\n",
"print(json.dumps(p, indent=1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from chest import Chest\n",
"from glopen import glopen_many\n",
"from functools import partial\n",
"c = Chest(\n",
" path = \"{:s}-results\".format(data_set),\n",
" open = partial(glopen, endpoint=data_store),\n",
" open_many = partial(glopen_many, endpoint=data_store)\n",
" )\n",
"print(list(c.keys()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from slict import CachedSlict\n",
"sc = CachedSlict(c)\n",
"frame = sc[0.3940801163614,:]\n",
"print(frame.keys())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"plt.imshow(frame['t_yz'].transpose());"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"plt.imshow(frame['t_yz'].transpose(), origin='lower', extent=[0,1,-1,1]);"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment