Reformatted some code in a few more files.

这个提交包含在:
Sai Suraj
2023-04-16 19:17:57 +05:30
父节点 361bfc3115
当前提交 2f8294698d
共有 3 个文件被更改,包括 10 次插入6 次删除

查看文件

@@ -218,9 +218,9 @@ class PrecursorNodesBase:
def update_previous_timestep_fields(self, field_names):
for fn in field_names:
val = getattr(self, fn + '_1')
val = getattr(self, f'{fn}_1')
val_c = np.copy(val)
setattr(self, fn + '_0', val_c)
setattr(self, f'{fn}_0', val_c)
def interpolate_to_sub_grid(self, field, coords):
x, z, x_sg, z_sg = coords

查看文件

@@ -36,7 +36,7 @@ def create_updates(G):
elif sg_type == SubGridHSG and not sg.filter:
precursors = PrecursorNodes(G, sg)
else:
logger.exception(str(sg) + ' is not a subgrid type')
logger.exception(f'{str(sg)} is not a subgrid type')
raise ValueError
sgu = SubgridUpdater(sg, precursors, G)

查看文件

@@ -45,7 +45,7 @@ class SubGridBase(UserObjectMulti):
elif isinstance(node, UserObjectGeometry):
self.children_geometry.append(node)
else:
logger.exception(str(node) + ' this Object can not be added to a sub grid')
logger.exception(f'{str(node)} this Object can not be added to a sub grid')
raise ValueError
def set_discretisation(self, sg, grid):
@@ -123,12 +123,16 @@ class SubGridBase(UserObjectMulti):
self.subgrid = sg
# Copy over built in materials
sg.materials = [copy(m) for m in grid.materials if m.numID in range(0, grid.n_built_in_materials + 1)]
sg.materials = [
copy(m)
for m in grid.materials
if m.numID in range(grid.n_built_in_materials + 1)
]
# Don't mix and match different subgrid types
for sg_made in grid.subgrids:
if type(sg) != type(sg_made):
logger.exception(self.__str__() + ' please only use one type of subgrid')
logger.exception(f'{self.__str__()} please only use one type of subgrid')
raise ValueError
# Reference the subgrid under the main grid to which it belongs