From 5a68c310397ff0ca583571350b3220dd72e8c72e Mon Sep 17 00:00:00 2001 From: Hans Roelofsen <hans.roelofsen@wur.nl> Date: Mon, 5 Jun 2023 10:18:04 +0200 Subject: [PATCH] minor updates geslotenheid postprocessing --- sample/geslotenheid/brondata.yml | 4 ++-- .../geslotenheid/postprocessing/openheid2indictorv2.py | 10 +++++----- sample/geslotenheid/prep_opgaande_elementen_dummy.bat | 2 +- sample/vs/gen_runfiles.py | 2 +- sample/vs/python_quickstart_client.py | 3 ++- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sample/geslotenheid/brondata.yml b/sample/geslotenheid/brondata.yml index 281dea5..0d1d788 100644 --- a/sample/geslotenheid/brondata.yml +++ b/sample/geslotenheid/brondata.yml @@ -63,8 +63,8 @@ brondata: vlak: Terrein_Vlak lijn: Inrichtingselement_Lijn bebouwing: - gdb: w:\projects\Landschapsmonitor\cIndicatoren\Bebouwing\geodata\leveringPPK_20230323\monitoringsbron_bebouwing_2022_V01.gdb - vlak: monitoringsbron_bebouwing_2023_V01 + gdb: w:\projECTS\Landschapsmonitor\cIndicatoren\Bebouwing\geodata\leveringPPK_20230515\monitoringsbron_bebouwing_2022_V03.gdb + vlak: monitoringsbron_bebouwing_2022_V03 groen: gdb: w:\projECTS\Landschapsmonitor\cIndicatoren\OpgaandGroen\a_Geodata\leveringPPK20230320\monitoringsbron_opgaandgroen_2022_V01.gdb vlak: Vlakken diff --git a/sample/geslotenheid/postprocessing/openheid2indictorv2.py b/sample/geslotenheid/postprocessing/openheid2indictorv2.py index 14f3aa2..11c08f9 100644 --- a/sample/geslotenheid/postprocessing/openheid2indictorv2.py +++ b/sample/geslotenheid/postprocessing/openheid2indictorv2.py @@ -68,7 +68,7 @@ def to_indicator( openB = rio.open(year_b_src) # Output specs - out_file_name = "verschilgrid_openheid_{0}_{1}_V01.shp".format(yearA, yearB) + out_file_name = "verschilgrid_openheid_{0}_{1}".format(yearA, yearB) out_dir = os.path.join(out_dir, f"vergelijking{yearA}{yearB}") if not os.path.isdir(out_dir): os.mkdir(out_dir) @@ -118,12 +118,12 @@ def to_indicator( diff_class = diff_ha.apply(classify, arr=bins, class_names=classes) # Append to grid shapefile and write to file - grid["avg{}".format(yearA)] = gemA_ha - grid["avg{}".format(yearB)] = gemB_ha + grid["avg_beginjaar".format(yearA)] = gemA_ha + grid["avg_eindjaar".format(yearB)] = gemB_ha grid["count{}".format(yearA)] = countA grid["count{}".format(yearB)] = countB grid["diff_perc"] = diff_perc - grid["diff_ha"] = diff_ha + grid["verandering_openheid"] = diff_ha grid["indicator"] = diff_class # copy van bovenstaande, maar nu grid["src_{}".format(yearA)] = os.path.basename(openA.name) grid["src_{}".format(yearB)] = os.path.basename(openB.name) @@ -133,7 +133,7 @@ def to_indicator( # Write to file. Drop provincie column, this is added by ESRI later grid.drop(labels=["provincien"], axis=1).set_crs( "epsg:28992", allow_override=True - ).to_file(os.path.join(out_dir, out_file_name)) + ).to_file(os.path.join(out_dir, f'{out_file_name}.gpkg'), layer=out_file_name) if __name__ == "__main__": diff --git a/sample/geslotenheid/prep_opgaande_elementen_dummy.bat b/sample/geslotenheid/prep_opgaande_elementen_dummy.bat index 8d2dfd3..1c57715 100644 --- a/sample/geslotenheid/prep_opgaande_elementen_dummy.bat +++ b/sample/geslotenheid/prep_opgaande_elementen_dummy.bat @@ -45,7 +45,7 @@ SET BB_sel='bunker', 'kas, warenhuis', 'BAG-pand', 'open loods', 'opslagtank', ' SET T10Vlak_sel='fruitkwekerij', 'boomgaard', 'boomkwekerij', 'dodenakker met bos' SET T10Lijn_sel='muur', 'geluidswering' -call c:\Users\roelo008\AppData\Local\miniconda3\Scripts\activate.bat +call c:\apps\utilities\miniconda3\Scripts\activate.bat call conda activate vs REM Use python script get proper timestamp diff --git a/sample/vs/gen_runfiles.py b/sample/vs/gen_runfiles.py index 25d8374..2c99663 100644 --- a/sample/vs/gen_runfiles.py +++ b/sample/vs/gen_runfiles.py @@ -13,7 +13,7 @@ parser = argparse.ArgumentParser(description='Generate INI files for Viewscape. parser.add_argument('--np', help='number of points in viewpoints SHP (pnts_100m_v2021.shp)', type=int, default=4210049) parser.add_argument('--nb', help='number of ini files to create', type=int, default=100) parser.add_argument('--projectname', help='project settings ini file name', type=str, default='Param_aug2011.ini') -parser.add_argument('--casename', help='', default='ViewScape01') +parser.add_argument('--casename', help='?', default='ViewScape01') parser.add_argument('--viewpointsfilename', help='viewpoints SHP', default='pnts_100m_v2021.shp') parser.add_argument('--landscapegridname', help='opgaande elementen FLT', default='gesloten_2017.flt') parser.add_argument('--typeheighttablename', help='DBF w height per LU class', default='Hoogten12.dbf') diff --git a/sample/vs/python_quickstart_client.py b/sample/vs/python_quickstart_client.py index 872f126..aedfb30 100644 --- a/sample/vs/python_quickstart_client.py +++ b/sample/vs/python_quickstart_client.py @@ -400,7 +400,8 @@ if __name__ == "__main__": import argparse - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(description="Run Viewscape in batch on MS Azure. Requires convig_V2023.py.", + formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "--time", help="time out period in minutes", type=int, default=30 ) -- GitLab