@@ -1447,8 +1447,7 @@ def gradient(f: DADF5Dataset, size: np.ndarray) -> DADF5Dataset:
1447
1447
def _add_generic_grid (self ,
1448
1448
func : Callable [..., DADF5Dataset ],
1449
1449
datasets : Dict [str , str ],
1450
- args : Dict [str , str ] = {},
1451
- constituents = None ):
1450
+ args : Dict [str ,Any ]):
1452
1451
"""
1453
1452
General function to add data on a regular grid.
1454
1453
@@ -1460,7 +1459,7 @@ def _add_generic_grid(self,
1460
1459
datasets : dictionary
1461
1460
Details of the datasets to be used:
1462
1461
{arg (name to which the data is passed in func): label (in DADF5 file)}.
1463
- args : dictionary, optional
1462
+ args : dictionary
1464
1463
Arguments parsed to func.
1465
1464
1466
1465
"""
@@ -1484,13 +1483,17 @@ def _add_generic_grid(self,
1484
1483
r = func (** dataset ,** args )
1485
1484
result = grid_filters .ravel (r ['data' ])
1486
1485
for x in self ._visible [ty [0 ]+ 's' ]:
1486
+ path = '/' .join (['/' ,increment [0 ],ty [0 ],x ,field [0 ]])
1487
1487
if ty [0 ] == 'phase' :
1488
1488
result1 = result [at_cell_ph [0 ][x ]]
1489
1489
if ty [0 ] == 'homogenization' :
1490
1490
result1 = result [at_cell_ho [x ]]
1491
-
1492
- path = '/' .join (['/' ,increment [0 ],ty [0 ],x ,field [0 ]])
1493
- h5_dataset = f [path ].create_dataset (r ['label' ],data = result1 )
1491
+ if not self ._protected and '/' .join ([path ,r ['label' ]]) in f :
1492
+ h5_dataset = f ['/' .join ([path ,r ['label' ]])]
1493
+ h5_dataset [...] = result1
1494
+ h5_dataset .attrs ['overwritten' ] = True
1495
+ else :
1496
+ h5_dataset = f [path ].create_dataset (r ['label' ],data = result1 )
1494
1497
1495
1498
h5_dataset .attrs ['created' ] = util .time_stamp ()
1496
1499
@@ -1503,7 +1506,7 @@ def _add_generic_grid(self,
1503
1506
def _add_generic_pointwise (self ,
1504
1507
func : Callable [..., DADF5Dataset ],
1505
1508
datasets : Dict [str , str ],
1506
- args : Dict [str , Any ] = {} ):
1509
+ args : Optional [ Dict [str , Any ]] = None ):
1507
1510
"""
1508
1511
General function to add pointwise data.
1509
1512
@@ -1519,6 +1522,7 @@ def _add_generic_pointwise(self,
1519
1522
Arguments parsed to func.
1520
1523
1521
1524
"""
1525
+ args = args if args else {}
1522
1526
1523
1527
def job_pointwise (group : str ,
1524
1528
callback : Callable [..., DADF5Dataset ],
0 commit comments