Renovus-Tech / solarec-db

GNU Affero General Public License v3.0
0 stars 0 forks source link

M6 - A1 - Find and test reliable sources of hourly grid data for different countries #3

Closed pferrariuy closed 8 months ago

pferrariuy commented 8 months ago

Source of data: https://github.com/ember-climate/ember-data-api (api_country_overview_yearly.csv)

Destination table: ember_country_overview

pferrariuy commented 8 months ago

Created table and command to import information.

CREATE TABLE ember_country_overview (
  country_or_region varchar(100),
  country_code varchar(100),
  year integer,
  demand_twh double precision,
  demand_mwh_per_capita double precision,
  emissions_intensity_gco2_per_kwh double precision,
  continent varchar(100),
  ember_region varchar(100),
  eu_flag double precision NULL,
  g20_flag double precision NULL,
  g7_flag double precision NULL,
  oecd_flag double precision NULL,
  world_demand_rank double precision NULL,
  region_demand_rank double precision NULL,
  oecd_demand_rank double precision NULL,
  eu_demand_rank double precision NULL,
  latest_year integer,
  coal_deadline integer,
  clean_deadline integer
);--

alter table ember_country_overview add primary key (country_or_region, year);--

delete from ember_country_overview;

-- Source: https://raw.githubusercontent.com/ember-climate/ember-data-api/main/data/api_country_overview_yearly.csv
COPY ember_country_overview FROM '/path/to/your_data.csv' WITH CSV HEADER;--