Commit 4eff6096 authored by Roelofsen, Hans's avatar Roelofsen, Hans
Browse files

update to draagrkacht

parent 23d2a72f
......@@ -127,10 +127,20 @@ bt_drop = [col for col in areas.columns.difference(set(ndff.btB)).tolist() if co
'''Merge NDFF observations df with areas df for full dataframe'''
out = pd.merge(left=areas, right=ndff_per_area, left_on='ID', right_index=True, how='left')
# calculate ratio bt-pixels/ndff-pixels per area
for bt in set(nbts.bt_B):
try:
dk = out.loc[:, '{}_ndffpxls'.format(bt)].divide(out.loc[:, bt])
print(dk)
except KeyError:
continue
out = out.join(pd.DataFrame(data=dk.rename('{}_dk'.format(bt))))
out = out.reindex(sorted(out.columns), axis=1)
# Copy to clipboard dropping areas entirely nodata and BT columns with no matching NDFF observation
out.loc[out.nodata < 160000, :].drop(labels=['geometry'] + bt_drop, axis=1).fillna(0).to_clipboard(sep=';', index=False)
print('\n results are on ze clipboard')
print('\n results for {} are on ze clipboard'.format(sp.name))
if shp:
out.to_file(r'c:\apps\temp_geodata\tapuit_dk_adv.shp')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment