-
Notifications
You must be signed in to change notification settings - Fork 1
/
l3v.py
561 lines (498 loc) · 19.3 KB
/
l3v.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
#To edit with Vim, use this
#:set tabstop=8 expandtab shiftwidth=4 softtabstop=4
from visit import *
#To calculate normal vector for defining transect
import numpy as np
#Create a 2D pseudocolor plot
def pseudocolor_2D(setvars):
DeleteAllPlots()
#Annotations
AnnotationAtts = AnnotationAttributes()
#Don't print out username and name of database
AnnotationAtts.userInfoFlag = 0
AnnotationAtts.databaseInfoFlag = 0
#Show legend
AnnotationAtts.legendInfoFlag = setvars["legend"]
#Show time
AnnotationAtts.timeInfoFlag = setvars["time"]
#Foreground color
AnnotationAtts.foregroundColor = setvars["cfore"]
#Background color
AnnotationAtts.backgroundColor = setvars["cback"]
#True/false print legend, time, axes
AnnotationAtts.axes2D.visible = setvars["axes"]
AnnotationAtts.axes2D.xAxis.title.visible = setvars["axes"]
AnnotationAtts.axes2D.yAxis.title.visible = setvars["axes"]
AnnotationAtts.axes2D.xAxis.label.visible = setvars["axes"]
AnnotationAtts.axes2D.yAxis.label.visible = setvars["axes"]
SetAnnotationAttributes(AnnotationAtts)
#Create the plot
AddPlot("Pseudocolor", setvars["var"], 1, 1)
SetActivePlots(0)
#Scale in Z
AddOperator("Transform",1)
TransformAtts = TransformAttributes()
TransformAtts.doScale = 1
TransformAtts.scaleOrigin = (0, 0, 0)
TransformAtts.scaleX = 1
TransformAtts.scaleY = 1
TransformAtts.scaleZ = setvars["scale"]
SetOperatorOptions(TransformAtts, 0, 1)
#If using SCHISM, get rid of junk values
AddOperator("Threshold", 1)
ThresholdAtts = ThresholdAttributes()
ThresholdAtts.outputMeshType = 0
ThresholdAtts.boundsInputType = 0
ThresholdAtts.listedVarNames = (setvars["var"])
ThresholdAtts.zonePortions = (0)
ThresholdAtts.lowerBounds = (-1e+37)
ThresholdAtts.upperBounds = (1e+37)
ThresholdAtts.defaultVarName = setvars["var"]
ThresholdAtts.defaultVarIsScalar = 1
ThresholdAtts.boundsRange = ("-1e+37:1e+37")
SetOperatorOptions(ThresholdAtts, 1, 1)
#Set plot attributes
PseudocolorAtts = PseudocolorAttributes()
PseudocolorAtts.minFlag = setvars["clim"]
PseudocolorAtts.maxFlag = setvars["clim"]
PseudocolorAtts.colorTableName = setvars["cmap"]
PseudocolorAtts.invertColorTable = setvars["invert"]
PseudocolorAtts.min = setvars["cmin"]
PseudocolorAtts.max = setvars["cmax"]
SetPlotOptions(PseudocolorAtts)
#Full frame
View2DAtts = View2DAttributes()
View2DAtts.windowCoords = (-88.5502, -87.6843, 30.107, 31.085)
View2DAtts.viewportCoords = (0, 1, 0, 1)
View2DAtts.fullFrameActivationMode = View2DAtts.On # On, Off, Auto
View2DAtts.fullFrameAutoThreshold = 100
SetView2D(View2DAtts)
#Draw the plot
DrawPlots()
#Create a 3D pseudocolor plot
def pseudocolor_3D(setvars):
DeleteAllPlots()
#Annotations
AnnotationAtts = AnnotationAttributes()
#Don't print out username and name of database
AnnotationAtts.userInfoFlag = 0
AnnotationAtts.databaseInfoFlag = 0
#Show legend
AnnotationAtts.legendInfoFlag = setvars["legend"]
#Show time
AnnotationAtts.timeInfoFlag = setvars["time"]
#x-y-x axis thing in the bottom left
AnnotationAtts.axes3D.triadFlag = setvars["axes"]
#bounding box
AnnotationAtts.axes3D.bboxFlag = setvars["axes"]
#Turn of 3D axes
AnnotationAtts.axes3D.visible = setvars["axes"]
#Foreground color
AnnotationAtts.foregroundColor = setvars["cfore"]
#Background color
AnnotationAtts.backgroundColor = setvars["cback"]
SetAnnotationAttributes(AnnotationAtts)
#Create the plot
AddPlot("Pseudocolor", setvars["var"], 1, 1)
SetActivePlots(0)
#Scale in Z
AddOperator("Transform",1)
TransformAtts = TransformAttributes()
TransformAtts.doScale = 1
TransformAtts.scaleOrigin = (0, 0, 0)
TransformAtts.scaleX = 1
TransformAtts.scaleY = 1
TransformAtts.scaleZ = setvars["scale"]
SetOperatorOptions(TransformAtts, 0, 1)
#If using SCHISM, get rid of junk values
AddOperator("Threshold", 1)
ThresholdAtts = ThresholdAttributes()
ThresholdAtts.outputMeshType = 0
ThresholdAtts.boundsInputType = 0
ThresholdAtts.listedVarNames = (setvars["var"])
ThresholdAtts.zonePortions = (0)
ThresholdAtts.lowerBounds = (-1e+37)
ThresholdAtts.upperBounds = (1e+37)
ThresholdAtts.defaultVarName = setvars["var"]
ThresholdAtts.defaultVarIsScalar = 1
ThresholdAtts.boundsRange = ("-1e+37:1e+37")
SetOperatorOptions(ThresholdAtts, 1, 1)
#Set plot attributes
PseudocolorAtts = PseudocolorAttributes()
PseudocolorAtts.minFlag = setvars["clim"]
PseudocolorAtts.maxFlag = setvars["clim"]
PseudocolorAtts.colorTableName = setvars["cmap"]
PseudocolorAtts.invertColorTable = setvars["invert"]
PseudocolorAtts.min = setvars["cmin"]
PseudocolorAtts.max = setvars["cmax"]
SetPlotOptions(PseudocolorAtts)
#Draw the plot
DrawPlots()
def pseudocolor_2Dslice(setvars):
DeleteAllPlots()
##Just for 2D
#Axes are on
AnnotationAtts = AnnotationAttributes()
#Don't print out username and name of database
AnnotationAtts.userInfoFlag = 0
AnnotationAtts.databaseInfoFlag = 0
#Show legend
AnnotationAtts.legendInfoFlag = setvars["legend"]
#Show time
AnnotationAtts.timeInfoFlag = setvars["time"]
#Foreground color
AnnotationAtts.foregroundColor = setvars["cfore"]
#Background color
AnnotationAtts.backgroundColor = setvars["cback"]
#Turn on 2D axes
AnnotationAtts.axes2D.visible = setvars["axes"]
AnnotationAtts.axes2D.xAxis.title.visible = setvars["axes"]
AnnotationAtts.axes2D.xAxis.label.visible = setvars["axes"]
AnnotationAtts.axes2D.yAxis.label.visible = setvars["axes"]
#For y-axis, we want depth, but VisIt relabels it
AnnotationAtts.axes2D.yAxis.title.visible = 0
SetAnnotationAttributes(AnnotationAtts)
#Create plot
AddPlot("Pseudocolor", setvars["var"], 1, 1)
#Scale in Z
AddOperator("Transform",1)
TransformAtts = TransformAttributes()
TransformAtts.scaleZ = setvars["scale"]
SetOperatorOptions(TransformAtts, 0, 1)
#If using SCHISM, get rid of junk values
AddOperator("Threshold", 1)
ThresholdAtts = ThresholdAttributes()
ThresholdAtts.outputMeshType = 0
ThresholdAtts.boundsInputType = 0
ThresholdAtts.listedVarNames = (setvars["var"])
ThresholdAtts.zonePortions = (0)
ThresholdAtts.lowerBounds = (-1e+37)
ThresholdAtts.upperBounds = (1e+37)
ThresholdAtts.defaultVarName = setvars["var"]
ThresholdAtts.defaultVarIsScalar = 1
ThresholdAtts.boundsRange = ("-1e+37:1e+37")
SetOperatorOptions(ThresholdAtts, 1, 1)
#Full frame
View2DAtts = View2DAttributes()
View2DAtts.windowCoords = (-88.5502, -87.6843, 30.107, 31.085)
View2DAtts.viewportCoords = (0, 1, 0, 1)
View2DAtts.fullFrameActivationMode = View2DAtts.On # On, Off, Auto
View2DAtts.fullFrameAutoThreshold = 100
SetView2D(View2DAtts)
ResetView()
#Add a slice in Y by percent
AddOperator("Slice", 1)
SliceAtts = SliceAttributes()
SliceAtts.originType = SliceAtts.Percent
SliceAtts.originPercent = setvars["percent"]
SliceAtts.project2d = 1
SetOperatorOptions(SliceAtts, 1, 1)
#Set plot attributes
SetActivePlots(0)
SetViewExtentsType("actual")
PseudocolorAtts = PseudocolorAttributes()
PseudocolorAtts.minFlag =setvars["clim"]
PseudocolorAtts.maxFlag = setvars["clim"]
PseudocolorAtts.colorTableName = setvars["cmap"]
PseudocolorAtts.invertColorTable = setvars["invert"]
PseudocolorAtts.min = setvars["cmin"]
PseudocolorAtts.max = setvars["cmax"]
SetPlotOptions(PseudocolorAtts)
#Draw the plot
DrawPlots()
def pseudocolor_2Dtransect(setvars):
DeleteAllPlots()
#Annotations
#For 2D, Axes are on
AnnotationAtts = AnnotationAttributes()
#Don't print out username and name of database
AnnotationAtts.userInfoFlag = 0
AnnotationAtts.databaseInfoFlag = 0
#Foreground color
AnnotationAtts.foregroundColor = setvars["cfore"]
#Background color
AnnotationAtts.backgroundColor = setvars["cback"]
#Turn on 2D axes
AnnotationAtts.legendInfoFlag = setvars["legend"]
AnnotationAtts.timeInfoFlag = setvars["time"]
AnnotationAtts.axes2D.visible = setvars["axes"]
AnnotationAtts.axes2D.xAxis.title.visible = setvars["axes"]
AnnotationAtts.axes2D.yAxis.title.visible = setvars["axes"]
AnnotationAtts.axes2D.xAxis.label.visible = setvars["axes"]
AnnotationAtts.axes2D.yAxis.label.visible = setvars["axes"]
#For y-axis, we want depth, but VisIt relabels it
AnnotationAtts.axes2D.yAxis.title.visible = 0
SetAnnotationAttributes(AnnotationAtts)
#Calculate arbitrary normal vector from plane
p1 = np.array([setvars["from_x"],setvars["from_y"],0])
p2 = np.array([setvars["to_x"],setvars["to_y"], 0])
p3 = np.array([setvars["to_x"],setvars["to_y"], -1000])
X = np.array([p2[0]-p1[0],p2[1]-p1[1],p2[2]-p1[2]])
Y = np.array([p3[0]-p1[0],p3[1]-p1[1],p3[2]-p1[2]])
myvec = np.cross(X,Y)
norm_myvec = myvec/np.linalg.norm(myvec)
#Set up 3D plot
AddPlot("Pseudocolor", setvars["var"], 1, 1)
#Scale Z
AddOperator("Transform",1)
TransformAtts = TransformAttributes()
TransformAtts.scaleZ = setvars["scale"]
SetOperatorOptions(TransformAtts, 0, 1)
#If using SCHISM, get rid of junk values
AddOperator("Threshold", 1)
ThresholdAtts = ThresholdAttributes()
ThresholdAtts.outputMeshType = 0
ThresholdAtts.boundsInputType = 0
ThresholdAtts.listedVarNames = (setvars["var"])
ThresholdAtts.zonePortions = (0)
ThresholdAtts.lowerBounds = (-1e+37)
ThresholdAtts.upperBounds = (1e+37)
ThresholdAtts.defaultVarName = setvars["var"]
ThresholdAtts.defaultVarIsScalar = 1
ThresholdAtts.boundsRange = ("-1e+37:1e+37")
SetOperatorOptions(ThresholdAtts, 1, 1)
#Full frame
View2DAtts = View2DAttributes()
View2DAtts.windowCoords = (-88.5502, -87.6843, 30.107, 31.085)
View2DAtts.viewportCoords = (0, 1, 0, 1)
View2DAtts.fullFrameActivationMode = View2DAtts.On # On, Off, Auto
View2DAtts.fullFrameAutoThreshold = 100
SetView2D(View2DAtts)
ResetView()
# #Select Box
# AddOperator("Box", 1)
# BoxAtts = BoxAttributes()
# BoxAtts.amount = BoxAtts.Some # Some, All
# BoxAtts.minx = min(p1[0],p2[0])
# BoxAtts.maxx = max(p1[0],p2[0])
# BoxAtts.miny = min(p1[1],p2[1])
# BoxAtts.maxy = max(p1[1],p2[1])
# BoxAtts.minz = -250000
# BoxAtts.maxz = 0
# BoxAtts.inverse = 0
# SetOperatorOptions(BoxAtts, 2, 1)
#Add Slice
AddOperator("Slice", 1)
SliceAtts = SliceAttributes()
SliceAtts.originType = SliceAtts.Point # Point, Intercept, Percent, Zone, Node
SliceAtts.originPoint = (p1[0], p1[1], p1[2])
SliceAtts.originIntercept = 0
SliceAtts.originPercent = 0
SliceAtts.originZone = 0
SliceAtts.originNode = 0
SliceAtts.normal = (norm_myvec[0], norm_myvec[1], norm_myvec[2])
SliceAtts.axisType = SliceAtts.Arbitrary # XAxis, YAxis, ZAxis, Arbitrary, ThetaPhi
SliceAtts.upAxis = (0, 0, 1)
SliceAtts.project2d = 1
SliceAtts.interactive = 1
SliceAtts.flip = 0
SliceAtts.originZoneDomain = 0
SliceAtts.originNodeDomain = 0
SliceAtts.meshName = "3D_Mesh"
SliceAtts.theta = 0
SliceAtts.phi = 0
SetOperatorOptions(SliceAtts, 1, 1)
#Zoom to boxed transect region
SetViewExtentsType("actual")
SetActivePlots(0)
#Plot attributes
PseudocolorAtts = PseudocolorAttributes()
PseudocolorAtts.minFlag = setvars["clim"]
PseudocolorAtts.maxFlag = setvars["clim"]
PseudocolorAtts.colorTableName = setvars["cmap"]
PseudocolorAtts.invertColorTable = setvars["invert"]
PseudocolorAtts.min = setvars["cmin"]
PseudocolorAtts.max = setvars["cmax"]
SetPlotOptions(PseudocolorAtts)
#Draw the plot
DrawPlots()
def transect_against_3D(setvars):
DeleteAllPlots()
#Annotations
AnnotationAtts = AnnotationAttributes()
#Don't print out username and name of database
AnnotationAtts.userInfoFlag = 0
AnnotationAtts.databaseInfoFlag = 0
#get rid of x-y-x axis thing in the bottom left
AnnotationAtts.axes3D.triadFlag = setvars["axes"]
#bounding box
AnnotationAtts.axes3D.bboxFlag = setvars["axes"]
#Turn of 3D axes
AnnotationAtts.axes3D.visible = setvars["axes"]
#Foreground color
AnnotationAtts.foregroundColor = setvars["cfore"]
#Background color
AnnotationAtts.backgroundColor = setvars["cback"]
#AnnotationAtts.axes2D.xAxis.title.visible = 1
SetAnnotationAttributes(AnnotationAtts)
#Calculate arbitrary normal vector from plane
p1 = np.array([setvars["from_x"],setvars["from_y"],0])
p2 = np.array([setvars["to_x"],setvars["to_y"],0])
p3 = np.array([setvars["to_x"],setvars["to_y"], -1000])
X = np.array([p2[0]-p1[0],p2[1]-p1[1],p2[2]-p1[2]])
Y = np.array([p3[0]-p1[0],p3[1]-p1[1],p3[2]-p1[2]])
myvec = np.cross(X,Y)
norm_myvec = myvec/np.linalg.norm(myvec)
#Add plot
AddPlot("Pseudocolor", setvars["var"], 1, 1)
SetActivePlots(0)
#Set plot attributes
PseudocolorAtts = PseudocolorAttributes()
PseudocolorAtts.minFlag = setvars["clim"]
PseudocolorAtts.maxFlag = setvars["clim"]
PseudocolorAtts.colorTableName = setvars["cmap"]
PseudocolorAtts.min = setvars["cmin"]
PseudocolorAtts.max = setvars["cmax"]
PseudocolorAtts.invertColorTable = setvars["invert"]
SetPlotOptions(PseudocolorAtts)
#Scale Z
#Scale in Z
AddOperator("Transform",1)
TransformAtts = TransformAttributes()
TransformAtts.doScale = 1
TransformAtts.scaleOrigin = (0, 0, 0)
TransformAtts.scaleX = 1
TransformAtts.scaleY = 1
TransformAtts.scaleZ = setvars["scale"]
SetOperatorOptions(TransformAtts, 0, 1)
#Add Mesh Plot with the same attributes
AddPlot("Mesh", "3D_Mesh", 1, 1)
#Change the color and opacity of mesh
SetActivePlots(1)
MeshAtts = MeshAttributes()
MeshAtts.legendFlag = 1
MeshAtts.lineWidth = 0
MeshAtts.meshColor = (128, 128, 128, 255)
MeshAtts.meshColorSource = MeshAtts.MeshCustom # Foreground, MeshCustom, MeshRandom
MeshAtts.opaqueColorSource = MeshAtts.Background # Background, OpaqueCustom, OpaqueRandom
MeshAtts.opaqueMode = MeshAtts.Auto # Auto, On, Off
MeshAtts.pointSize = 0.05
MeshAtts.opaqueColor = (255, 255, 255, 255)
MeshAtts.smoothingLevel = MeshAtts.None # None, Fast, High
MeshAtts.pointSizeVarEnabled = 0
MeshAtts.pointSizeVar = "Default"
MeshAtts.pointType = MeshAtts.Point # Box, Axis, Icosahedron, Octahedron, Tetrahedron, SphereGeometry, Point, Sphere
MeshAtts.showInternal = 0
MeshAtts.pointSizePixels = 2
MeshAtts.opacity = 0.333333
SetPlotOptions(MeshAtts)
#If using SCHISM, get rid of junk values
AddOperator("Threshold", 1)
ThresholdAtts = ThresholdAttributes()
ThresholdAtts.outputMeshType = 0
ThresholdAtts.boundsInputType = 0
ThresholdAtts.listedVarNames = (setvars["var"])
ThresholdAtts.zonePortions = (0)
ThresholdAtts.lowerBounds = (-1e+37)
ThresholdAtts.upperBounds = (1e+37)
ThresholdAtts.defaultVarName = setvars["var"]
ThresholdAtts.defaultVarIsScalar = 1
ThresholdAtts.boundsRange = ("-1e+37:1e+37")
SetOperatorOptions(ThresholdAtts, 1, 1)
#Select Box, hopefully to just the Active Plots
#SetActivePlots((0, 1))
# SetActivePlots(0)
# AddOperator("Box", 0)
# BoxAtts = BoxAttributes()
# BoxAtts.amount = BoxAtts.Some # Some, All
# BoxAtts.minx = min(p1[0],p2[0])
# BoxAtts.maxx = max(p1[0],p2[0])
# BoxAtts.miny = min(p1[1],p2[1])
# BoxAtts.maxy = max(p1[1],p2[1])
# BoxAtts.minz = -250000
# BoxAtts.maxz = 0
# BoxAtts.inverse = 0
# SetOperatorOptions(BoxAtts, 1, 0)
#Add slicing, do NOT project to 2D
AddOperator("Slice", 0)
SliceAtts = SliceAttributes()
SliceAtts.originType = SliceAtts.Point # Point, Intercept, Percent, Zone, Node
SliceAtts.originPoint = (p1[0], p1[1], p1[2])
SliceAtts.originIntercept = 0
SliceAtts.originPercent = 0
SliceAtts.originZone = 0
SliceAtts.originNode = 0
SliceAtts.normal = (norm_myvec[0], norm_myvec[1], norm_myvec[2])
SliceAtts.axisType = SliceAtts.Arbitrary # XAxis, YAxis, ZAxis, Arbitrary, ThetaPhi
SliceAtts.upAxis = (0, 0, 1)
#do not project to 2d
SliceAtts.project2d = 0
SliceAtts.interactive = 1
SliceAtts.flip = 0
SliceAtts.originZoneDomain = 0
SliceAtts.originNodeDomain = 0
SliceAtts.meshName = "3D_Mesh"
SliceAtts.theta = 0
SliceAtts.phi = 0
#I need to look up what that means
SetOperatorOptions(SliceAtts, 2, 0)
#Draw the plot
DrawPlots()
def pseudocolor_projection(setvars):
DeleteAllPlots()
##Just for 2D
#Axes are on
AnnotationAtts = AnnotationAttributes()
#Don't print out username and name of database
AnnotationAtts.userInfoFlag = 0
AnnotationAtts.databaseInfoFlag = 0
#Foreground color
AnnotationAtts.foregroundColor = setvars["cfore"]
#Background color
AnnotationAtts.backgroundColor = setvars["cback"]
#Turn on 2D axes
AnnotationAtts.axes2D.visible = setvars["axes"]
##x-axis labeling is fine for slices
AnnotationAtts.axes2D.xAxis.title.visible = setvars["axes"]
AnnotationAtts.axes2D.xAxis.label.visible = setvars["axes"]
AnnotationAtts.axes2D.yAxis.title.visible = setvars["axes"]
SetAnnotationAttributes(AnnotationAtts)
#Create the plot
AddPlot("Pseudocolor", setvars["var"], 1, 1)
SetActivePlots(0)
#Project to 2D
AddOperator("Project",1)
#If using SCHISM, get rid of junk values
AddOperator("Threshold", 1)
ThresholdAtts = ThresholdAttributes()
ThresholdAtts.outputMeshType = 0
ThresholdAtts.boundsInputType = 0
ThresholdAtts.listedVarNames = (setvars["var"])
ThresholdAtts.zonePortions = (0)
ThresholdAtts.lowerBounds = (-1e+37)
ThresholdAtts.upperBounds = (1e+37)
ThresholdAtts.defaultVarName = setvars["var"]
ThresholdAtts.defaultVarIsScalar = 1
ThresholdAtts.boundsRange = ("-1e+37:1e+37")
SetOperatorOptions(ThresholdAtts, 1, 1)
#Set plot attributes
PseudocolorAtts = PseudocolorAttributes()
PseudocolorAtts.minFlag = setvars["clim"]
PseudocolorAtts.maxFlag = setvars["clim"]
PseudocolorAtts.colorTableName = setvars["cmap"]
PseudocolorAtts.invertColorTable = setvars["invert"]
PseudocolorAtts.min = setvars["cmin"]
PseudocolorAtts.max = setvars["cmax"]
SetPlotOptions(PseudocolorAtts)
#Draw the plot
DrawPlots()
def open_file(setvars):
if(setvars["model"]=="schism"):
OpenDatabase(setvars["db"],0,"SCHISM")
elif(setvars["model"]=="fvcom"):
OpenDatabase(setvars["db"],0,"")
else:
OpenDatabase(setvars["db"],0,"")
def close_file(setvars):
CloseDatabase(setvars["db"])
#RegisterMacro executes a function when you type the name at the command line
RegisterMacro("pseudocolor_2D",pseudocolor_2D)
RegisterMacro("pseudocolor_3D",pseudocolor_3D)
RegisterMacro("pseudocolor_2Dslice",pseudocolor_2Dslice)
RegisterMacro("pseudocolor_2Dtransect",pseudocolor_2Dtransect)
RegisterMacro("transect_against_3D",transect_against_3D)
RegisterMacro("pseudocolor_projection",pseudocolor_projection)
RegisterMacro("open_file",open_file)
RegisterMacro("close_file",close_file)
#To edit with Vim, use this
#:set tabstop=8 expandtab shiftwidth=4 softtabstop=4