Skip to content

Commit 5f42822

Browse files
updated the gkeyll notebook script
1 parent d3c191c commit 5f42822

File tree

1 file changed

+23
-16
lines changed
  • modules/agent-framework/deployments/jupyterhub/data/gkeyll

1 file changed

+23
-16
lines changed

modules/agent-framework/deployments/jupyterhub/data/gkeyll/plotE_z.ipynb

+23-16
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"metadata": {},
3636
"outputs": [],
3737
"source": [
38-
"!ls /anvil/projects/x-phy220105/cwsmith/vlabApps/gkyldataset"
38+
"!ls /anvil/projects/x-phy220105/gkylMarch2025/vlabApps/gemReconnection"
3939
]
4040
},
4141
{
@@ -46,23 +46,20 @@
4646
"outputs": [],
4747
"source": [
4848
"from pathlib import Path\n",
49-
"import matplotlib.pyplot as plt \n",
50-
"\n",
51-
"import os\n",
52-
"\n",
49+
"import matplotlib.pyplot as plt\n",
5350
"import postgkyl as pg\n",
5451
"\n",
55-
"data_base_path = \"/anvil/projects/x-phy220105/cwsmith/vlabApps/gkyldataset\"\n",
52+
"data_base_path = \"/anvil/projects/x-phy220105/gkylMarch2025/vlabApps/gemReconnection\"\n",
5653
"run = Path.cwd()\n",
5754
"\n",
5855
"def getModelType():\n",
59-
" frame = 0 \n",
56+
" frame = 0\n",
6057
" models = [\"5m\", \"10m\"]\n",
6158
" for model in models:\n",
62-
" path = Path(f\"{data_base_path}/rt-{model}-gem_field_{frame}.bp\")\n",
59+
" path = Path(f\"{data_base_path}/rt_{model}_gem_gzero-field_{frame}.gkyl\")\n",
6360
" if path.is_file():\n",
6461
" return model\n",
65-
" error = \"Failed to find input ADIOS file rt-5m-gem_field_0.bp or rt-10m-gem_field_0.bp.\"\n",
62+
" error = \"Failed to find input file \" + str(path)\n",
6663
" assert False, error"
6764
]
6865
},
@@ -73,9 +70,9 @@
7370
"metadata": {},
7471
"outputs": [],
7572
"source": [
76-
"frame = 0 \n",
73+
"frame = 0\n",
7774
"model = getModelType()\n",
78-
"filename = run / f\"{data_base_path}/rt-{model}-gem_field_{frame}.bp\"\n",
75+
"filename = run / f\"{data_base_path}/rt_{model}_gem_gzero-field_{frame}.gkyl\"\n",
7976
"filename = str(filename)\n",
8077
"print(filename)"
8178
]
@@ -89,13 +86,13 @@
8986
"source": [
9087
"gdata = pg.GData(filename)\n",
9188
"\n",
92-
"vals = gdata.getValues() # cell-center values, shape is Ny * Nx * Ncomponents\n",
93-
"grid = gdata.getGrid() # cell corner coordinates\n",
94-
"ndim = gdata.getNumDims() # number of spatial dimensions\n",
89+
"vals = gdata.get_values() # cell-center values, shape is Ny * Nx * Ncomponents\n",
90+
"grid = gdata.get_grid() # cell corner coordinates\n",
91+
"ndim = gdata.get_num_dims() # number of spatial dimensions\n",
9592
"\n",
9693
"assert len(vals.shape) == ndim+1 and len(grid) == ndim\n",
9794
"\n",
98-
"icomp = 3 \n",
95+
"icomp = 3\n",
9996
"compName = r'$E_z^2$'\n",
10097
"fileName = \"E_z.png\"\n",
10198
"\n",
@@ -110,7 +107,9 @@
110107
"ax.set_xlabel('x')\n",
111108
"ax.set_ylabel('y')\n",
112109
"ax.set_title(compName)\n",
113-
"ax.set_aspect(1)"
110+
"ax.set_aspect(1)\n",
111+
"\n",
112+
"plt.savefig(fileName)"
114113
]
115114
},
116115
{
@@ -131,6 +130,14 @@
131130
"%stop_runtime test_cpu\n",
132131
"%switch_runtime local"
133132
]
133+
},
134+
{
135+
"cell_type": "code",
136+
"execution_count": null,
137+
"id": "5d87f6d9-2547-473d-987a-af5306d6f00b",
138+
"metadata": {},
139+
"outputs": [],
140+
"source": []
134141
}
135142
],
136143
"metadata": {

0 commit comments

Comments
 (0)