michaelweinold / pylcaio

A Python class that structures, manipulates and facilitates the hybridization of life cycle assessment and environmentally extended input output at the process or database level.
GNU General Public License v2.0
0 stars 0 forks source link

combine_ecoinvent_exiobase() throws: FileNotFoundError: [Errno 2] No such file or directory: '(...)/pylcaio_integration_with_brightway/src/Data/Characterization_matrix_IW+/eco3.5/completed_extensions/Exiobase_not_regionalized.npz' #7

Closed michaelweinold closed 2 years ago

michaelweinold commented 2 years ago
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
/home/weinold/github/pylcaio_integration_with_brightway/notebooks/main.ipynb Cell 21 in <cell line: 1>()
----> [1](vscode-notebook-cell://ssh-remote%2Bhetzner/home/weinold/github/pylcaio_integration_with_brightway/notebooks/main.ipynb#X24sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0) lcaio_object = database_loader.combine_ecoinvent_exiobase(
      [2](vscode-notebook-cell://ssh-remote%2Bhetzner/home/weinold/github/pylcaio_integration_with_brightway/notebooks/main.ipynb#X24sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1)     #path_to_capitals = path_to_capitals,
      [3](vscode-notebook-cell://ssh-remote%2Bhetzner/home/weinold/github/pylcaio_integration_with_brightway/notebooks/main.ipynb#X24sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2)     complete_extensions = True,
      [4](vscode-notebook-cell://ssh-remote%2Bhetzner/home/weinold/github/pylcaio_integration_with_brightway/notebooks/main.ipynb#X24sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3)     impact_world = True,
      [5](vscode-notebook-cell://ssh-remote%2Bhetzner/home/weinold/github/pylcaio_integration_with_brightway/notebooks/main.ipynb#X24sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4)     regionalized = True)

File ~/github/pylcaio_integration_with_brightway/src/pylcaio.py:320, in DatabaseLoader.combine_ecoinvent_exiobase(self, path_to_capitals, complete_extensions, impact_world, regionalized)
    318     self.description.append('Classic impact categories were used')
    319 else:
--> 320     self.C_io = scipy.sparse.load_npz(pkg_resources.resource_filename(
    321         __name__, '/Data/Characterization_matrix_IW+/eco3.5/completed_extensions/Exiobase_not_regionalized.npz'))
    322     self.extended_impact_names_IW_exio = eval(open(pkg_resources.resource_filename(
    323         __name__, '/Data/Characterization_matrix_IW+/eco3.5/completed_extensions/not_regionalized_IW+_EXIOBASE.txt'), 'r').read())
    324     self.C_f = scipy.sparse.load_npz(pkg_resources.resource_filename(
    325         __name__, '/Data/Characterization_matrix_IW+/eco3.5/completed_extensions/Ecoinvent_not_regionalized.npz'))

File ~/miniconda3/envs/pylcaio/lib/python3.9/site-packages/scipy/sparse/_matrix_io.py:123, in load_npz(file)
     75 def load_npz(file):
     76     """ Load a sparse matrix from a file using ``.npz`` format.
     77 
     78     Parameters
   (...)
    120            [4, 0, 0]], dtype=int64)
    121     """
--> 123     with np.load(file, **PICKLE_KWARGS) as loaded:
    124         try:
    125             matrix_format = loaded['format']

File ~/miniconda3/envs/pylcaio/lib/python3.9/site-packages/numpy/lib/npyio.py:390, in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
    388     own_fid = False
    389 else:
--> 390     fid = stack.enter_context(open(os_fspath(file), "rb"))
    391     own_fid = True
    393 # Code to distinguish from NumPy binary files and pickles.

FileNotFoundError: [Errno 2] No such file or directory: '/home/weinold/github/pylcaio_integration_with_brightway/src/Data/Characterization_matrix_IW+/eco3.5/completed_extensions/Exiobase_not_regionalized.npz'
michaelweinold commented 2 years ago

The following file is present (note the capital 'C' in 'Characterization_matrix_IW'): /home/weinold/github/pylcaio_integration_with_brightway/src/Data/characterization_matrix_IW+/eco3.5/completed_extensions/Exiobase_not_regionalized.npz The following file is required: /home/weinold/github/pylcaio_integration_with_brightway/src/Data/Characterization_matrix_IW+/eco3.5/completed_extensions/Exiobase_not_regionalized.npz

michaelweinold commented 2 years ago

T̶e̶m̶p̶o̶r̶a̶r̶y̶ fix: rename folder Characterization_matrix_IW to characterization_matrix_IW.

michaelweinold commented 2 years ago

Fixed with commit https://github.com/michaelweinold/pylcaio_integration_with_brightway/commit/59275e862543af72100fbfba42f5f958ed58ffba.