Commit 3e3836cd authored by Roelofsen, Hans's avatar Roelofsen, Hans
Browse files

early checking for correct beheertypen

parent 674d4daa
......@@ -52,9 +52,10 @@ def plant_dk(ffargs):
bt_master_src = r'c:\apps\proj_code\benb_utils\resources\snl_beheertypen.csv'
try:
bt_master = pd.read_csv(bt_master_src, sep=',', comment='#', quotechar='"')
bt_master['bt_code'] = bt_master.LAND_TYPE_CODE.apply(fix_bt, as_mnp=True)
except FileNotFoundError:
raise AssertionError("please instal BenB repository and update local path to \\resources\snl_beheertypen.csv")
btcode2omschrijving = dict(zip(bt_master.LAND_TYPE_CODE.apply(fix_bt, as_mnp=True), bt_master.LST_NAME))
btcode2omschrijving = dict(zip(bt_master.bt_code, bt_master.LST_NAME))
# Get default mnp draagkracht values
mnp_dk_src = r'w:\PROJECTS\qmar\MNP-SNL-ParameterSet\Parameters_v06_2019_12_09\03_MNP_versie6_par_density_factors_BT2019_v2.csv'
......@@ -71,7 +72,9 @@ def plant_dk(ffargs):
except (ValueError, FileNotFoundError, AssertionError) as e:
raise AssertionError('cannot read beheertypen source: {}. Check for column Land_type_code!'.format(e))
bts['bt_code'] = bts.Land_type_code.apply(fix_bt, as_mnp=True) # Add MNP-style Beheertype codes
bts.drop_duplicates(subset='bt_code', inplace=True)
bts.drop_duplicates(subset='bt_code', inplace=True) # Drop duplicates
if set(bts.bt_code).difference((set(bt_master.bt_code))):
raise AssertionError("Invalid Beheertypen found: {}".format(set(bts.bt_code).difference((set(bt_master.bt_code)))))
# Map 1 beheertype to list of Associaties
bt2asso = dict.fromkeys(bts.bt_code, [])
......
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