@powercalc/power-router 1.0.63 → 1.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/controllers/LoadAndParse.d.ts +1 -0
  2. package/dist/controllers/LoadAndParse.js +12 -5
  3. package/dist/controllers/LoadAndParse.js.map +1 -1
  4. package/dist/controllers/Router.js +1 -0
  5. package/dist/controllers/Router.js.map +1 -1
  6. package/dist/interfaces/config.d.ts +1 -0
  7. package/dist/services/EnergyCharts.d.ts +17 -0
  8. package/dist/services/EnergyCharts.js +190 -0
  9. package/dist/services/EnergyCharts.js.map +1 -0
  10. package/dist/services/Eurostat.d.ts +3 -2
  11. package/dist/services/Eurostat.js +49 -13
  12. package/dist/services/Eurostat.js.map +1 -1
  13. package/dist/services/LoadService.d.ts +12 -11
  14. package/dist/services/LoadService.js +44 -18
  15. package/dist/services/LoadService.js.map +1 -1
  16. package/dist/services/Loader.d.ts +2 -2
  17. package/dist/services/Loader.js +10 -2
  18. package/dist/services/Loader.js.map +1 -1
  19. package/dist/services/NaturalGasPrice.d.ts +2 -1
  20. package/dist/services/NaturalGasPrice.js +5 -1
  21. package/dist/services/NaturalGasPrice.js.map +1 -1
  22. package/dist/services/ParseEdifact.js +0 -6
  23. package/dist/services/ParseEdifact.js.map +1 -1
  24. package/dist/services/batch/maxHydrofill.js +0 -2
  25. package/dist/services/batch/maxHydrofill.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/app.ts +9 -0
  28. package/src/genTypes.ts +0 -1
  29. package/src/router/controllers/LoadAndParse.ts +11 -6
  30. package/src/router/controllers/Router.ts +1 -1
  31. package/src/router/interfaces/config.ts +6 -5
  32. package/src/router/services/EnergyCharts.ts +195 -0
  33. package/src/router/services/Eurostat.ts +111 -68
  34. package/src/router/services/LoadService.ts +129 -80
  35. package/src/router/services/Loader.ts +11 -4
  36. package/src/router/services/NaturalGasPrice.ts +5 -1
  37. package/src/router/services/ParseEdifact.ts +0 -6
  38. package/src/router/services/batch/maxHydrofill.ts +0 -2
@@ -1,83 +1,126 @@
1
- import { readFileSync } from "fs";
2
- import { join } from "path";
3
- import { Country } from "./Loader";
4
-
5
- process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = '0';
1
+ import { readFileSync } from 'fs'
2
+ import { join } from 'path'
3
+ import { Country } from './Loader'
4
+ import { Format, QueryOptions } from '../interfaces/queryoptions'
6
5
 
6
+ process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'
7
7
 
8
8
  interface Fuel {
9
- chartType: string;
10
- siec: string;
11
- nrg_bal: string;
12
- unit: string;
13
- freq: string;
9
+ chartType: string
10
+ siec: string
11
+ nrg_bal: string
12
+ unit: string
13
+ freq: string
14
14
  }
15
15
 
16
16
  interface Fuels {
17
- [key: string]: Fuel;
17
+ [key: string]: Fuel
18
18
  }
19
19
 
