UMEP-dev / UMEP-processing

7 stars 9 forks source link

SOLWEIG SCRIPT #15

Closed Axou973 closed 1 year ago

Axou973 commented 1 year ago

Hello, I wrote the same script provided by SOLWEIG to generate various folders with Tmrt results. I added 2 loops and it works. But at the end, when I open the output folder, I have only the Tmrt average and not the other Trmrt for the ohers hours. I tried for one raster map named C07 and weather text current. Let me explain the code : For each period, I want to calculate all the temperatures (Tmrt) for a day (1AM, 2AM...) and load the results in a folder for each maps (A01,...) by period. Can you check my script please ? Thank you for your help

liste complète des noms de dalles

tiles_full = ['A01', 'B01', 'C01', 'D01', 'E01', 'F01', 'G01', 'A02', 'B02', 'C02', 'D02', 'E02', 'F02', 'G02', 'A03', 'B03', 'C03', 'D03', 'E03', 'F03', 'G03', 'A04', 'B04', 'C04', 'D04', 'E04', 'F04', 'G04', 'A05', 'B05', 'C05', 'D05', 'E05', 'F05', 'G05', 'A06', 'B06', 'C06', 'D06', 'E06', 'F06', 'G06', 'A07', 'B07', 'C07', 'D07', 'E07', 'F07', 'G07', 'A08', 'B08', 'C08', 'D08', 'E08', 'F08', 'G08', 'A09', 'B09', 'C09', 'D09', 'E09', 'F09', 'G09', 'A10', 'B10', 'C10', 'D10', 'E10', 'F10', 'G10'] periods_full = ['01-CURRENT', '02-MID-CENTURY', '03-END-CENTURY'] tiles = ['C07']# tiles_full periods = ['01-CURRENT']# periods_full

chemins

root_path = 'C:/Users/name/Desktop/WORK/' root_folder_dblslash = "C:\Users\name\Desktop\WORK\"

tmr_folder_path = root_folder_dblslash + 'A07-TMR\00-DALLES\' dsm_path = rootpath + 'A01-DSM/DSM' cdsm_path = root_path + 'A02-CDSMTDSM/CDSM' tdsm_path = root_path + 'A02-CDSMTDSM/TDSM' dem_path = root_path +'02-DEM/03-DEMTIFF/DEM' svf_folder = root_folder_dblslash + 'A03-SVF\' lc_path = rootpath + '05-LANDCOVER/06-LC/LC' wallHeight_path = rootpath + 'A04-WALLS/wallHeight' wallAspect_path = rootpath + 'A04-WALLS/wallAspect' met_path = root_path + 'A05-METEO\02-METEO_UMEP_14JUL\'

for period in periods:

met_file = met_path + period + '_14jul.txt'

for tile in tiles:

    # fichiers d'entrée sortie
    dsm_file = dsm_path + tile + '.tif'
    cdsm_file = cdsm_path + tile + '.tif'
    tdsm_file = tdsm_path + tile + '.tif'
    dem_file = dem_path + tile +'.tif'
    lc_file = lc_path + tile +'.tif'
    wallHeight_file = wallHeight_path + tile + '.tif'
    wallAspect_file = wallAspect_path + tile + '.tif'
    svf_zip = svf_folder + tile + '\\svfs.zip'
    aniso_file = svf_folder + tile + '\\shadowmats.npz'

    #output_dir = test_folder_dblslash + "TRM"
    output_dir = tmr_folder_path + period + '\\' + tile + '\\'

    print(tile)
    # go!
    processing.run("umep:Outdoor Thermal Comfort: SOLWEIG",
                   {'INPUT_DSM':dsm_file,\
                    'INPUT_SVF':svf_zip,\
                    'INPUT_HEIGHT':wallHeight_file,\
                    'INPUT_ASPECT':wallAspect_file,\
                    'INPUT_CDSM':cdsm_file,\
                    'TRANS_VEG':3,\
                    'INPUT_TDSM':tdsm_file,\
                    'INPUT_THEIGHT':25,\
                    'INPUT_LC':lc_file,\
                    'USE_LC_BUILD':False,\
                    'INPUT_DEM':dem_file,\
                    'SAVE_BUILD':False,\
                    'INPUT_ANISO':aniso_file,\
                    'ALBEDO_WALLS':0.2,\
                    'ALBEDO_GROUND':0.15,\
                    'EMIS_WALLS':0.9,\
                    'EMIS_GROUND':0.95,\
                    'ABS_S':0.7,\
                    'ABS_L':0.95,\
                    'POSTURE':0,\
                    'CYL':True,\
                    'INPUTMET':met_file,\
                    'ONLYGLOBAL':False,\
                    'UTC':1,\
                    'POI_FILE':None,'POI_FIELD':'','AGE':35,'ACTIVITY':80,'CLO':0.9,'WEIGHT':75,'HEIGHT':180,'SEX':0,'SENSOR_HEIGHT':10,\
                    'OUTPUT_TMRT':False,\
                    'OUTPUT_KDOWN':False,'OUTPUT_KUP':False,'OUTPUT_LDOWN':False,'OUTPUT_LUP':False,\
                    'OUTPUT_SH':False,\
                    'OUTPUT_TREEPLANTER':False,\
                    'OUTPUT_DIR':output_dir})
gusbacos commented 1 year ago

Hi,

Ok! I see that you have put 'OUTPUT_TMRT' : False, in the settings for running SOLWEIG, try set it to True as shown below. There are also other outputs that you can set to True if you want to have additional output.

processing.run("umep:Outdoor Thermal Comfort: SOLWEIG",
               {'INPUT_DSM':dsm_file,\
                'INPUT_SVF':svf_zip,\
                'INPUT_HEIGHT':wallHeight_file,\
                'INPUT_ASPECT':wallAspect_file,\
                'INPUT_CDSM':cdsm_file,\
                'TRANS_VEG':3,\
                'INPUT_TDSM':tdsm_file,\
                'INPUT_THEIGHT':25,\
                'INPUT_LC':lc_file,\
                'USE_LC_BUILD':False,\
                'INPUT_DEM':dem_file,\
                'SAVE_BUILD':False,\
                'INPUT_ANISO':aniso_file,\
                'ALBEDO_WALLS':0.2,\
                'ALBEDO_GROUND':0.15,\
                'EMIS_WALLS':0.9,\
                'EMIS_GROUND':0.95,\
                'ABS_S':0.7,\
                'ABS_L':0.95,\
                'POSTURE':0,\
                'CYL':True,\
                'INPUTMET':met_file,\
                'ONLYGLOBAL':False,\
                'UTC':1,\
                'POI_FILE':None,'POI_FIELD':'','AGE':35,'ACTIVITY':80,'CLO':0.9,'WEIGHT':75,'HEIGHT':180,'SEX':0,'SENSOR_HEIGHT':10,\
                'OUTPUT_TMRT':True,\
                'OUTPUT_KDOWN':False,'OUTPUT_KUP':False,'OUTPUT_LDOWN':False,'OUTPUT_LUP':False,\
                'OUTPUT_SH':False,\
                'OUTPUT_TREEPLANTER':False,\
                'OUTPUT_DIR':output_dir})