Skip to content

Commit

Permalink
Skip nan values in SimaPro mappping
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Jul 25, 2024
1 parent b4ec134 commit e4ecb4c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 6,006 deletions.
38 changes: 9 additions & 29 deletions dev/Generate SimaPro-ecoinvent mappings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"import pandas as pd\n",
"import randonneur as rd\n",
"from pathlib import Path\n",
"import randonneur_data as rdata"
"import randonneur_data as rdata\n",
"from math import isnan\n",
"from numbers import Number"
]
},
{
Expand All @@ -30,6 +32,10 @@
"metadata": {},
"outputs": [],
"source": [
"def valid(a):\n",
" return not isinstance(a, Number) or not isnan(a)\n",
"\n",
"\n",
"def write_for_version(version, base_path, filename, sheet_name, combined):\n",
" df = pd.read_excel(\n",
" base_path / filename,\n",
Expand All @@ -51,6 +57,7 @@
" }\n",
" } \n",
" for row in df.to_dict(orient='records')\n",
" if valid(row['Simapro Process Name'])\n",
" ]\n",
" dp = rd.Datapackage(\n",
" name=f\"simapro-ecoinvent-{version}-cutoff\",\n",
Expand Down Expand Up @@ -160,37 +167,10 @@
")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "66d21bb6-14f5-41d2-9e80-f9fd8256fe0d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"`randonneur_data` registry with 6 files:\n",
"\tecoinvent-3.7.1-cutoff-ecoinvent-3.8-cutoff\n",
"\tecoinvent-3.8-cutoff-ecoinvent-3.9-cutoff\n",
"\tecoinvent-3.9.1-cutoff-ecoinvent-3.10-cutoff\n",
"\tsimapro-ecoinvent-3.10-cutoff\n",
"\tsimapro-ecoinvent-3.8-cutoff\n",
"\tsimapro-ecoinvent-3.9.1-cutoff"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"registry"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "060fee8c-3c7e-40ff-835c-8dea858a45e8",
"id": "3696f169-c980-4e41-b0c3-69d17e8041b2",
"metadata": {},
"outputs": [],
"source": []
Expand Down
300 changes: 0 additions & 300 deletions dev/ecoinvent-3.8-biosphere-ecoinvent-3.9-biosphere.json

This file was deleted.

Loading

0 comments on commit e4ecb4c

Please sign in to comment.