20
-
21
20
  export class EurostatAPI {
22
- countries: Country[] = [];
23
- constructor() {
24
- const countryPath = join(__dirname, '..', 'config/countries.json')
25
- const countriesString = readFileSync(countryPath, 'utf-8')
26
- this.countries = JSON.parse(countriesString);
27
- }
28
- private fuels: Fuels = {
29
- gas: { chartType: 'NRG_CB_GASM', siec: 'G3000', nrg_bal: 'IC_OBS', unit: 'TJ_GCV', freq: 'M' },
30
- gas4electricity: { chartType: 'NRG_CB_GASM', siec: 'G3000', nrg_bal: 'TI_EHG_MAP', unit: 'TJ_GCV', freq: 'M' },
31
- gasoline: { chartType: 'NRG_CB_OILM', siec: 'O4652', nrg_bal: 'GID_OBS', unit: 'THS_T', freq: 'M' },
32
- diesel: { chartType: 'NRG_CB_OILM', siec: 'O46711', nrg_bal: 'GID_OBS', unit: 'THS_T', freq: 'M' },
33
- kerosin: { chartType: 'NRG_CB_OILM', siec: 'O4661', nrg_bal: 'GID_OBS', unit: 'THS_T', freq: 'M' }
34
- };
35
- private energyConversionFactors = new Map([
36
- ['KG_EQ', 12988.48], // kg of oil equivalent to J
37
- ['TJ_GCV', 10 ** 12], // joules per terajoule of gross calorific value
38
- ['THS_T', 41868000000000], // joules per thousand metric tons of oil equivalent
39
- ]);
21
+ countries: Country[] = []
22
+ constructor() {
23
+ const countryPath = join(__dirname, '..', 'config/countries.json')
24
+ const countriesString = readFileSync(countryPath, 'utf-8')
25
+ this.countries = JSON.parse(countriesString)
26
+ }
27
+ private fuels: Fuels = {
28
+ gas: {
29
+ chartType: 'NRG_CB_GASM',
30
+ siec: 'G3000',
31
+ nrg_bal: 'IC_OBS',
32
+ unit: 'TJ_GCV',
33
+ freq: 'M',
34
+ },
35
+ gas4electricity: {
36
+ chartType: 'NRG_CB_GASM',
37
+ siec: 'G3000',
38
+ nrg_bal: 'TI_EHG_MAP',
39
+ unit: 'TJ_GCV',
40
+ freq: 'M',
41
+ },
42
+ gasoline: {
43
+ chartType: 'NRG_CB_OILM',
44
+ siec: 'O4652',
45
+ nrg_bal: 'GID_OBS',
46
+ unit: 'THS_T',
47
+ freq: 'M',
48
+ },
49
+ diesel: {
50
+ chartType: 'NRG_CB_OILM',
51
+ siec: 'O46711',
52
+ nrg_bal: 'GID_OBS',
53
+ unit: 'THS_T',
54
+ freq: 'M',
55
+ },
56
+ kerosin: {
57
+ chartType: 'NRG_CB_OILM',
58
+ siec: 'O4661',
59
+ nrg_bal: 'GID_OBS',
60
+ unit: 'THS_T',
61
+ freq: 'M',
62
+ },
63
+ }
64
+ private energyConversionFactors = new Map([
65
+ ['KG_EQ', 12988.48], // kg of oil equivalent to J
66
+ ['TJ_GCV', 10 ** 12], // joules per terajoule of gross calorific value
67
+ ['THS_T', 41868000000000], // joules per thousand metric tons of oil equivalent
68
+ ])
40
69
 
41
- convertToMWh(value: number, unit: string) {
42
- const MWh = value * (this.energyConversionFactors.get(unit) || 0) / 3600 / 10 ** 6;
43
- return Math.round(MWh);
44
- }
70
+ convertToMWh(value: number, unit: string) {
71
+ const MWh =
72
+ (value * (this.energyConversionFactors.get(unit) || 0)) / 3600 / 10 ** 6
73
+ return Math.round(MWh)
74
+ }
45
75
 
46
- private async fetchData(url: string, type: string, unit: string): Promise<any> {
47
- const response = await fetch(url);
48
- const data: any = await response.json();
49
- try {
50
- const time = Object.keys(data.dimension.time.category.index);
51
- return {
52
- time: time.map(item => new Date(item).getTime()),
53
- [type]: Object.values(data.value).map((item: any) => this.convertToMWh(item, unit))
54
- }
55
- } catch (e) {
56
- return {
57
- [type]:[],
58
- time: []
59
- }
60
- }
76
+ private async fetchData(
77
+ url: string,
78
+ type: string,
79
+ unit: string
80
+ ): Promise<any> {
81
+ const response = await fetch(url)
82
+ const data: any = await response.json()
83
+ try {
84
+ const time = Object.keys(data.dimension.time.category.index)
85
+ return {
86
+ time: time.map((item) => new Date(item).getTime()),
87
+ [type]: Object.values(data.value).map((item: any) =>
88
+ this.convertToMWh(item, unit)
89
+ ),
90
+ }
91
+ } catch (e) {
92
+ return {
93
+ [type]: [],
94
+ time: [],
95
+ }
61
96
  }
97
+ }
62
98
 
63
- async load(countryCode: string): Promise<any> {
64
- const countryShort = this.countries.find(item => item.code === countryCode)?.short;
65
- const baseUrl = 'https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/';
66
- const geo = `.${countryShort}`;
67
-
68
- const promises = []
69
- for (const [type, fuel] of Object.entries(this.fuels)) {
70
- const { chartType, siec, nrg_bal, unit, freq } = fuel;
71
- const select = `${chartType}/${freq}.${nrg_bal}.${siec}.${unit}`;
72
- const rest = `?format=JSON&lang=en&startPeriod=2015-01&endPeriod=2050-12`;
73
- const url = `${baseUrl}${select}${geo}${rest}`;
74
- promises.push(this.fetchData(url, type, unit))
75
- }
76
- const res = await Promise.all(promises)
77
- let merged: any = {};
78
- res.forEach(item => {
79
- merged = { ...merged, ...item };
80
- })
81
- return merged; // this.removeElGas(merged);
99
+ async load(countryCode: string, queryOptions: QueryOptions): Promise<any> {
100
+ const countryShort = this.countries.find(
101
+ (item) => item.code === countryCode
102
+ )?.short
103
+ const baseUrl =
104
+ 'https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/'
105
+ const geo = `.${countryShort}`
106
+ const urls = [];
107
+ const promises = []
108
+ for (const [type, fuel] of Object.entries(this.fuels)) {
109
+ const { chartType, siec, nrg_bal, unit, freq } = fuel
110
+ const select = `${chartType}/${freq}.${nrg_bal}.${siec}.${unit}`
111
+ const rest = `?format=JSON&lang=en&startPeriod=2015-01&endPeriod=2050-12`
112
+ const url = `${baseUrl}${select}${geo}${rest}`
113
+ urls.push(url)
114
+ promises.push(this.fetchData(url, type, unit))
115
+ }
116
+ if(queryOptions.format === Format.SOURCES){
117
+ return urls;
82
118
  }
119
+ const res = await Promise.all(promises)
120
+ let merged: any = {}
121
+ res.forEach((item) => {
122
+ merged = { ...merged, ...item }
123
+ })
124
+ return merged // this.removeElGas(merged);
125
+ }
83
126
  }
@@ -1,96 +1,145 @@
1
- import { readFileSync } from "fs";
2
- import { join } from "path";
3
- import { EntsoeLoader, LoaderConfig } from "./Loader";
4
- import { DataPoint, EdifactParser } from "./ParseEdifact";
5
- import { ParseInstalled } from "./ParseInstalled";
6
- import { CommonTimestamps } from "./CommonTimestamps";
7
- import { EurostatAPI } from "./Eurostat";
8
- import { Types } from "../interfaces/types";
9
- import { Format, QueryOptions } from "../interfaces/queryoptions";
10
- import { NaturalGasPrices } from "./NaturalGasPrice";
1
+ import { readFileSync } from 'fs'
2
+ import { join } from 'path'
3
+ import { EntsoeLoader, LoaderConfig } from './Loader'
4
+ import { DataPoint, EdifactParser } from './ParseEdifact'
5
+ import { ParseInstalled } from './ParseInstalled'
6
+ import { CommonTimestamps } from './CommonTimestamps'
7
+ import { EurostatAPI } from './Eurostat'
8
+ import { Types } from '../interfaces/types'
9
+ import { Format, QueryOptions } from '../interfaces/queryoptions'
10
+ import { NaturalGasPrices } from './NaturalGasPrice'
11
+ import { Entsoe } from '../interfaces/entsoe'
12
+ import { EnergyCharts } from './EnergyCharts'
11
13
 
12
14
  export class LoadService {
13
- country = '';
14
- loader: EntsoeLoader;
15
- parser: EdifactParser;
16
- parseInstalled: ParseInstalled;
15
+ country = ''
16
+ loader: EntsoeLoader
17
+ parser: EdifactParser
18
+ parseInstalled: ParseInstalled
17
19
 
18
- constructor(private loaderConfig: LoaderConfig) {
19
- const typesPath = join(__dirname, '../config/types.json'); // Set the path to your config file
20
- const types = JSON.parse(readFileSync(typesPath, 'utf8')) as Types; // Read the config file from disk
20
+ constructor(private loaderConfig: LoaderConfig) {
21
+ const typesPath = join(__dirname, '../config/types.json') // Set the path to your config file
22
+ const types = JSON.parse(readFileSync(typesPath, 'utf8')) as Types // Read the config file from disk
21
23
 
22
- this.loader = new EntsoeLoader(loaderConfig);
23
- this.parser = new EdifactParser(types);
24
- this.parseInstalled = new ParseInstalled(types);
24
+ this.loader = new EntsoeLoader(loaderConfig)
25
+ this.parser = new EdifactParser(types)
26
+ this.parseInstalled = new ParseInstalled(types)
27
+ }
28
+ async getPowerEnergyCharts(
29
+ countryCode: string,
30
+ year: number,
31
+ month: number,
32
+ ): Promise<any> {
33
+ const startMonth = new Date(Date.UTC(year, month - 1)).toISOString()
34
+ const endMonth = new Date(Date.UTC(year, month)).toISOString()
35
+ const energyCharts = new EnergyCharts()
36
+ const power = await energyCharts.load(countryCode, startMonth, endMonth)
37
+ return power
38
+ }
39
+ async getPower(
40
+ countryCode: string,
41
+ year: number,
42
+ month: number,
43
+ queryOptions?: QueryOptions
44
+ ): Promise<any> {
45
+ const startMonth = new Date(Date.UTC(year, month - 1)).toISOString()
46
+ const endMonth = new Date(Date.UTC(year, month)).toISOString()
47
+ const wanted = ['generation', 'price', 'consumption']
48
+ if (queryOptions?.format === Format.SOURCES) {
49
+ return this.loader.makeUrls(wanted, countryCode, year, month)
25
50
  }
26
-
27
- async getPower(countryCode: string, year: number, month: number, queryOptions?: QueryOptions):Promise<any> {
28
- const wanted = ['generation', 'price', 'consumption'];
29
- if (queryOptions?.format === Format.SOURCES) {
30
- return this.loader.makeUrls(wanted, countryCode, year, month);
31
- }
32
- const edifactAsJson = await this.loader.load(wanted, countryCode, year, month, queryOptions);
33
- if (queryOptions?.format === Format.EDIJSON) {
34
- return edifactAsJson;
35
- }
36
- const parsed = await this.parser.parseAll(edifactAsJson);
37
- if (queryOptions?.format === Format.KEYVALUE) {
38
- return parsed;
39
- }
40
- const startMonth = (new Date(Date.UTC(year, month - 1))).toISOString()
41
- const endMonth = (new Date(Date.UTC(year, month))).toISOString()
42
- const ready = CommonTimestamps.transform(parsed, startMonth, endMonth);
43
- return ready;
51
+ const edifactAsJson = await this.loader.load(
52
+ wanted,
53
+ countryCode,
54
+ year,
55
+ month,
56
+ queryOptions
57
+ )
58
+ if (queryOptions?.format === Format.EDIJSON) {
59
+ return edifactAsJson
44
60
  }
45
-
46
- async getInstalled(countryCode: string, reload: boolean) {
47
- const edifactAsJson = await this.loader.loadInstalled(countryCode, reload)
48
- const ready = await this.parseInstalled.parse(edifactAsJson);
49
- return ready;
61
+ const parsed = await this.parser.parseAll(edifactAsJson)
62
+ if (queryOptions?.format === Format.KEYVALUE) {
63
+ return parsed
64
+ }
65
+ const ready: any = CommonTimestamps.transform(parsed, startMonth, endMonth)
66
+ //console.log('e.price',e.price)
67
+ /*
68
+ if (!e.price) {
69
+ e.price = ready.price
50
70
  }
71
+ */
72
+ return ready
73
+ }
51
74
 
52
- async getHydrofill(countryCode: string, reload: boolean) {
53
- const wanted = ['hydroFill'];
54
- const endYear = new Date().getFullYear() + 1;
55
- let all: DataPoint[] = []
56
- for (let year = 2015; year < endYear; year++) {
57
- const month = 1;
58
- const edifactAsJson = await this.loader.load(wanted, countryCode, year, month, { reload })
59
- const parsed = await this.parser.parseAll(edifactAsJson);
60
- if (parsed?.hydroFill) {
61
- const yearArr = Object.values(parsed?.hydroFill)?.[0];
62
- if (yearArr) {
63
- all = all.concat(yearArr);
64
- }
65
- }
66
- }
67
- const keyValue = all.filter((obj, index, self) => {
68
- return index === self.findIndex((o) => o.time === obj.time);
69
- });
70
- return {
71
- time: keyValue.map(item => item.time),
72
- hydroFill: keyValue.map(item => item.value)
75
+ async getInstalled(countryCode: string, queryOptions: QueryOptions) {
76
+ /*
77
+ if(queryOptions.format === Format.SOURCES){
78
+ return this.loader.makeUrls(['installed'], countryCode,1,1)
73
79
  }
80
+ */
81
+ const edifactAsJson = await this.loader.loadInstalled(
82
+ countryCode,
83
+ queryOptions
84
+ )
85
+ if (queryOptions.format === Format.SOURCES) {
86
+ return edifactAsJson
74
87
  }
88
+ const ready = await this.parseInstalled.parse(edifactAsJson as Entsoe[])
89
+ return ready
90
+ }
75
91
 
76
- async getFossil(country: string) {
77
- const eurostat = new EurostatAPI();
78
- return await eurostat.load(country)
92
+ async getHydrofill(countryCode: string, queryOptions: QueryOptions) {
93
+ const wanted = ['hydroFill']
94
+ const endYear = new Date().getFullYear() + 1
95
+ let all: DataPoint[] = []
96
+ for (let year = 2015; year < endYear; year++) {
97
+ const month = 1
98
+ const edifactAsJson = await this.loader.load(
99
+ wanted,
100
+ countryCode,
101
+ year,
102
+ month,
103
+ queryOptions
104
+ )
105
+ console.log(edifactAsJson)
106
+ if (queryOptions.format === Format.SOURCES) {
107
+ return [edifactAsJson.hydroFill]
108
+ }
109
+ const parsed = await this.parser.parseAll(edifactAsJson)
110
+ if (parsed?.hydroFill) {
111
+ const yearArr = Object.values(parsed?.hydroFill)?.[0]
112
+ if (yearArr) {
113
+ all = all.concat(yearArr)
114
+ }
115
+ }
79
116
  }
80
-
81
- async getNaturalGasPrices(country: string) {
82
- const eurostat = new NaturalGasPrices();
83
- return await eurostat.load(country)
117
+ const keyValue = all.filter((obj, index, self) => {
118
+ return index === self.findIndex((o) => o.time === obj.time)
119
+ })
120
+ return {
121
+ time: keyValue.map((item) => item.time),
122
+ hydroFill: keyValue.map((item) => item.value),
84
123
  }
124
+ }
85
125
 
126
+ async getFossil(country: string, queryOptions: QueryOptions) {
127
+ const eurostat = new EurostatAPI()
128
+ return await eurostat.load(country, queryOptions)
129
+ }
86
130
 
87
- async getCountrydata(country: string, reload: boolean) {
88
- console.log('reload', country, reload)
89
- return {
90
- fossil: await this.getFossil(country),
91
- price: await this.getNaturalGasPrices(country),
92
- installed: await this.getInstalled(country, reload),
93
- hydrofill: await this.getHydrofill(country, reload)
94
- }
131
+ async getNaturalGasPrices(country: string, queryOptions: QueryOptions) {
132
+ const eurostat = new NaturalGasPrices()
133
+ return await eurostat.load(country, queryOptions)
134
+ }
135
+
136
+ async getCountrydata(country: string, queryOptions: QueryOptions) {
137
+ console.log('reload', country, queryOptions.reload)
138
+ return {
139
+ fossil: await this.getFossil(country, queryOptions),
140
+ price: await this.getNaturalGasPrices(country, queryOptions),
141
+ installed: await this.getInstalled(country, queryOptions),
142
+ hydrofill: await this.getHydrofill(country, queryOptions),
95
143
  }
96
- }
144
+ }
145
+ }
@@ -4,7 +4,7 @@ import { readFile, writeFile } from 'node:fs/promises';
4
4
  import { join } from 'node:path';
5
5
  import { add, format, sub } from 'date-fns'
6
6
  import { Entsoe } from '../interfaces/entsoe';
7
- import { QueryOptions } from '../interfaces/queryoptions';
7
+ import { Format, QueryOptions } from '../interfaces/queryoptions';
8
8
 
9
9
  export interface AllEntsoe {
10
10
  [key: string]: Entsoe;
@@ -41,8 +41,11 @@ export class EntsoeLoader {
41
41
  this.config = loaderConfig;
42
42
  }
43
43
 
44
- async load(wanted: string[], countryCode: string, year: number, month: number, queryOptions?: QueryOptions): Promise<AllEntsoe> {
44
+ async load(wanted: string[], countryCode: string, year: number, month: number, queryOptions?: QueryOptions): Promise<any> {
45
45
  const urls = this.makeUrls(wanted, countryCode, year, month);
46
+ if(queryOptions?.format === Format.SOURCES){
47
+ return urls;
48
+ }
46
49
  const allJsons = await this.fetchAndMakeJson(Object.values(urls), queryOptions?.reload);
47
50
  const result: AllEntsoe = {}
48
51
  Object.keys(urls).forEach((key, i) => {
@@ -89,7 +92,8 @@ export class EntsoeLoader {
89
92
  return filteredUrls;
90
93
  }
91
94
 
92
- async loadInstalled(countryCode: string, reload?: boolean) {
95
+ async loadInstalled(countryCode: string, queryOptions?: QueryOptions) {
96
+ console.log('8858', queryOptions)
93
97
  const currentYear = (new Date()).getFullYear() ;
94
98
  const urls = []
95
99
  for (let year = 2015; year <= currentYear; year++) {
@@ -98,7 +102,10 @@ export class EntsoeLoader {
98
102
  const installed = `${this.config.entsoeDomain}/api?documentType=A68&processType=A33&in_Domain=${countryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
99
103
  urls.push(installed)
100
104
  }
101
- const allJsons = await this.fetchAndMakeJson(Object.values(urls), reload);
105
+ if(queryOptions?.format===Format.SOURCES){
106
+ return urls;
107
+ }
108
+ const allJsons = await this.fetchAndMakeJson(Object.values(urls), queryOptions?.reload);
102
109
  return allJsons;
103
110
  }
104
111
  async fetchAndMakeJson(urls: string[], reload?: boolean): Promise<Entsoe[]> {
@@ -1,6 +1,7 @@
1
1
  import { readFileSync } from "fs"
2
2
  import { join } from "path"
3
3
  import { Country } from "./Loader"
4
+ import { Format, QueryOptions } from "../interfaces/queryoptions"
4
5
 
5
6
  export class NaturalGasPrices {
6
7
  countries: Country[] = []
@@ -9,12 +10,15 @@ export class NaturalGasPrices {
9
10
  const countriesString = readFileSync(countryPath, 'utf-8')
10
11
  this.countries = JSON.parse(countriesString)
11
12
  }
12
- async load(countryCode: string) {
13
+ async load(countryCode: string, queryOptions:QueryOptions) {
13
14
  const countryShort = this.countries.find(
14
15
  (item) => item.code === countryCode
15
16
  )?.short
16
17
 
17
18
  const url = `https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/nrg_pc_203/S.4100.GJ10000-99999.KWH.X_TAX.EUR.${countryShort}/?format=JSON&lang=en&startPeriod=2014&endPeriod=2023`
19
+ if(queryOptions.format === Format.SOURCES){
20
+ return [url];
21
+ }
18
22
  const response = await fetch(url)
19
23
  const json = await response.json()
20
24
  const r = this.convert(json)
@@ -106,12 +106,6 @@ export class EdifactParser {
106
106
 
107
107
  // Calculate time distance in milliseconds
108
108
  const timeDistance = utcEndTime.toMillis() - utcStartTime.toMillis();
109
- if (timeDistance < duration && timeSerie.Period.length !== 1) {
110
- console.log('timeDistance', timeDistance, duration, startIsoString, endIsoString)
111
- }
112
- if (timeDistance > duration) {
113
- //console.log('timeDistance2', timeDistance, duration, startIsoString, endIsoString)
114
- }
115
109
  // Create an array with time distance duration in UTC time using Luxon
116
110
  const timeSteps: number[] = [];
117
111
  for (let i = 0; i <= timeDistance; i += duration) {
@@ -14,7 +14,6 @@ export class Hydrofill {
14
14
  const h = await this.getMaxHydrofill(country.code)
15
15
  if (h.max) {
16
16
  const GW = Math.round(h.max / 1000) + ' GW'
17
- console.log(country.name, GW)
18
17
  country.hydrofill = {
19
18
  min: h.min,
20
19
  max: h.max
@@ -22,7 +21,6 @@ export class Hydrofill {
22
21
  }
23
22
  }
24
23
  const countryFile = join(__dirname, '../../config', 'countrydata.json')
25
- console.log(countryFile)
26
24
  const countryDataFile = join(cwd(), 'data/countrydata.json')
27
25
  writeFileSync(countryFile, JSON.stringify(countries, null, 2))
28
26
  }