Skip to content

Commit

Permalink
fix enl namming
Browse files Browse the repository at this point in the history
  • Loading branch information
elpamart committed Sep 29, 2023
1 parent 62fd8c3 commit c9c264f
Showing 1 changed file with 5 additions and 240 deletions.
245 changes: 5 additions & 240 deletions data/notebooks/Lab/Updates_in_stored_procedures_LG_v2_0_09_23.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 1,
"id": "ec6f1dba",
"metadata": {},
"outputs": [],
Expand All @@ -94,7 +94,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 2,
"id": "a1fcf162",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -129,7 +129,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 3,
"id": "bc136206",
"metadata": {},
"outputs": [],
Expand All @@ -145,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 4,
"id": "1f72adc5",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -363,241 +363,6 @@
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "0235fafe",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>name</th>\n",
" <th>shortName</th>\n",
" <th>nameCode</th>\n",
" <th>description</th>\n",
" <th>status</th>\n",
" <th>metadata</th>\n",
" <th>unitId</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>936d0a9f-fe48-42b4-9433-63282d4dada5</td>\n",
" <td>Deforestation footprint (sLUC)</td>\n",
" <td>Deforestation footprint (sLUC)</td>\n",
" <td>DF_SLUC</td>\n",
" <td>The deforestation footprint (sLUC) indicator q...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'Deforestation footprint (sLUC)', 'un...</td>\n",
" <td>6970f9b8-eba0-4fee-b6ee-2723ce6604d4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>157b5f22-916b-4981-84c7-f6607ec65445</td>\n",
" <td>GHG emissions from deforestation (sLUC)</td>\n",
" <td>GHGs (deforestation, sLUC)</td>\n",
" <td>GHG_DEF_SLUC</td>\n",
" <td>The GHG emissions from deforestation (sLUC) in...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'GHG emissions from deforestation (sL...</td>\n",
" <td>a0e8110c-fbde-4c8c-ac19-f0f69078b96b</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3a718205-10c1-4e11-81b3-cb8965e378c7</td>\n",
" <td>Biodiversity importance of natural ecosystems ...</td>\n",
" <td>Forest landscape integrity loss</td>\n",
" <td>FLIL</td>\n",
" <td>The biodiversity importance of natural ecosyst...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'Biodiversity importance of natural e...</td>\n",
" <td>1129394b-6baa-41dd-9409-80d808dbc32e</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>9c2124c7-5df0-40d5-962e-d35480d48cd3</td>\n",
" <td>Surface or groundwater use</td>\n",
" <td>Water use</td>\n",
" <td>WU</td>\n",
" <td>The surface or groundwater use indicator estim...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'Surface or groundwater use', 'units'...</td>\n",
" <td>9c0da38a-6371-4c79-879b-218fc39c4700</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>ffdd6f19-6737-4a10-9d36-5243d3f14b45</td>\n",
" <td>Excess surface or groundwater use</td>\n",
" <td>Unsustainable water use</td>\n",
" <td>UWU</td>\n",
" <td>The excess surface or groundwater use indicato...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'Excess surface or groundwater use', ...</td>\n",
" <td>9c0da38a-6371-4c79-879b-218fc39c4700</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>5c595ac7-f144-485f-9f32-601f6faae9fe</td>\n",
" <td>Land use footprint for production</td>\n",
" <td>Land footprint</td>\n",
" <td>LF</td>\n",
" <td>The land use footprint for production indicato...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'Land use footprint for production', ...</td>\n",
" <td>6970f9b8-eba0-4fee-b6ee-2723ce6604d4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>1994e7bf-5442-4061-ba48-6320574263ad</td>\n",
" <td>GHG emissions from farm management</td>\n",
" <td>GHGs (farm management)</td>\n",
" <td>GHG_FARM</td>\n",
" <td>The GHG emissions from farm management indicat...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'GHG emissions from farm management',...</td>\n",
" <td>a0e8110c-fbde-4c8c-ac19-f0f69078b96b</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>d5f945c9-8636-45a2-a7c9-67a1dc8e687a</td>\n",
" <td>Freshwater nutrient load assimilation volume</td>\n",
" <td>Nutrient load</td>\n",
" <td>NL</td>\n",
" <td>The freshwater nutrient load assimilation volu...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'Freshwater nutrient load assimilatio...</td>\n",
" <td>9c0da38a-6371-4c79-879b-218fc39c4700</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>a39394be-ad57-41bc-9c2c-be0949ec6193</td>\n",
" <td>Excess freshwater nutrient load assimilation v...</td>\n",
" <td>Excess nutrient load</td>\n",
" <td>ENL</td>\n",
" <td>The excess freshwater nutrient load assimilati...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'Excess freshwater nutrient load assi...</td>\n",
" <td>9c0da38a-6371-4c79-879b-218fc39c4700</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>5c133ba4-da24-46db-9c6c-ece7520f01b0</td>\n",
" <td>Cropland expansion in natural ecosystems</td>\n",
" <td>Net cropland expansion</td>\n",
" <td>NCE</td>\n",
" <td>The annual average area of cropland expansion ...</td>\n",
" <td>active</td>\n",
" <td>{'name': 'Cropland expansion in natural ecosys...</td>\n",
" <td>6970f9b8-eba0-4fee-b6ee-2723ce6604d4</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" id \\\n",
"0 936d0a9f-fe48-42b4-9433-63282d4dada5 \n",
"1 157b5f22-916b-4981-84c7-f6607ec65445 \n",
"2 3a718205-10c1-4e11-81b3-cb8965e378c7 \n",
"3 9c2124c7-5df0-40d5-962e-d35480d48cd3 \n",
"4 ffdd6f19-6737-4a10-9d36-5243d3f14b45 \n",
"5 5c595ac7-f144-485f-9f32-601f6faae9fe \n",
"6 1994e7bf-5442-4061-ba48-6320574263ad \n",
"7 d5f945c9-8636-45a2-a7c9-67a1dc8e687a \n",
"8 a39394be-ad57-41bc-9c2c-be0949ec6193 \n",
"9 5c133ba4-da24-46db-9c6c-ece7520f01b0 \n",
"\n",
" name \\\n",
"0 Deforestation footprint (sLUC) \n",
"1 GHG emissions from deforestation (sLUC) \n",
"2 Biodiversity importance of natural ecosystems ... \n",
"3 Surface or groundwater use \n",
"4 Excess surface or groundwater use \n",
"5 Land use footprint for production \n",
"6 GHG emissions from farm management \n",
"7 Freshwater nutrient load assimilation volume \n",
"8 Excess freshwater nutrient load assimilation v... \n",
"9 Cropland expansion in natural ecosystems \n",
"\n",
" shortName nameCode \\\n",
"0 Deforestation footprint (sLUC) DF_SLUC \n",
"1 GHGs (deforestation, sLUC) GHG_DEF_SLUC \n",
"2 Forest landscape integrity loss FLIL \n",
"3 Water use WU \n",
"4 Unsustainable water use UWU \n",
"5 Land footprint LF \n",
"6 GHGs (farm management) GHG_FARM \n",
"7 Nutrient load NL \n",
"8 Excess nutrient load ENL \n",
"9 Net cropland expansion NCE \n",
"\n",
" description status \\\n",
"0 The deforestation footprint (sLUC) indicator q... active \n",
"1 The GHG emissions from deforestation (sLUC) in... active \n",
"2 The biodiversity importance of natural ecosyst... active \n",
"3 The surface or groundwater use indicator estim... active \n",
"4 The excess surface or groundwater use indicato... active \n",
"5 The land use footprint for production indicato... active \n",
"6 The GHG emissions from farm management indicat... active \n",
"7 The freshwater nutrient load assimilation volu... active \n",
"8 The excess freshwater nutrient load assimilati... active \n",
"9 The annual average area of cropland expansion ... active \n",
"\n",
" metadata \\\n",
"0 {'name': 'Deforestation footprint (sLUC)', 'un... \n",
"1 {'name': 'GHG emissions from deforestation (sL... \n",
"2 {'name': 'Biodiversity importance of natural e... \n",
"3 {'name': 'Surface or groundwater use', 'units'... \n",
"4 {'name': 'Excess surface or groundwater use', ... \n",
"5 {'name': 'Land use footprint for production', ... \n",
"6 {'name': 'GHG emissions from farm management',... \n",
"7 {'name': 'Freshwater nutrient load assimilatio... \n",
"8 {'name': 'Excess freshwater nutrient load assi... \n",
"9 {'name': 'Cropland expansion in natural ecosys... \n",
"\n",
" unitId \n",
"0 6970f9b8-eba0-4fee-b6ee-2723ce6604d4 \n",
"1 a0e8110c-fbde-4c8c-ac19-f0f69078b96b \n",
"2 1129394b-6baa-41dd-9409-80d808dbc32e \n",
"3 9c0da38a-6371-4c79-879b-218fc39c4700 \n",
"4 9c0da38a-6371-4c79-879b-218fc39c4700 \n",
"5 6970f9b8-eba0-4fee-b6ee-2723ce6604d4 \n",
"6 a0e8110c-fbde-4c8c-ac19-f0f69078b96b \n",
"7 9c0da38a-6371-4c79-879b-218fc39c4700 \n",
"8 9c0da38a-6371-4c79-879b-218fc39c4700 \n",
"9 6970f9b8-eba0-4fee-b6ee-2723ce6604d4 "
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pd.read_sql_query(\"\"\"SELECT * FROM indicator\"\"\", conn)"
]
},
{
"cell_type": "code",
"execution_count": 6,
Expand Down Expand Up @@ -1157,7 +922,7 @@
"# 1. Obtain the weighted percentage of excess of nutrient load by the commodity production\n",
"# 2. Multiply the weighted excess of water withdrawals by the total nutrient load indicator\n",
"sourcing_records[\"nutrient_load_reduction\"] = (\n",
" sourcing_records[\"raw_nlr_per_tonne_annual\"] * sourcing_records[\"nutrient_load\"]\n",
" sourcing_records[\"raw_enl_per_tonne_annual\"] * sourcing_records[\"nutrient_load\"]\n",
") / (100 * sourcing_records[\"production\"])\n",
"\n",
"sourcing_records.head()"
Expand Down

0 comments on commit c9c264f

Please sign in to comment.