Commit ee5c212b authored by Roelofsen, Hans's avatar Roelofsen, Hans
Browse files

timestamp in batch script

parent a8980b22
......@@ -7,7 +7,7 @@ call c:\Users\roelo008\Miniconda3\Scripts\activate.bat
call conda activate mrt
REM OUTPUTS
SET jaar=2019
SET jaar=2018
SET og_vlak_out=OG%jaar%_vlak_250cm.tif
SET og_lijn_out=OG%jaar%_lijn_250cm.tif
SET BBOut=BB%jaar%_250cm.tif
......@@ -26,6 +26,8 @@ REM minimum aantal 2.5m cellen in een 25m cel voor kwalificatie als gesloten
SET drempelwaarde_vlakken=30
SET drempelwaarde_lijnen=8
SET timestamp=%date:~0, 4%%date:~5,2%%date:~8,2%t%time:~0,2%%time:~3,2%%time:~6,2%
REM Opgaand Groen
gdal_rasterize -at -l Vlakken -of GTiff -te 10000 300000 280000 625000 -tr 2.5 2.5 -ts 108000 130000 -ot Byte -a_srs epsg:28992 -co COMPRESS=LZW -burn 1 %OGDir%/MonitoringsbronOpgaandGroen_0101%jaar%.gdb %scratch_dir%/%og_vlak_out%
gdal_rasterize -at -l Lijnen -of GTiff -te 10000 300000 280000 625000 -tr 2.5 2.5 -ts 108000 130000 -ot Byte -a_srs epsg:28992 -co COMPRESS=LZW -burn 1 %OGDir%/MonitoringsbronOpgaandGroen_0101%jaar%.gdb %scratch_dir%/%og_lijn_out%
......@@ -42,20 +44,20 @@ ogr2ogr -sql "SELECT * FROM INRICHTINGSELEMENT_LIJN WHERE TYPEINRICHTINGSELEMENT
gdal_rasterize -at -of GTiff -te 10000 300000 280000 625000 -tr 2.5 2.5 -ts 108000 130000 -ot Byte -a_srs epsg:28992 -co COMPRESS=LZW -burn 1 %scratch_dir%/%T10LOut%.shp %scratch_dir%/%T10LOut%.tif
REM Add vlakvormige bronrasters together
python "%gdal_dir%/gdal_calc.py" -co COMPRESS=LZW -A %scratch_dir%/%og_vlak_out% -B %scratch_dir%/%BBOut% -C %scratch_dir%/%T10VOut%.tif --outfile=%scratch_dir%/vlakken_%jaar%_combi.tif --calc="numpy.where((A+B+C)>=1, 1, 0)"
python "%gdal_dir%/gdal_calc.py" --co COMPRESS=LZW -A %scratch_dir%/%og_vlak_out% -B %scratch_dir%/%BBOut% -C %scratch_dir%/%T10VOut%.tif --outfile=%scratch_dir%/vlakken_%jaar%_combi.tif --calc="numpy.where((A+B+C)>=1, 1, 0)"
REM Add lijnvormige bronrasters together
python "%gdal_dir%/gdal_calc.py" -co COMPRESS=LZW -A %scratch_dir%/%og_lijn_out% -B %scratch_dir%/%T10LOut%.tif --outfile=%scratch_dir%/lijnen_%jaar%_combi.tif --calc="numpy.where((A+B)>=1, 1, 0)"
python "%gdal_dir%/gdal_calc.py" --co COMPRESS=LZW -A %scratch_dir%/%og_lijn_out% -B %scratch_dir%/%T10LOut%.tif --outfile=%scratch_dir%/lijnen_%jaar%_combi.tif --calc="numpy.where((A+B)>=1, 1, 0)"
REM Aggregate lijnen and vlakken to 25m with SUM aggregation method
gdalwarp -co COMPRESS=LZW -tr 25 25 -te 10000 300000 280000 625000 -r sum %scratch_dir%/vlakken_%jaar%_combi.tif %scratch_dir%/vlakken_combi_%jaar%_25m.tif
gdalwarp -co COMPRESS=LZW -tr 25 25 -te 10000 300000 280000 625000 -r sum %scratch_dir%/lijnen_%jaar%_combi.tif %scratch_dir%/lijnen_combi_%jaar%_25m.tif
REM Apply treshold
python "%gdal_dir%/gdal_calc.py" -co COMPRESS=LZW -A %scratch_dir%/vlakken_combi_%jaar%_25m.tif --outfile=%scratch_dir%/vlakken_%jaar%_gte_th.tif --calc="numpy.where(A >= %drempelwaarde_vlakken%, 1, 0)"
python "%gdal_dir%/gdal_calc.py" -co COMPRESS=LZW -A %scratch_dir%/lijnen_combi_%jaar%_25m.tif --outfile=%scratch_dir%/lijnen_%jaar%_gte_th.tif --calc="numpy.where(A >= %drempelwaarde_lijnen%, 1, 0)"
python "%gdal_dir%/gdal_calc.py" --co COMPRESS=LZW -A %scratch_dir%/vlakken_combi_%jaar%_25m.tif --outfile=%scratch_dir%/vlakken_%jaar%_gte_th.tif --calc="numpy.where(A >= %drempelwaarde_vlakken%, 1, 0)"
python "%gdal_dir%/gdal_calc.py" --co COMPRESS=LZW -A %scratch_dir%/lijnen_combi_%jaar%_25m.tif --outfile=%scratch_dir%/lijnen_%jaar%_gte_th.tif --calc="numpy.where(A >= %drempelwaarde_lijnen%, 1, 0)"
REM Combine. Output pxl value 2 means 'gesloten' 1 means 'open'.
python "%gdal_dir%/gdal_calc.py" -co COMPRESS=LZW --format EHdr --type Float32 -A %scratch_dir%/vlakken_%jaar%_gte_th.tif -B %scratch_dir%/lijnen_%jaar%_gte_th.tif --outfile=%OutDir%/opgaande_elementen_%jaar%.flt --calc="numpy.where((A+B) >=1, 2, 1)"
python "%gdal_dir%/gdal_calc.py" --co COMPRESS=LZW --format EHdr --type Float32 -A %scratch_dir%/vlakken_%jaar%_gte_th.tif -B %scratch_dir%/lijnen_%jaar%_gte_th.tif --outfile=%OutDir%/opgaande_elementen_%jaar%_%timestamp%.flt --calc="numpy.where((A+B) >=1, 2, 1)"
pause
\ No newline at end of file
Markdown is supported
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