Skip to content
Snippets Groups Projects
Commit 8c0d57ea authored by Roelofsen, Hans's avatar Roelofsen, Hans
Browse files

Merge branch 'working_20230228' into 'master'

corresponding update to class

See merge request !14
parents d1485756 753c71cf
Branches
No related tags found
1 merge request!14corresponding update to class
......@@ -17,24 +17,28 @@ filepath = pathlib.Path(__file__)
benb_dir = os.path.dirname(filepath)
csv_file = os.path.join(benb_dir, 'resources/snl_beheertypen.csv')
def get_snl_beheertypen_list(csv_target=csv_file, of='sparse'):
def get_snl_beheertypen_list(of='sparse'):
"""
return snl beheertypen list as pandas df
:param benb_dir: directory of benb_utils
:return: pandas dataframe
"""
csv_target = os.path.join(pathlib.Path(__file__).parents[0],
'resources', 'snl_beheertypen.csv')
df = pd.read_csv(csv_target, sep=',', comment='#', quotechar='"')
mnp_codes = df.LAND_TYPE_CODE.apply(fbt.fix_bt, as_mnp=True)
mnp_codes = df.land_type_code.apply(fbt.fix_bt, as_mnp=True)
return {'full': df.assign(mnp_code=mnp_codes),
'sparse': df}[of]
df = pd.read_csv(csv_file, sep=',', comment='#', quotechar='"')
code2name = dict(zip(df.LAND_TYPE_CODE.apply(fbt.fix_bt, as_mnp=True),
df.LST_NAME))
code2name = dict(zip(df.land_type_code.apply(fbt.fix_bt, as_mnp=True),
df.land_type_name))
code2code_name = dict(zip(df.LAND_TYPE_CODE.apply(fbt.fix_bt, as_mnp=True),
df.LST_CODE_NAME))
code2code_name = dict(zip(df.land_type_code.apply(fbt.fix_bt, as_mnp=True),
df.land_type_code_name))
# TODO: hier moet eigenlijk een functie komen als:
# def code2anythin(code)
......@@ -47,8 +51,8 @@ code2code_name = dict(zip(df.LAND_TYPE_CODE.apply(fbt.fix_bt, as_mnp=True),
def btcode2description(code):
# Note: dit hoeft niet perse in een functie te staan.
try:
return dict(zip(df.LAND_TYPE_CODE.apply(fbt.fix_bt, as_mnp=True),
df.LST_NAME))[fbt.fix_bt(code, as_mnp=True)]
return dict(zip(df.land_type_code.apply(fbt.fix_bt, as_mnp=True),
df.land_type_name))[fbt.fix_bt(code, as_mnp=True)]
except KeyError as e:
print('\n{} is not a valid beheertype\n'.format(code))
sys.exit(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment