Skip to content

Commit e1a7c6d

Browse files
committed
now this is readable by paraview
1 parent ac1e8b1 commit e1a7c6d

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

lithology/introduction_to_lithology.ipynb

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"ids = np.tile([0,1], 20) \n",
8181
"\n",
8282
"# Anticline\n",
83-
"lith = LithoLayers(mg, z0s, ids, x0=6000, y0=6000, function = lambda x, y : ((0.002*x)**2+(0.001*y)**2), attrs=attrs)\n",
83+
"lith = LithoLayers(mg, z0s, ids, x0=6000, y0=10000, function = lambda x, y : ((0.002*x)**2+(0.001*y)**2), attrs=attrs)\n",
8484
"\n",
8585
"# Shallow dips\n",
8686
"#lith = LithoLayers(mg, z0s, ids, function = lambda x, y : ((0.001*x)+(0.003*y)), attrs=attrs)\n",
@@ -138,11 +138,11 @@
138138
"out_fields = ['topographic__elevation',\n",
139139
" 'rock_type__id']\n",
140140
"\n",
141-
"ds = xr.Dataset(data_vars={'topographic__elevation' : (('t', 'y', 'x'), \n",
141+
"ds = xr.Dataset(data_vars={'topographic__elevation' : (('time', 'y', 'x'), \n",
142142
" np.empty((nts, mg.shape[0], mg.shape[1])),\n",
143143
" {'units' : 'meters',\n",
144144
" 'long_name': 'Topographic Elevation'}),\n",
145-
" 'rock_type__id': (('t', 'y', 'x'), \n",
145+
" 'rock_type__id': (('time', 'y', 'x'), \n",
146146
" np.empty((nts, mg.shape[0], mg.shape[1])),\n",
147147
" {'units' : '-',\n",
148148
" 'long_name' : 'Rock Type ID Code'})\n",
@@ -153,9 +153,10 @@
153153
" 'y': (('y'), \n",
154154
" mg.y_of_node.reshape(mg.shape)[:, 1],\n",
155155
" {'units' : 'meters'}),\n",
156-
" 'time': (('t'), \n",
156+
" 'time': (('time'), \n",
157157
" dt*np.arange(nts)/1e6,\n",
158-
" {'units': 'millions of years since model start'})\n",
158+
" {'units': 'millions of years since model start',\n",
159+
" 'standard_name' : 'time'})\n",
159160
" }\n",
160161
" )\n"
161162
]
@@ -174,7 +175,9 @@
174175
{
175176
"cell_type": "code",
176177
"execution_count": null,
177-
"metadata": {},
178+
"metadata": {
179+
"collapsed": true
180+
},
178181
"outputs": [],
179182
"source": [
180183
"for i in range(nts):\n",
@@ -272,7 +275,9 @@
272275
{
273276
"cell_type": "code",
274277
"execution_count": null,
275-
"metadata": {},
278+
"metadata": {
279+
"collapsed": true
280+
},
276281
"outputs": [],
277282
"source": [
278283
"mg2 = RasterModelGrid((100, 60), 200)\n",
@@ -310,11 +315,11 @@
310315
"dt = 1000\n",
311316
"\n",
312317
"\n",
313-
"ds2 = xr.Dataset(data_vars={'topographic__elevation' : (('t', 'y', 'x'), \n",
318+
"ds2 = xr.Dataset(data_vars={'topographic__elevation' : (('time', 'y', 'x'), \n",
314319
" np.empty((nts, mg2.shape[0], mg2.shape[1])),\n",
315320
" {'units' : 'meters',\n",
316321
" 'long_name': 'Topographic Elevation'}),\n",
317-
" 'rock_type__id': (('t', 'y', 'x'), \n",
322+
" 'rock_type__id': (('time', 'y', 'x'), \n",
318323
" np.empty((nts, mg2.shape[0], mg2.shape[1])),\n",
319324
" {'units' : '-',\n",
320325
" 'long_name' : 'Rock Type ID Code'})\n",
@@ -325,9 +330,10 @@
325330
" 'y': (('y'), \n",
326331
" mg2.y_of_node.reshape(mg2.shape)[:, 1],\n",
327332
" {'units' : 'meters'}),\n",
328-
" 'time': (('t'), \n",
333+
" 'time': (('time'), \n",
329334
" dt*np.arange(nts)/1e6,\n",
330-
" {'units': 'millions of years since model start'})\n",
335+
" {'units': 'millions of years since model start',\n",
336+
" 'standard_name' : 'time'})\n",
331337
" }\n",
332338
" )\n",
333339
"\n",
@@ -429,7 +435,9 @@
429435
{
430436
"cell_type": "code",
431437
"execution_count": null,
432-
"metadata": {},
438+
"metadata": {
439+
"scrolled": true
440+
},
433441
"outputs": [],
434442
"source": [
435443
"imshow_grid(mg2, 'topographic__elevation', cmap='viridis')"

0 commit comments

Comments
 (0)