IndEcol / RECC-ODYM

The RECC model
MIT License
21 stars 10 forks source link

FileNotFoundError: \RECC_ParameterDict files #34

Closed CBreton026 closed 2 years ago

CBreton026 commented 2 years ago

Hi,

First of all, thank you for publishing and maintaining this repository. I recently installed a copy of ODYM-RECC to explore the model, run some scenarios for Canada, and see how I could use ODYM-RECC for my PhD.

However, when I launch 'ODYM_RECC_Main.py' with the config file 'RECC_Config_V2_4.xlsx', I get the following error: FileNotFoundError: [Errno 2] No such file or directory: '~\\ODYM\\RECC-Database\\ODYM_RECC_v2_4_Database\\RECC_ParameterDict_Global_North.dat'

I looked in the ODYM_RECC_v2_4_Database (https://zenodo.org/record/4671644#.Yfl8EOrMIhQ) to try and change the path if necessary, but I couldn't find any RECCParameterDict files for the different regions. I also looked at previous versions of the database (v2_2, https://zenodo.org/record/3566865#.Yfl7uurMIhQ), but they do not seem to include the ParamaterDict files.

Could you help me figure out this issue? Are the ParameterDict files confidential? Best regards,

stefanpauliuk commented 2 years ago

Hi Charles, parsing all parameters takes a long time, which is why the RECC model dumps the parsed parameter data into a .dat file (pickle dump) and uses this .dat file if it can find one.

If you have never run the model before, there is of course no dat file, and RECC will read the parameters instead. This is done automatically with a try/except clause, which is why I am surprised that you get this error. Exactly which line of code throws the error?

CBreton026 commented 2 years ago

Hi Stefan,

Thank you for these precisions. Indeed, the error happens in the try/except clause on line 210: ParFileObject = open(ParFileName,'rb'). I tried to launch the main script again, but received the same error (see below).

However, after reviewing it, I think my original question was misleading. Apparently, the FileNotFoundError is thrown as __context__ for the ValueError thrown by ReadParameterXLSX on line 224 (cf Exception context).

I looked at ReadParameterXLSX to understand why the ValueError comes up, but I still haven't figured it out.

  File "~/buildingStockModel/ODYM/RECC-master/ODYM_RECC_Main.py", line 210, in <module>
    ParFileObject = open(ParFileName,'rb')

FileNotFoundError: [Errno 2] No such file or directory: '~\\buildingStockModel\\ODYM\\RECC-Database\\ODYM_RECC_v2_4_Database\\RECC_ParameterDict_Global_North.dat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "~\Local\Temp/ipykernel_24996/2352939797.py", line 1, in <module>
    runfile('~/buildingStockModel/ODYM/RECC-master/ODYM_RECC_Main_backup.py', wdir='~/buildingStockModel/ODYM/RECC-master')

  File "~\Anaconda3\envs\py39\lib\site-packages\debugpy\_vendored\pydevd\_pydev_bundle\pydev_umd.py", line 167, in runfile
    execfile(filename, namespace)

  File "~\Anaconda3\envs\py39\lib\site-packages\debugpy\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
    exec(compile(contents + "\n", file, 'exec'), glob, loc)

  File "~/buildingStockModel/ODYM/RECC-master/ODYM_RECC_Main_backup.py", line 224, in <module>
    MetaData, Values = msf.ReadParameterXLSX(ParPath, PL_Names[mo], PL_IndexStructure[mo], PL_IndexMatch[mo],

  File "~\buildingStockModel\ODYM\ODYM-master\odym\modules\ODYM_Functions.py", line 1176, in ReadParameterXLSX
    Values[tuple(TargetPosition)] = ValuesSheet.cell(m + RowOffset+1, n + ColOffset+1).value

ValueError: could not convert string to float: '#REF!'
CBreton026 commented 2 years ago

Hi Stefan,

I think I found the problem. There seems to be an error in the ODYM_RECC_v2_4_Database '3_EI_Products_UsePhase_resbuildings.xlsx' file. Specifically, in row 698, cols BM-BQ (65-69), there is a formula error (#REF!):

Correcting the #REF! error fixed the problem. Am I correct assuming that the #REF! value should be E698 as well? Are the SSP1 values for China scaled by the same factor as the USA SSP1 values?

stefanpauliuk commented 2 years ago

Hi Charles, yes this is the right fix indeed!

It is unclear to me how and when the #REF error came into the database. Obviously, when we calculated our results, it was not there, else the import routine would have crashed, as you experienced.