{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial 1" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import emipy as ep" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
FacilityReportIDPollutantReleaseAndTransferReportIDFacilityIDNationalIDParentCompanyNameFacilityNameStreetNameBuildingNumberCityPostalCode...PollutantNamePollutantGroupCodePollutantGroupNamePollutantCASMethodBasisCodeMethodBasisNameTotalQuantityAccidentalQuantityUnitCodeUnitName
01856157631013410312Lenzing AGLenzing AGWerkstraße 1NaNLenzing4860...Particulate matter (PM10)INORGInorganic substancesNaNEEstimated68200.00.0KGMkilogram
11856157631013410312Lenzing AGLenzing AGWerkstraße 1NaNLenzing4860...Sulphur oxides (SOx/SO2)OTHGASOther gasesNaNMMeasured420000.00.0KGMkilogram
21856157631013410312Lenzing AGLenzing AGWerkstraße 1NaNLenzing4860...Carbon dioxide (CO2)GRHGASGreenhouse gases124-38-9EEstimated182000000.00.0KGMkilogram
31856157631013410312Lenzing AGLenzing AGWerkstraße 1NaNLenzing4860...Nitrogen oxides (NOx/NO2)OTHGASOther gasesNaNMMeasured818000.00.0KGMkilogram
41857157641013410313Lenzing AGWasserreinhalteverband Lenzing - Lenzing AGWerkstraße 1NaNLenzing4860...Zinc and compounds (as Zn)HEVMETHeavy metalsNaNMMeasured3210.00.0KGMkilogram
\n", "

5 rows × 73 columns

\n", "
" ], "text/plain": [ " FacilityReportID PollutantReleaseAndTransferReportID FacilityID \\\n", "0 1856 1 5763 \n", "1 1856 1 5763 \n", "2 1856 1 5763 \n", "3 1856 1 5763 \n", "4 1857 1 5764 \n", "\n", " NationalID ParentCompanyName FacilityName \\\n", "0 1013410312 Lenzing AG Lenzing AG \n", "1 1013410312 Lenzing AG Lenzing AG \n", "2 1013410312 Lenzing AG Lenzing AG \n", "3 1013410312 Lenzing AG Lenzing AG \n", "4 1013410313 Lenzing AG Wasserreinhalteverband Lenzing - Lenzing AG \n", "\n", " StreetName BuildingNumber City PostalCode ... \\\n", "0 Werkstraße 1 NaN Lenzing 4860 ... \n", "1 Werkstraße 1 NaN Lenzing 4860 ... \n", "2 Werkstraße 1 NaN Lenzing 4860 ... \n", "3 Werkstraße 1 NaN Lenzing 4860 ... \n", "4 Werkstraße 1 NaN Lenzing 4860 ... \n", "\n", " PollutantName PollutantGroupCode PollutantGroupName \\\n", "0 Particulate matter (PM10) INORG Inorganic substances \n", "1 Sulphur oxides (SOx/SO2) OTHGAS Other gases \n", "2 Carbon dioxide (CO2) GRHGAS Greenhouse gases \n", "3 Nitrogen oxides (NOx/NO2) OTHGAS Other gases \n", "4 Zinc and compounds (as Zn) HEVMET Heavy metals \n", "\n", " PollutantCAS MethodBasisCode MethodBasisName TotalQuantity \\\n", "0 NaN E Estimated 68200.0 \n", "1 NaN M Measured 420000.0 \n", "2 124-38-9 E Estimated 182000000.0 \n", "3 NaN M Measured 818000.0 \n", "4 NaN M Measured 3210.0 \n", "\n", " AccidentalQuantity UnitCode UnitName \n", "0 0.0 KGM kilogram \n", "1 0.0 KGM kilogram \n", "2 0.0 KGM kilogram \n", "3 0.0 KGM kilogram \n", "4 0.0 KGM kilogram \n", "\n", "[5 rows x 73 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "db = ep.read_db()\n", "\n", "db.head()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['FacilityReportID', 'PollutantReleaseAndTransferReportID', 'FacilityID',\n", " 'NationalID', 'ParentCompanyName', 'FacilityName', 'StreetName',\n", " 'BuildingNumber', 'City', 'PostalCode', 'CountryCode', 'CountryName',\n", " 'Lat', 'Long', 'RBDGeoCode', 'RBDGeoName', 'NUTSRegionGeoCode',\n", " 'NUTSRegionGeoName', 'RBDSourceCode', 'RBDSourceName',\n", " 'NUTSRegionSourceCode', 'NUTSRegionSourceName',\n", " 'NACEMainEconomicActivityCode', 'NACEMainEconomicActivityName',\n", " 'CompetentAuthorityName', 'CompetentAuthorityAddressStreetName',\n", " 'CompetentAuthorityAddressBuildingNumber',\n", " 'CompetentAuthorityAddressCity', 'CompetentAuthorityAddressPostalCode',\n", " 'CompetentAuthorityAddressCountryCode',\n", " 'CompetentAuthorityAddressCountryName',\n", " 'CompetentAuthorityTelephoneCommunication',\n", " 'CompetentAuthorityFaxCommunication',\n", " 'CompetentAuthorityEmailCommunication',\n", " 'CompetentAuthorityContactPersonName', 'ProductionVolumeProductName',\n", " 'ProductionVolumeQuantity', 'ProductionVolumeUnitCode',\n", " 'ProductionVolumeUnitName', 'TotalIPPCInstallationQuantity',\n", " 'OperatingHours', 'TotalEmployeeQuantity', 'WebsiteCommunication',\n", " 'PublicInformation', 'ConfidentialIndicator',\n", " 'ConfidentialityReasonCode', 'ConfidentialityReasonName',\n", " 'ProtectVoluntaryData', 'MainIASectorCode', 'MainIASectorName',\n", " 'MainIAActivityCode', 'MainIAActivityName', 'MainIASubActivityCode',\n", " 'MainIASubActivityName', 'ReportingYear', 'CoordinateSystemCode',\n", " 'CoordinateSystemName', 'CdrReleased', 'Published',\n", " 'PollutantReleaseID', 'ReleaseMediumCode', 'ReleaseMediumName',\n", " 'PollutantCode', 'PollutantName', 'PollutantGroupCode',\n", " 'PollutantGroupName', 'PollutantCAS', 'MethodBasisCode',\n", " 'MethodBasisName', 'TotalQuantity', 'AccidentalQuantity', 'UnitCode',\n", " 'UnitName'],\n", " dtype='object')" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "db.columns" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['Austria',\n", " 'Belgium',\n", " 'Cyprus',\n", " 'Czech Republic',\n", " 'Germany',\n", " 'Denmark',\n", " 'Estonia',\n", " 'Spain',\n", " 'Finland',\n", " 'France',\n", " 'Greece',\n", " 'Hungary',\n", " 'Ireland',\n", " 'Italy',\n", " 'Lithuania',\n", " 'Luxembourg',\n", " 'Latvia',\n", " 'Malta',\n", " 'Netherlands',\n", " 'Norway',\n", " 'Poland',\n", " 'Portugal',\n", " 'Sweden',\n", " 'Slovenia',\n", " 'Slovakia',\n", " 'United Kingdom',\n", " 'Iceland',\n", " 'Serbia',\n", " 'Romania',\n", " 'Bulgaria',\n", " 'Switzerland',\n", " 'Croatia']" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ep.get_CountryList(db)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[2001, 2004, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ep.get_YearList(db)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['Particulate matter (PM10)',\n", " 'Sulphur oxides (SOx/SO2)',\n", " 'Carbon dioxide (CO2)',\n", " 'Nitrogen oxides (NOx/NO2)',\n", " 'Zinc and compounds (as Zn)',\n", " 'Nickel and compounds (as Ni)',\n", " 'Chlorides (as total Cl)',\n", " 'Fluorides (as total F)',\n", " 'Total organic carbon (TOC) (as total C or COD/3)',\n", " 'Halogenated organic compounds (as AOX)',\n", " 'Non-methane volatile organic compounds (NMVOC)',\n", " 'Carbon monoxide (CO)',\n", " 'Ammonia (NH3)',\n", " 'Copper and compounds (as Cu)',\n", " 'Nitrous oxide (N2O)',\n", " 'Mercury and compounds (as Hg)',\n", " 'Total phosphorus',\n", " 'Methane (CH4)',\n", " 'Lead and compounds (as Pb)',\n", " 'Hydrogen cyanide (HCN)',\n", " 'Chlorine and inorganic compounds (as HCl)',\n", " 'Benzene',\n", " 'Cadmium and compounds (as Cd)',\n", " 'Total nitrogen',\n", " 'Cyanides (as total CN)',\n", " 'Chromium and compounds (as Cr)',\n", " '1,2-dichloroethane (DCE)',\n", " 'Phenols (as total C)',\n", " 'Arsenic and compounds (as As)',\n", " 'PCDD + PCDF (dioxins + furans) (as Teq)',\n", " 'Polycyclic Aromatic Hydrocarbons (PAH in EPER)',\n", " 'BTEX',\n", " 'Fluorine and inorganic compounds (as HF)',\n", " 'Dichloromethane (DCM)',\n", " 'Trichloroethylene',\n", " 'Tetrachloroethylene (PER)',\n", " 'Tetrachloromethane (TCM)',\n", " 'Hexachlorobenzene (HCB)',\n", " 'Hexachlorobutadiene (HCBD)',\n", " 'Trichloromethane',\n", " 'Hydro-fluorocarbons (HFCs)',\n", " 'Trichlorobenzenes (TCBs) (all isomers)',\n", " 'Sulphur hexafluoride (SF6)',\n", " 'Perfluorocarbons (PFCs)',\n", " '1,1,1-trichloroethane',\n", " '1,2,3,4,5,6-hexachlorocyclohexane (HCH)',\n", " 'Organotin compounds (as total Sn)',\n", " 'Chloro-alkanes, C10-C13',\n", " 'Polycyclic aromatic hydrocarbons (PAHs)',\n", " 'Di-(2-ethyl hexyl) phthalate (DEHP)',\n", " 'Hydrochlorofluorocarbons(HCFCs)',\n", " 'Chlorofluorocarbons (CFCs)',\n", " 'Polychlorinated biphenyls (PCBs)',\n", " 'Naphthalene',\n", " 'Carbon dioxide (CO2) excluding biomass',\n", " 'Atrazine',\n", " 'Vinyl chloride',\n", " 'Lindane',\n", " 'Fluoranthene',\n", " '1,1,2,2-tetrachloroethane',\n", " 'Nonylphenol and Nonylphenol ethoxylates (NP/NPEs)',\n", " 'Octylphenols and Octylphenol ethoxylates',\n", " 'Xylenes',\n", " 'Ethylene oxide',\n", " 'Tributyltin and compounds',\n", " 'Anthracene',\n", " 'Triphenyltin and compounds',\n", " 'Pentachlorobenzene',\n", " 'Toluene',\n", " 'Diuron',\n", " 'Asbestos',\n", " 'Pentachlorophenol (PCP)',\n", " 'Ethyl benzene',\n", " 'Halons',\n", " 'Simazine',\n", " 'Trifluralin',\n", " 'Chlorfenvinphos',\n", " 'Benzo(g,h,i)perylene',\n", " 'Aldrin',\n", " 'Isodrin',\n", " 'Dieldrin',\n", " 'Endrin',\n", " 'Isoproturon',\n", " 'Brominated diphenylethers (PBDE)',\n", " 'Chlorpyrifos',\n", " 'Endosulphan',\n", " 'Alachlor',\n", " 'Hexabromobiphenyl',\n", " 'DDT',\n", " 'Chlordecone',\n", " 'Toxaphene',\n", " 'Mirex',\n", " 'Heptachlor',\n", " 'Chlordane']" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ep.get_PollutantList(db)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CountryCodeCountryNameLatLongNUTSRegionGeoCodeNACEMainEconomicActivityCodeNACEMainEconomicActivityNameReportingYearPollutantReleaseIDPollutantNameTotalQuantityUnitCode
3683DEGermany54.8051859.432377DEF0NACE_1.1:40.10Production and distribution of electricity20017341Sulphur oxides (SOx/SO2)582000.0KGM
3684DEGermany54.8051859.432377DEF0NACE_1.1:40.10Production and distribution of electricity20017340Nitrogen oxides (NOx/NO2)378000.0KGM
3685DEGermany54.34060510.178735DEF0NACE_1.1:40.30Steam and hot water supply200140850Chlorine and inorganic compounds (as HCl)41000.0KGM
3686DEGermany54.34060510.178735DEF0NACE_1.1:40.30Steam and hot water supply200140852Nitrogen oxides (NOx/NO2)1500000.0KGM
3687DEGermany54.34060510.178735DEF0NACE_1.1:40.30Steam and hot water supply200140853Sulphur oxides (SOx/SO2)960000.0KGM
\n", "
" ], "text/plain": [ " CountryCode CountryName Lat Long NUTSRegionGeoCode \\\n", "3683 DE Germany 54.805185 9.432377 DEF0 \n", "3684 DE Germany 54.805185 9.432377 DEF0 \n", "3685 DE Germany 54.340605 10.178735 DEF0 \n", "3686 DE Germany 54.340605 10.178735 DEF0 \n", "3687 DE Germany 54.340605 10.178735 DEF0 \n", "\n", " NACEMainEconomicActivityCode NACEMainEconomicActivityName \\\n", "3683 NACE_1.1:40.10 Production and distribution of electricity \n", "3684 NACE_1.1:40.10 Production and distribution of electricity \n", "3685 NACE_1.1:40.30 Steam and hot water supply \n", "3686 NACE_1.1:40.30 Steam and hot water supply \n", "3687 NACE_1.1:40.30 Steam and hot water supply \n", "\n", " ReportingYear PollutantReleaseID \\\n", "3683 2001 7341 \n", "3684 2001 7340 \n", "3685 2001 40850 \n", "3686 2001 40852 \n", "3687 2001 40853 \n", "\n", " PollutantName TotalQuantity UnitCode \n", "3683 Sulphur oxides (SOx/SO2) 582000.0 KGM \n", "3684 Nitrogen oxides (NOx/NO2) 378000.0 KGM \n", "3685 Chlorine and inorganic compounds (as HCl) 41000.0 KGM \n", "3686 Nitrogen oxides (NOx/NO2) 1500000.0 KGM \n", "3687 Sulphur oxides (SOx/SO2) 960000.0 KGM " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data1 = ep.f_db(db,CountryName='Germany')\n", "data1 = ep.row_reduction(data1)\n", "data1.head()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "data2 = ep.f_db(db, CountryName=['Germany', 'Switzerand', 'Austria'])" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "CountryName = ['Germany', 'Austria', 'Switzerland']\n", "ReportingYear = [2014, 2015, 2016,2017]\n", "PollutantName = ['Carbon dioxide (CO2)', 'Methane (CH4)']\n", "\n", "data3 = ep.f_db(db, CountryName=CountryName, ReportingYear=ReportingYear, PollutantName=PollutantName)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "data4 = ep.f_db(db, ExclaveExclude=True)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "data5 = ep.f_db(db, CountryName='Germany', ReturnUnknown=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" } }, "nbformat": 4, "nbformat_minor": 4 }