DOI-USGS / gw-res-time

Other
3 stars 6 forks source link

bug fix for 01a when "use_all_zones = True" #9

Open pjuckem opened 6 years ago

pjuckem commented 6 years ago

Currently, notebook 01a will throw an error if "use_all_zones" is set to True. The proposed edits below should allow it to work properly:

Code block 15 ("#create grid cell dimension arrays"): .... for group in zone_df: if group == 'all_zones: sat_vol = sat_vol_cell.sum() recharge = flow_sum[0].sum() else: sat_vol = sat_vol_cell.ravel()[zone_df[group]].sum() recharge = flow_sum[0, zone_df[group]].sum() ....

Code block 16 (Generate random particle placement):
....
for group in zone_df: if weight_scheme == 'flow': if group == 'all_zones: weight = flow_sum[0] else: weight = flow_sum[0, zone_df[group]] weight_label = 'flux' elif weight_scheme == 'volume': if group == 'all_zones': weight = sat_vol_cell.ravel() else: weight = sat_vol_cell.ravel()[zone_df[group]] weight_label = 'volume'

f = number_of_particles_per_group / weight.sum()
parts_per_cell = np.rint( weight * f ).astype( np.int32 )

l, r, c = np.indices(( nlay, nrow, ncol ))
if group == 'all_zones':
    l= l.ravel()
    r= r.ravel()
    c= c.ravel()
    label = zones
else:
    l= l.ravel()[zone_df[group]]
    r= r.ravel()[zone_df[group]]
    c= c.ravel()[zone_df[group]]
    label = zones[zone_df[group]]

....