Index: wflow-py/Scripts/shptoraster.py =================================================================== diff -u -r9dd1a78b1a2e6aa0e67e970d6235e4923b8bfc42 -r325bb5b03289359b9ad2c8b814e66c0bd0d53dd7 --- wflow-py/Scripts/shptoraster.py (.../shptoraster.py) (revision 9dd1a78b1a2e6aa0e67e970d6235e4923b8bfc42) +++ wflow-py/Scripts/shptoraster.py (.../shptoraster.py) (revision 325bb5b03289359b9ad2c8b814e66c0bd0d53dd7) @@ -4,6 +4,7 @@ import getopt import ConfigParser import sys + """ This scripts converst the hbv shape file to raster maps for the distributed version of HBV. @@ -16,46 +17,59 @@ nname = os.path.splitext(os.path.basename(shpfile))[0] # In this dictionary the fiedl in the dbf is linked to the filename in the .map -pars = {"BETA": "BetaSeepage", - "CFMAX": "Cfmax_org", - "ALFA": "AlphaNL", - "FOCFMAX": "FOCFMAX", - "TTI" : "TTI", - "WHC" : "WHC", - "TT" : "TT", - "PERC" : "PERC", - "K4" :"K4", - "FC" : "FC", - "KHQ" : "KHQ", - "LP": "LP", - "HQ" : "HQ", - "CFR" : "CFR", - "CEVPFO" : "CEVPFO", - "EPF" : "EPF", - "RFCF" : "RFCF", - "CFLUX" : "Cflux", - "SFCF" : "SFCF", - "ICFI" : "ICFI", - "PCORR_" : "Pcorr", - "ECORR" : "ECORR", - "ICFO" : "ICFO" +pars = { + "BETA": "BetaSeepage", + "CFMAX": "Cfmax_org", + "ALFA": "AlphaNL", + "FOCFMAX": "FOCFMAX", + "TTI": "TTI", + "WHC": "WHC", + "TT": "TT", + "PERC": "PERC", + "K4": "K4", + "FC": "FC", + "KHQ": "KHQ", + "LP": "LP", + "HQ": "HQ", + "CFR": "CFR", + "CEVPFO": "CEVPFO", + "EPF": "EPF", + "RFCF": "RFCF", + "CFLUX": "Cflux", + "SFCF": "SFCF", + "ICFI": "ICFI", + "PCORR_": "Pcorr", + "ECORR": "ECORR", + "ICFO": "ICFO", } os.system('pcrcalc "nilmap.map=scalar(if(cutout.map>99,10))"') os.system("gdal_translate -of GTiff nilmap.map " + " subcatch.tif") -os.system("gdal_rasterize -a ID -l " + nname + " " + shpfile + " subcatch.tif") +os.system("gdal_rasterize -a ID -l " + nname + " " + shpfile + " subcatch.tif") os.system("gdal_translate -of PCRaster subcatch.tif subcatch.map") - + for zz in pars: print pars[zz] os.system("gdal_translate -of GTiff nilmap.map " + pars[zz] + ".tif") - os.system("gdal_rasterize -a " + zz + " -l " + nname + " " + shpfile + " " + pars[zz] + ".tif") + os.system( + "gdal_rasterize -a " + + zz + + " -l " + + nname + + " " + + shpfile + + " " + + pars[zz] + + ".tif" + ) os.system("gdal_translate -of PCRaster " + pars[zz] + ".tif " + pars[zz] + ".map") # now some specifics -forest=3 +forest = 3 -os.system("pcrcalc \"CEVPF.map=if(wflow_landuse.map == 3, CEVPFO.map, 1.0)\"") -os.system("pcrcalc \"ICF.map=if(wflow_landuse.map == 3, ICFO.map, ICFI.map)\"") -os.system("pcrcalc \"Cfmax.map=if(wflow_landuse.map == 3, Cfmax_org.map * FOCFMAX.map, Cfmax_org.map)\"") -os.system("pcrcalc \"ECORR.map=ECORR.map * 10.0\"") \ No newline at end of file +os.system('pcrcalc "CEVPF.map=if(wflow_landuse.map == 3, CEVPFO.map, 1.0)"') +os.system('pcrcalc "ICF.map=if(wflow_landuse.map == 3, ICFO.map, ICFI.map)"') +os.system( + 'pcrcalc "Cfmax.map=if(wflow_landuse.map == 3, Cfmax_org.map * FOCFMAX.map, Cfmax_org.map)"' +) +os.system('pcrcalc "ECORR.map=ECORR.map * 10.0"')