我有26个数组的数据,我与难以置信的大数组工作,所以我想加快这个过程。这段代码实际上可以工作并实现我想要它实现的目标,但是它非常慢。
我想让代码做的是:
查看两个数组并选择满足或不满足特定条件的单元格。如果满足这个条件,我想通过编辑并从另一个数组中获取值来更改这些单元格中的值。数组中的所有值都需要更新以反映这些更改。
我下面的代码可能看起来有点混乱,但还是这样。这是我的慢代码:active_layer # An array
active_layer_volumes = [] # List of 7 arrays
active_layer_proportions = [] # List of 7 arrays
inactive_layer # Array
inactive_layer_volumes = [] # List of 7 arrays
inactive_layer_proportions = [] # List of 7 arrays
# Calculate the lower and upper limits for the volume of the active layer
al_upper_volume_limit = 5
al_lower_volume_limit = 1
# Count the grainsizes as the model works through them
grain_size_counter = 1
# Set up some empty arrays to hold the new values
new_active_layer_total = np.zeros_like(active_layer)
new_