-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #473 from Open-Earth-Foundation/ON-1656_CAMMESA_AR
CAMMESA_AR integration
- Loading branch information
Showing
8 changed files
with
423 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
global-api/importer/argentinian_datasets/cammesa/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# cammesa - Argentina | ||
Local data of energy generation by power plants in Argentina. This source is used to calculate GHG emissions for subsector of Energy industries in Stationary Energy sector (I.4.4). | ||
|
||
1. Extract the activity data from the source [cammesa](https://cammesaweb.cammesa.com/download/factor-de-emision/) | ||
|
||
2. Transform the activity into emission data align with the Global API schema: | ||
```bash | ||
python ./importer/argentinian_datasets/cammesa/transformation_cammesa.py --filepath [path where the transformed data will be saved] | ||
``` | ||
3. Extract the activity row from the source: | ||
```bash | ||
psql -U ccglobal -d ccglobal -f ./importer/argentinian_datasets/cammesa/loading_cammesa.sql | ||
``` | ||
|
||
### Directory tree | ||
```sh | ||
. | ||
├── README.md # top level readme | ||
├── transformation_cammesa.py # transformation script | ||
└── load_cammesa.sql # loading script | ||
``` |
30 changes: 30 additions & 0 deletions
30
global-api/importer/argentinian_datasets/cammesa/load_cammesa.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- The ID column is not unique based on the processed records, | ||
-- we have multiple acitivty records for single region_code, year, gas_name, GPC_refno | ||
-- rather than upsert we will just delete existing source data and insert fresh with generated id to make record unique | ||
-- the route for regions will need to be aggregated over region_code, year, gas_name, GPC_refno to get accurate emissions values | ||
DELETE FROM regionwide_emissions WHERE source_name = 'cammesa'; | ||
|
||
-- Update the main table with the staging table | ||
INSERT INTO regionwide_emissions ( | ||
id,source_name,"GPC_refno",region_name,region_code,temporal_granularity,year,activity_name,activity_value, | ||
activity_units,gas_name,emission_factor_value,emission_factor_units,emissions_value,emissions_units | ||
) | ||
SELECT gen_random_uuid() as id, | ||
source_name, | ||
"GPC_refno", | ||
region_name, | ||
region_code, | ||
temporal_granularity, | ||
year, | ||
activity_name, | ||
activity_value, | ||
activity_units, | ||
gas_name, | ||
emission_factor_value, | ||
emission_factor_units, | ||
emissions_value, | ||
emissions_units | ||
FROM cammesa_region_emissions_staging; | ||
|
||
-- Drop the staging table | ||
DROP TABLE cammesa_region_emissions_staging; |
151 changes: 151 additions & 0 deletions
151
global-api/importer/argentinian_datasets/cammesa/processed_cammesa_AR.csv
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
-560 KB
(77%)
...api/importer/argentinian_datasets/cammesa/raw_cammesa_monthly_electricity_generation.xlsx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.