cyrillefrancois / openlca2bw

Other
9 stars 5 forks source link

Agribalyse 3.0.1 import issue #3

Open cyrillefrancois opened 1 year ago

cyrillefrancois commented 1 year ago

I face issue when importing Agribalyse from OLCA. This issue seams related to uncertainty format and more specifically on the log-normal distribution that require math.log function (negative unaccepted)

R-Hammer commented 1 year ago

have also an error and a fix would be great!

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [5], line 18
     11 # 'selected_methods' argument is a list of methods names that will be extracted
     12 # you can specify [] to import no method or 'all' to import all available methods
     13 # the default value is 'all' 
     14 selected_methods = ['CML-IA baseline',
     15                     'ILCD 2011 Midpoint+',
     16                     'ReCiPe 2016 Midpoint (H)']
---> 18 olca2bw.load_openLCA_IPC(project_name="Agribalyse3",
     19                         nonuser_db_name = 'Agribalyse3', 
     20                         user_databases=User_folder,
     21                         #excluded_folders=unused_folders,
     22                         #selected_methods=selected_methods,
     23                         overwrite = True)

File c:\Users\Pro\anaconda3\envs\ab_dev\lib\site-packages\openlca2bw\main.py:99, in load_openLCA_IPC(port, project_name, overwrite, nonuser_db_name, check_nonuser_exc, user_databases, excluded_folders, exclude_S, selected_methods, verbose)
     97 #Extraction data
     98 print("\nImporting processes from OpenLCA \n")
---> 99 dict_processes, list_parameters, dict_missed_providers = client.extract_list_process(databases_folders = databases_folders,exclude_S = exclude_S, update=False)
    100 #Writing data
    101 for db, list_process in dict_processes.items():

File c:\Users\Pro\anaconda3\envs\ab_dev\lib\site-packages\openlca2bw\extract.py:247, in Extraction_functions.extract_list_process(self, databases_folders, exclude_S, update)
    245 for p_id in databases_ids[db]:
...
    152         'loc': sign * return_attribute(uncertainty_dict,'mean'),
    153         'scale': return_attribute(uncertainty_dict,'sd')
    154         })

ValueError: math domain error
cyrillefrancois commented 1 year ago

I'm working on a new release that should fix issues. But the Agribalyse 3.0.1 database in OpenLCA has several problems:

I have not worked with the new Agribalyse database release recently, but it seems that it is available with the bw2package format.