UMEP-dev / UMEP

Urban Multi-scale Environmental Predictor
https://umep-docs.readthedocs.io/
59 stars 15 forks source link

kernel problem supy 2022.4.7 #415

Closed Empanag closed 2 years ago

Empanag commented 2 years ago

Describe the bug i have the following problem using cmd also with jupyter notebook when i run supy


2020-06-25 23:00:00
2022-05-12 02:59:08,890 - SuPy - INFO - All cache cleared.
2022-05-12 02:59:21,753 - SuPy - INFO - All cache cleared.
2022-05-12 02:59:34,403 - SuPy - INFO - ====================
2022-05-12 02:59:34,404 - SuPy - INFO - Simulation period:
2022-05-12 02:59:34,404 - SuPy - INFO -   Start: 2020-06-25 02:05:00
2022-05-12 02:59:34,405 - SuPy - INFO -   End: 2020-06-27 02:00:00
2022-05-12 02:59:34,406 - SuPy - INFO - 
2022-05-12 02:59:34,406 - SuPy - INFO - No. of grids: 8976
2022-05-12 02:59:34,407 - SuPy - INFO - SuPy is running in serial mode
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\supy\_run.py:369, in run_supy_ser(df_forcing, df_state_init, save_state, chunk_day)
    368 try:
--> 369     list_res = [
    370         suews_cal_tstep_multi(input_grid, df_forcing)
    371         for input_grid in list_input
    372     ]
    373     list_state_end, list_output_array = zip(*list_res)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\supy\_run.py:370, in <listcomp>(.0)
    368 try:
    369     list_res = [
--> 370         suews_cal_tstep_multi(input_grid, df_forcing)
    371         for input_grid in list_input
    372     ]
    373     list_state_end, list_output_array = zip(*list_res)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\supy\_run.py:112, in suews_cal_tstep_multi(dict_state_start_grid, df_met_forcing_block)
     96 dict_input.update(
     97     {
     98         "metforcingblock": np.array(
   (...)
    110     }
    111 )
--> 112 dict_input = {k: dict_input[k] for k in list_var_input_multitsteps}
    114 # for var in dict_input:
    115 #     print(var)
    116 #     print(dict_input[var])
    117 #     print(dict_input[var].shape, '\n')
    118 
    119 # main calculation:

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\supy\_run.py:112, in <dictcomp>(.0)
     96 dict_input.update(
     97     {
     98         "metforcingblock": np.array(
   (...)
    110     }
    111 )
--> 112 dict_input = {k: dict_input[k] for k in list_var_input_multitsteps}
    114 # for var in dict_input:
    115 #     print(var)
    116 #     print(dict_input[var])
    117 #     print(dict_input[var].shape, '\n')
    118 
    119 # main calculation:

KeyError: 'diagmethod'

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
Input In [5], in <module>
     26 print(start_date)
     27 dataf(start_date,filefolder,dfmetdata)
---> 28 suews_out=suews(filefolder)
     29 tiffs(filefolder,suews_out)
     30 del suews_out

Input In [3], in suews(filefolder)
    454 grid = df_state_init.index[0]
    455 df_forcing = sp.load_forcing_grid(path_runcontrol, grid)  
--> 456 df_output,df_state_final=sp.run_supy(df_forcing,df_state_init)#,chunk_day=1)
    458 #df_output,df_state_final=sp.run_supy(df_forcing,df_state_init,chunk_day=10)
    459 #print("ok")
    460 path_dir_save=filefolder+"resultstxt"

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\supy\_supy_module.py:370, in run_supy(df_forcing, df_state_init, save_state, chunk_day, logging_level, check_input, serial_mode)
    368 else:
    369     logger_supy.info(f"SuPy is running in serial mode")
--> 370     df_output, df_state_final = run_supy_ser(
    371         df_forcing, df_state_init, save_state, chunk_day
    372     )
    374 # show simulation time
    375 end = time.time()

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\supy\_run.py:376, in run_supy_ser(df_forcing, df_state_init, save_state, chunk_day)
    373     list_state_end, list_output_array = zip(*list_res)
    375 except:
--> 376     raise RuntimeError("SUEWS kernel error")
    378 # collect output arrays
    379 dict_output = {
    380     grid: dict_output_array
    381     for grid, dict_output_array in zip(list_grid, list_output_array)
    382 }

RuntimeError: SUEWS kernel error

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Desktop (please complete the following information):

Empanag commented 2 years ago

This is from cmd

Traceback (most recent call last):
  File "C:\Users\RSLab20Emm\AppData\Local\Programs\Python\Python39\lib\site-packages\supy\_run.py", line 369, in run_supy_ser
    list_res = [
  File "C:\Users\RSLab20Emm\AppData\Local\Programs\Python\Python39\lib\site-packages\supy\_run.py", line 370, in <listcomp>
    suews_cal_tstep_multi(input_grid, df_forcing)
  File "C:\Users\RSLab20Emm\AppData\Local\Programs\Python\Python39\lib\site-packages\supy\_run.py", line 112, in suews_cal_tstep_multi
    dict_input = {k: dict_input[k] for k in list_var_input_multitsteps}
  File "C:\Users\RSLab20Emm\AppData\Local\Programs\Python\Python39\lib\site-packages\supy\_run.py", line 112, in <dictcomp>
    dict_input = {k: dict_input[k] for k in list_var_input_multitsteps}
KeyError: 'diagmethod'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\SUEWSapp\testirrig\7-ir-25sm9-10-11-12\suews.py", line 639, in <module>
    suews_out=suews(filefolder)
  File "E:\SUEWSapp\testirrig\7-ir-25sm9-10-11-12\suews.py", line 453, in suews
    df_output,df_state_final=sp.run_supy(df_forcing,df_state_init,chunk_day=1)
  File "C:\Users\RSLab20Emm\AppData\Local\Programs\Python\Python39\lib\site-packages\supy\_supy_module.py", line 370, in run_supy
    df_output, df_state_final = run_supy_ser(
  File "C:\Users\RSLab20Emm\AppData\Local\Programs\Python\Python39\lib\site-packages\supy\_run.py", line 376, in run_supy_ser
    raise RuntimeError("SUEWS kernel error")
RuntimeError: SUEWS kernel error
sunt05 commented 2 years ago

Thanks for reporting the issue–which seems to be my bad that a test/dev version was somehow released a formal one.

The solution is simple:

  1. if you are using SUEWS input text files as the input for SuPy, add this line to the RunControl.nml file: diagmethod=2 (here can be one of 0 (MOST),1 (RSL) or 2 (automatically determined); use 2 for now).

  2. if you are using df_state for a previous version of SuPy, modify your df_state this way:

df_state_new= df_state.copy()
df_state_new.loc[:,('diagmethod','0')]=2

hope this helps.

Empanag commented 2 years ago

I did the first and i have the problem with temperature again this is the calculated from suews values image

the map to see in some areas the problem image my data SUEWS_Soil.zip

sunt05 commented 2 years ago

Please just pack your df_state and df_forcing into pickle files (e.g. df_state.to_pickle(“df_state.pkl”) and upload them here. Thanks!

Sent from my iPhone

On 14 May 2022, at 21:28, Emmanouil Panagiotakis @.***> wrote:  I did the first and i have the problem with temperature again this is the calculated from suews values

the map to see in some areas the problem

my data SUEWS_Soil.zip

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were assigned.

Empanag commented 2 years ago

Okey i tried to find df_state but i have only df_state_init propably the same i attach both forcing and state

7-ir-25sm9-10-11-12.zip

sunt05 commented 2 years ago

Okey i tried to find df_state but i have only df_state_init propably the same i attach both forcing and state

7-ir-25sm9-10-11-12.zip

Thanks! df_state_init is good: I used a simple form for it in the post above.

Also please follow the new issue opened in the SuPy repo and I'll close this one as the original issue has been addressed.