Skip to content

Commit 59b79d2

Browse files
committed
use PEP8 naming style for all methods
1 parent a20302c commit 59b79d2

9 files changed

+92
-96
lines changed

Diff for: CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
All notable changes to **VTUinterface** will be documented in this file.
44

55

6-
## [Unreleased]
6+
## [0.67]
77

88
### Bugfixes
99

1010
### Additions
1111

1212
### Changes
13-
13+
* ogs6py uses now PEP8 naming conventionfor all ogs6py methods (lowercase with underscore separation)

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ clone the repository and use pip to install the package
2424

2525
# 1. Quick start
2626

27+
## CAUTION: naming style of methods has changed (2021-05-20)
28+
2729
[Basic Usage (python)](https://github.com/joergbuchwald/VTUinterface/blob/master/README_python.md)
2830

2931
Although, a python package, VTUinterface is tested to work through PyCall under julia as well:

Diff for: README_julia.md

+23-26
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ vtufile = vtuIO.VTUIO("examples/square_1e2_pcs_0_ts_1_t_1.000000.vtu", dim=2)
2727

2828

2929

30-
PyObject <vtuIO.VTUIO object at 0x7f389fd3a760>
30+
PyObject <vtuIO.VTUIO object at 0x7fe66e250760>
3131

3232

3333

@@ -36,7 +36,7 @@ Basic VTU properties, like fieldnames, points and corresponding fielddata as pro
3636

3737

3838
```julia
39-
fields=vtufile.getFieldnames()
39+
fields=vtufile.get_field_names()
4040
```
4141

4242

@@ -67,7 +67,7 @@ vtufile.points[1:3]
6767

6868

6969
```julia
70-
vtufile.getField("v")
70+
vtufile.get_field("v")
7171
```
7272

7373

@@ -123,7 +123,7 @@ can be retrieved via
123123

124124

125125
```julia
126-
point_data = vtufile.getPointData("pressure", pts=points)
126+
point_data = vtufile.get_point_data("pressure", pts=points)
127127
```
128128

129129

@@ -150,13 +150,13 @@ vtufile = vtuIO.VTUIO("examples/square2d_random.vtu", dim=2)
150150

151151

152152

153-
PyObject <vtuIO.VTUIO object at 0x7f3848298fd0>
153+
PyObject <vtuIO.VTUIO object at 0x7fe65b8f20d0>
154154

155155

156156

157157

158158
```julia
159-
field = vtufile.getField("gaussian_field_2");
159+
field = vtufile.get_field("gaussian_field_2");
160160
```
161161

162162

@@ -167,7 +167,7 @@ triang = matplotlib.tri.Triangulation(vtufile.points[:,1], vtufile.points[:,2])
167167

168168

169169

170-
PyObject <matplotlib.tri.triangulation.Triangulation object at 0x7f3848298850>
170+
PyObject <matplotlib.tri.triangulation.Triangulation object at 0x7fe61648f370>
171171

172172

173173

@@ -185,7 +185,7 @@ tricontourf(triang,field)
185185

186186

187187

188-
PyObject <matplotlib.tri.tricontour.TriContourSet object at 0x7f389ed33460>
188+
PyObject <matplotlib.tri.tricontour.TriContourSet object at 0x7fe6142ed640>
189189

190190

191191

@@ -210,7 +210,7 @@ diagonal = [(i,i,0) for i in 0:0.1:64];
210210
vtufile = vtuIO.VTUIO("examples/square2d_random.vtu", dim=2)
211211
data_diag = Dict()
212212
for method in methods
213-
data_diag[method] = vtufile.getPointSetData("gaussian_field_2", pointsetarray=diagonal, interpolation_method=method)
213+
data_diag[method] = vtufile.get_point_set_data("gaussian_field_2", pointsetarray=diagonal, interpolation_method=method)
214214
end
215215
```
216216

@@ -236,7 +236,7 @@ legend()
236236

237237

238238

239-
PyObject <matplotlib.legend.Legend object at 0x7f389ffe8a90>
239+
PyObject <matplotlib.legend.Legend object at 0x7fe66e381880>
240240

241241

242242

@@ -251,13 +251,13 @@ vtufile = vtuIO.VTUIO("examples/square_1e2_pcs_0_ts_1_t_1.000000.vtu", dim=2)
251251

252252

253253

254-
PyObject <vtuIO.VTUIO object at 0x7f384c2a0070>
254+
PyObject <vtuIO.VTUIO object at 0x7fe66e3b7760>
255255

256256

257257

258258

259259
```julia
260-
p_size = length(vtufile.getField("pressure"))
260+
p_size = length(vtufile.get_field("pressure"))
261261
```
262262

263263

@@ -274,7 +274,7 @@ p0 = ones(p_size) * 1e6;
274274

275275

276276
```julia
277-
vtufile.writeField(p0, "initialPressure", "mesh_initialpressure.vtu")
277+
vtufile.write_field(p0, "initialPressure", "mesh_initialpressure.vtu")
278278
```
279279

280280
A new field can also created from a three-argument function for all space-dimensions:
@@ -299,7 +299,7 @@ end
299299

300300

301301
```julia
302-
vtufile.func2Field(p_init, "p_init", "mesh_initialpressure.vtu")
302+
vtufile.func_to_field(p_init, "p_init", "mesh_initialpressure.vtu")
303303
```
304304

305305
It is also possible to write multidimensional arrays using a function.
@@ -320,7 +320,7 @@ end
320320

321321

322322
```julia
323-
vtufile.func2MdimField([p_init,p_init,null,null], "sigma00","mesh_initialpressure.vtu")
323+
vtufile.func_to_m_dim_field([p_init,p_init,null,null], "sigma00","mesh_initialpressure.vtu")
324324
```
325325

326326
# 3. Reading time-series data from PVD files:
@@ -335,7 +335,7 @@ pvdfile = vtuIO.PVDIO("examples", "square_1e2_pcs_0.pvd", dim=2)
335335

336336

337337

338-
PyObject <vtuIO.PVDIO object at 0x7f389ff4cf70>
338+
PyObject <vtuIO.PVDIO object at 0x7fe66e3c9b50>
339339

340340

341341

@@ -371,7 +371,7 @@ points = Dict("pt0"=> (0.3,0.5,0.0), "pt1"=> (0.24,0.21,0.0))
371371

372372

373373
```julia
374-
pressure_linear = pvdfile.readTimeSeries("pressure", points)
374+
pressure_linear = pvdfile.read_time_series("pressure", points)
375375
```
376376

377377

@@ -385,7 +385,7 @@ pressure_linear = pvdfile.readTimeSeries("pressure", points)
385385

386386

387387
```julia
388-
pressure_nearest = pvdfile.readTimeSeries("pressure", points, interpolation_method="nearest")
388+
pressure_nearest = pvdfile.read_time_series("pressure", points, interpolation_method="nearest")
389389
```
390390

391391

@@ -402,9 +402,6 @@ pressure_nearest = pvdfile.readTimeSeries("pressure", points, interpolation_meth
402402
using Plots
403403
```
404404

405-
WARNING: using Plots.plot in module Main conflicts with an existing identifier.
406-
407-
408405
As point pt0 is a node in the mesh, both values at $t=1$ agree, whereas pt1 is not a mesh node point resulting in different values.
409406

410407

@@ -458,10 +455,10 @@ t2 = 0.9
458455

459456

460457
```julia
461-
pressure_xaxis_t1 = pvdfile.readPointSetData(t1, "pressure", pointsetarray=xaxis);
462-
pressure_diagonal_t1 = pvdfile.readPointSetData(t1, "pressure", pointsetarray=diagonal);
463-
pressure_xaxis_t2 = pvdfile.readPointSetData(t2, "pressure", pointsetarray=xaxis);
464-
pressure_diagonal_t2 = pvdfile.readPointSetData(t2, "pressure", pointsetarray=diagonal);
458+
pressure_xaxis_t1 = pvdfile.read_point_set_data(t1, "pressure", pointsetarray=xaxis);
459+
pressure_diagonal_t1 = pvdfile.read_point_set_data(t1, "pressure", pointsetarray=diagonal);
460+
pressure_xaxis_t2 = pvdfile.read_point_set_data(t2, "pressure", pointsetarray=xaxis);
461+
pressure_diagonal_t2 = pvdfile.read_point_set_data(t2, "pressure", pointsetarray=diagonal);
465462
```
466463

467464

@@ -494,7 +491,7 @@ legend()
494491

495492

496493

497-
PyObject <matplotlib.legend.Legend object at 0x7f382f4ec520>
494+
PyObject <matplotlib.legend.Legend object at 0x7fe600cb4100>
498495

499496

500497

Diff for: README_python.md

+24-27
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Basic VTU properties, like fieldnames, points and corresponding fielddata as pro
1717

1818

1919
```python
20-
vtufile.getFieldnames()
20+
vtufile.get_field_names()
2121
```
2222

2323

@@ -45,7 +45,7 @@ vtufile.points[0:3]
4545

4646

4747
```python
48-
vtufile.getField("v")[0:3]
48+
vtufile.get_field("v")[0:3]
4949
```
5050

5151

@@ -64,14 +64,11 @@ Aside basic VTU properties, the field data at any given point, e.g,
6464
points={'pt0': (0.5,0.5,0.0), 'pt1': (0.2,0.2,0.0)}
6565
```
6666

67-
68-
```python
6967
can be retrieved via
70-
```
7168

7269

7370
```python
74-
vtufile.getPointData("pressure", pts=points)
71+
vtufile.get_point_data("pressure", pts=points)
7572
```
7673

7774

@@ -96,7 +93,7 @@ vtufile = vtuIO.VTUIO("examples/square2d_random.vtu", dim=2)
9693

9794

9895
```python
99-
field = vtufile.getField("gaussian_field_2");
96+
field = vtufile.get_field("gaussian_field_2");
10097
```
10198

10299

@@ -112,7 +109,7 @@ plt.tricontourf(triang,field)
112109

113110

114111

115-
<matplotlib.tri.tricontour.TriContourSet at 0x7fc9e6cc5850>
112+
<matplotlib.tri.tricontour.TriContourSet at 0x7f84fa66b670>
116113

117114

118115

@@ -135,21 +132,21 @@ methods = ["nearest", "linear", "cubic"]
135132

136133

137134
```python
138-
vtufile = vtuIO.VTUIO("examples/square2d_random.vtu", dim=2)
139-
data_diag = {}
140-
for method in methods:
141-
data_diag[method] = vtufile.getPointSetData("gaussian_field_2", pointsetarray=diagonal, interpolation_method=method)
135+
import numpy as np
136+
x = np.linspace(0.0,64,num=100);
142137
```
143138

144139

145140
```python
146-
import numpy as np
147-
x = np.linspace(0.0,64,num=100);
141+
diagonal = [(i,i,0) for i in x];
148142
```
149143

150144

151145
```python
152-
diagonal = [(i,i,0) for i in x];
146+
vtufile = vtuIO.VTUIO("examples/square2d_random.vtu", dim=2)
147+
data_diag = {}
148+
for method in methods:
149+
data_diag[method] = vtufile.get_point_set_data("gaussian_field_2", pointsetarray=diagonal, interpolation_method=method)
153150
```
154151

155152

@@ -167,7 +164,7 @@ plt.legend()
167164

168165

169166

170-
<matplotlib.legend.Legend at 0x7fc9dd0106a0>
167+
<matplotlib.legend.Legend at 0x7f84fa629220>
171168

172169

173170

@@ -187,7 +184,7 @@ vtufile = vtuIO.VTUIO("examples/square_1e2_pcs_0_ts_1_t_1.000000.vtu", dim=2)
187184

188185

189186
```python
190-
p_size = len(vtufile.getField("pressure"))
187+
p_size = len(vtufile.get_field("pressure"))
191188
```
192189

193190

@@ -197,7 +194,7 @@ p0 = np.ones(p_size) * 1e6
197194

198195

199196
```python
200-
vtufile.writeField(p0, "initialPressure", "mesh_initialpressure.vtu")
197+
vtufile.write_field(p0, "initialPressure", "mesh_initialpressure.vtu")
201198
```
202199

203200

@@ -211,7 +208,7 @@ def p_init(x,y,z):
211208

212209

213210
```python
214-
vtufile.func2Field(p_init, "p_init", "mesh_initialpressure.vtu")
211+
vtufile.func_to_field(p_init, "p_init", "mesh_initialpressure.vtu")
215212
```
216213

217214

@@ -222,7 +219,7 @@ def null(x,y,z):
222219

223220

224221
```python
225-
vtufile.func2MdimField([p_init,p_init,null,null], "sigma00","mesh_initialpressure.vtu")
222+
vtufile.func_to_m_dim_field([p_init,p_init,null,null], "sigma00","mesh_initialpressure.vtu")
226223
```
227224

228225
# 3. Reading time-series data from PVD files:
@@ -249,12 +246,12 @@ points={'pt0': (0.3,0.5,0.0), 'pt1': (0.24,0.21,0.0)}
249246

250247

251248
```python
252-
pressure_linear = pvdfile.readTimeSeries("pressure", points)
249+
pressure_linear = pvdfile.read_time_series("pressure", points)
253250
```
254251

255252

256253
```python
257-
pressure_nearest = pvdfile.readTimeSeries("pressure", points, interpolation_method="nearest")
254+
pressure_nearest = pvdfile.read_time_series("pressure", points, interpolation_method="nearest")
258255
```
259256

260257
As point pt0 is a node in the mesh, both values at $t=1$ agree, whereas pt1 is not a mesh node point resulting in different values.
@@ -307,10 +304,10 @@ t2 = 0.9
307304

308305

309306
```python
310-
pressure_xaxis_t1 = pvdfile.readPointSetData(t1, "pressure", pointsetarray=xaxis)
311-
pressure_diagonal_t1 = pvdfile.readPointSetData(t1, "pressure", pointsetarray=diagonal)
312-
pressure_xaxis_t2 = pvdfile.readPointSetData(t2, "pressure", pointsetarray=xaxis)
313-
pressure_diagonal_t2 = pvdfile.readPointSetData(t2, "pressure", pointsetarray=diagonal)
307+
pressure_xaxis_t1 = pvdfile.read_point_set_data(t1, "pressure", pointsetarray=xaxis)
308+
pressure_diagonal_t1 = pvdfile.read_point_set_data(t1, "pressure", pointsetarray=diagonal)
309+
pressure_xaxis_t2 = pvdfile.read_point_set_data(t2, "pressure", pointsetarray=xaxis)
310+
pressure_diagonal_t2 = pvdfile.read_point_set_data(t2, "pressure", pointsetarray=diagonal)
314311
```
315312

316313

@@ -327,7 +324,7 @@ plt.legend()
327324

328325

329326

330-
<matplotlib.legend.Legend at 0x7fc9dc7fadc0>
327+
<matplotlib.legend.Legend at 0x7f84fa491c10>
331328

332329

333330

0 commit comments

Comments
 (0)