<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <div style="width
Step1:  7.1 Write checksums
Execute both the Germany and Europe notebooks first in order to generate the needed files.
Step2:  7.1 Write the results to file
We document the data packages meta data in the specific format JSON as proposed by the Open Knowledge Foundation. See the Frictionless Data project by OKFN (http
<ASSISTANT_TASK:>
Python Code:
import os
import yaml
import json
from download_and_process_functions import get_sha_hash
Explanation: <div style="width:100%; background-color: #D9EDF7; border: 1px solid #CFCFCF; text-align: left; padding: 10px;">
      <b>Conventional Power Plants: Main notebook</b>
      <ul>
        <li>Main Notebook</li>
        <li><a href="download_and_process_DE.ipynb">Processing notebook for German power plant</a></li>
        <li><a href="download_and_process_EU.ipynb">Processing notebook for European power plants</a></li>
      </ul>
      <br>This notebook is part of the <a href="http://data.open-power-system-data.org/DATA PACKAGE NAME HERE"> Data package name here Data Package</a> of <a href="http://open-power-system-data.org">Open Power System Data</a>.
</div>
1. About Open Power System Data
This notebook is part of the project Open Power System Data. Open Power System Data develops a platform for free and open data for electricity system modeling. We collect, check, process, document, and provide data that are publicly available but currently inconvenient to use. 
More info on Open Power System Data:
- Information on the project on our website
- Data and metadata on our data platform
- Data processing scripts on our GitHub page
2. About Jupyter Notebooks and GitHub
This file is a Jupyter Notebook. A Jupyter Notebook is a file that combines executable programming code with visualizations and comments in markdown format, allowing for an intuitive documentation of the code. We use Jupyter Notebooks for combined coding and documentation. We use Python 3 as programming language. All Notebooks are stored on GitHub, a platform for software development, and are publicly available. More information on our IT-concept can be found here. See also our step-by-step manual how to use the dataplatform.
3. About this Data Package
We provide data in different chunks, or datapackages. The one you are looking at is on conventional power plants, 
This notebook processes data on conventional power plants for Germany as well as other European countries. The data includes individual power plants with their technical characteristics. These include installed capacity, main energy source, type of technology, CHP capability, and geographical information.
4. Data sources
We use as publicly available data sources, which includes national statistical offices, ministries, regulatory authorities, transmission system operators, as well as other associations. All data sources are listed in the datapackage.json file including their link.
4.1 Germany
"BNetzA Kraftwerksliste"
"Umweltbundesamt Datenbank Kraftwerke in Deutschland"
For efficiency estimation: Jonas Egerer, Clemens Gerbaulet, Richard Ihlenburg, Friedrich Kunz, Benjamin Reinhard, Christian von Hirschhausen, Alexander Weber, Jens Weibezahn (2014): Electricity Sector Data for Policy-Relevant Modeling: Data Documentation and Applications to the German and European Electricity Markets. DIW Data Documentation 72, Berlin, Germany. Download
Other sources, e.g. for efficiency and georeferencing, are provided in the file
4.2 Selected European countries
AT: Verbund AG (Austrian utility), Our hydro power plants. Source links for conventional units are given in the column "source" of the power plant list
BE: ELIA (Belgian transmission system operator), Generation facilities
CH: BFE (Swiss Federal Office of Energy), Statistics of swiss hydro power plants and Nuclear energy
CZ: CEPS (Czech transmission system operator), Available capacity
DK: Energinet.dk (Danish transmission system operator), Energinet.dk's assumptions for analysis
ES: SEDE (Ministry of Industry, Energy and Tourism), Productores (in Conjunto de Datos)
FI: Energy Authority, Power plant register
FR: RTE (French tranmission system operator), List of production units of more than 100 MW
IT: TERNA (Italian transmission network operator), Installed generation capacity
NL: TenneT (Dutch transmission system operator), Available capacity
NO: NVE (Norwegian Water Resources and Energy Directorate), Lists of thermal and hydro power plants
PL: GPI (Information Platform by the Polish Power Exchange), List of generation units
SE: Nordpool (Power exchange), Installed generation capacity larger than 100 MW per unit in Sweden (17.12.2014, Download is inactive as data has been deleted by Nordpool)
SI: Several sources, Source links of data are given in the column "source" of the power plant list
SK: SEAS (Slovakian utility), Power plants
UK: Statistical Office, Power stations in the United Kingdom (DUKES)
Beside the listed publicly available sources, additional, but decentralized, information on individual power plants are available (e.g. on operator's webpages). We therefore aim to continuously extend the lists by these information.
5. Model Output
The following standardized notation is used in this datapackage for energy sources, technology type:
5.1 Energy sources
Original Name in BNetzA-List|model output|Full name
:-:|:-:|:-:
Steinkohle|coal|Hard coal
Erdgas|natural_gas|Natural Gas
Braunkohle|lignite|Lignite
Kernenergie|uranium|Uranium
Pumpspeicher|pumped_storage|Pumped Storage (Water)
Biomasse|biomass|Biomass
Mineralölprodukte|oil|Mineral oil products 
Laufwasser|hydro|Water (run of river)
Sonstige Energieträger (nicht erneuerbar) |other_non_renewable|Other Fuels (not renewable)
Abfall|waste|Waste
Speicherwasser (ohne Pumpspeicher)|reservoir|Reservoir
Unbekannter Energieträger (nicht erneuerbar)|unknown_non_renewable|Unknown (not renewable)
Mehrere Energieträger (nicht erneuerbar)|multiple_non_renewable|Multiple (not renewable)
Deponiegas|gas_landfill|Landfill gas
Windenergie (Onshore-Anlage)|wind_onshore|Onshore wind
Windenergie (Offshore-Anlage)|wind_offshore|Offshore Wind
Solare Strahlungsenergie|solar|Solar energy
Klärgas|gas_sewage|Sewage Gas
Geothermie|geothermal|Geothermal energy
Grubengas|gas_mine|Mine Gas
5.2 Energy source structure
5.3 CHP type
CHP Type abbreviation|Full name
:-:|:-:
CHP|Combined heat and power
IPP|Industrial power plant
6. License
This notebook as well as all other documents in this repository is published under the MIT License.
7. Documenting the data package (meta data)
End of explanation
output_path = 'output'
files = [
    'conventional_power_plants_DE.csv', 'conventional_power_plants_DE.xlsx',
    'conventional_power_plants_EU.csv', 'conventional_power_plants_EU.xlsx',
    'conventional_power_plants.sqlite']
hash_dict = {}
filesize_dict = {}
with open('checksums.txt', 'w') as f:
    for file_name in files:
        file_hash = get_sha_hash(os.path.join(output_path, file_name))
        hash_dict[file_name] = file_hash
        filesize_dict[file_name] = os.path.getsize(output_path)
        f.write('{},{}\n'.format(file_name, file_hash))
Explanation: 7.1 Write checksums
Execute both the Germany and Europe notebooks first in order to generate the needed files.
End of explanation
with open(os.path.join('input', 'metadata.yml'), 'r') as f:
    metadata = yaml.load(f.read(), Loader=yaml.BaseLoader)
    
metadata['resources'][0]['hash'] = hash_dict['conventional_power_plants_DE.csv']
metadata['resources'][1]['hash'] = hash_dict['conventional_power_plants_DE.xlsx']
metadata['resources'][2]['hash'] = hash_dict['conventional_power_plants_EU.csv']
metadata['resources'][3]['hash'] = hash_dict['conventional_power_plants_EU.xlsx']
metadata['resources'][0]['bytes'] = filesize_dict['conventional_power_plants_DE.csv']
metadata['resources'][1]['bytes'] = filesize_dict['conventional_power_plants_DE.xlsx']
metadata['resources'][2]['bytes'] = filesize_dict['conventional_power_plants_EU.csv']
metadata['resources'][3]['bytes'] = filesize_dict['conventional_power_plants_EU.xlsx']
datapackage_json = json.dumps(metadata, indent=4, separators=(',', ': '))
    
# Write the information of the metadata
with open(os.path.join('output', 'datapackage.json'), 'w') as f:
    f.write(datapackage_json)
Explanation: 7.1 Write the results to file
We document the data packages meta data in the specific format JSON as proposed by the Open Knowledge Foundation. See the Frictionless Data project by OKFN (http://data.okfn.org/) and the Data Package specifications (http://dataprotocols.org/data-packages/) for more details.
In order to keep the notebook more readable, we first formulate the metadata in the human-readable YAML format using a multi-line string. We then parse the string into a Python dictionary and save that to disk as a JSON file.
End of explanation
<END_TASK>