aemo 0.1.45 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fab0b54e853b46255bf05a76153315da3a9304dc0908e5df7da171eb8b69ade
|
4
|
+
data.tar.gz: 4fbe172ca3ee050dcd8d01637356094d1648ce44ce04a09df31b613bc24399cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f85be386b7744718b945821e56b623edafb5663901aad4fe0d31f2a4060a966d0d96de3c57b67ae7cada7ae1d9d373e089f3cc20b530add3fc7e20da2b45539
|
7
|
+
data.tar.gz: d1010f78df18bf1f4c5fe321bf25fed441df9399f67abbc2d849a25dc8456556a515d39ead27b9f5afb58c612a68fef47e09f5e135868a0dfd8989128242d824
|
data/lib/aemo/market/interval.rb
CHANGED
data/lib/aemo/nem12.rb
CHANGED
@@ -315,12 +315,12 @@ module AEMO
|
|
315
315
|
# Parses the NMI Data Details
|
316
316
|
# @param [String] line A single line in string format
|
317
317
|
# @return [Hash] the line parsed into a hash of information
|
318
|
-
def parse_nem12_200(line,
|
318
|
+
def parse_nem12_200(line, options = {})
|
319
319
|
csv = line.parse_csv
|
320
320
|
|
321
321
|
raise ArgumentError, 'RecordIndicator is not 200' if csv[0] != '200'
|
322
322
|
raise ArgumentError, 'NMI is not valid' unless AEMO::NMI.valid_nmi?(csv[1])
|
323
|
-
if csv[2].nil? || csv[2].match(/.{1,240}/).nil?
|
323
|
+
if options[:strict] && (csv[2].nil? || csv[2].match(/.{1,240}/).nil?)
|
324
324
|
raise ArgumentError, 'NMIConfiguration is not valid'
|
325
325
|
end
|
326
326
|
if !csv[3].nil? && csv[3].match(/.{1,10}/).nil?
|
@@ -514,14 +514,14 @@ module AEMO
|
|
514
514
|
|
515
515
|
# @param [String] path_to_file the path to a file
|
516
516
|
# @return [Array<AEMO::NEM12>] NEM12 object
|
517
|
-
def self.parse_nem12_file(path_to_file, strict =
|
517
|
+
def self.parse_nem12_file(path_to_file, strict = true)
|
518
518
|
parse_nem12(File.read(path_to_file), strict)
|
519
519
|
end
|
520
520
|
|
521
521
|
# @param [String] contents the path to a file
|
522
522
|
# @param [Boolean] strict
|
523
523
|
# @return [Array<AEMO::NEM12>] An array of NEM12 objects
|
524
|
-
def self.parse_nem12(contents, strict =
|
524
|
+
def self.parse_nem12(contents, strict = true)
|
525
525
|
file_contents = contents.tr("\r", "\n").tr("\n\n", "\n").split("\n").delete_if(&:empty?)
|
526
526
|
raise ArgumentError, 'First row should be have a RecordIndicator of 100 and be of type Header Record' unless file_contents.first.parse_csv[0] == '100'
|
527
527
|
|
@@ -531,7 +531,7 @@ module AEMO
|
|
531
531
|
case line[0..2].to_i
|
532
532
|
when 200
|
533
533
|
nem12s << AEMO::NEM12.new('')
|
534
|
-
nem12s.last.parse_nem12_200(line)
|
534
|
+
nem12s.last.parse_nem12_200(line, strict: strict)
|
535
535
|
when 300
|
536
536
|
nem12s.last.parse_nem12_300(line)
|
537
537
|
when 400
|
data/lib/aemo/version.rb
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
# @author Joel Courtney <euphemize@gmail.com>
|
25
25
|
module AEMO
|
26
26
|
# aemo version
|
27
|
-
VERSION = '0.
|
27
|
+
VERSION = '0.2.0'.freeze
|
28
28
|
|
29
29
|
# aemo version split amongst different revisions
|
30
30
|
MAJOR_VERSION, MINOR_VERSION, REVISION = VERSION.split('.').map(&:to_i)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
100,NEM12,200505181432,CNRGYMDP,NEMMCO
|
2
|
+
200,NEM1201002,,E1,E1,N1,01002,KWH,30,
|
3
|
+
300,20050315,300.000,266.100,191.550,247.800,288.600,280.800,282.450,206.100,204.750,289.500,390.600,360.150,407.700,432.600,435.000,491.850,600.900,541.950,474.600,565.350,548.550,491.850,593.250,602.400,571.350,450.150,509.400,559.950,522.000,520.950,541.200,538.050,484.800,330.900,329.250,331.650,330.750,333.750,335.250,294.150,185.250,184.800,186.450,256.800,329.700,320.100,316.500,321.150,A,,,20050316014209,
|
4
|
+
200,NEM1201002,E1E2,E2,E2,N2,01002,KWH,30,
|
5
|
+
300,20050315,113.100,87.600,33.750,60.600,81.900,79.500,81.150,39.750,25.650,58.800,174.300,197.100,390.600,392.550,394.200,418.500,484.950,407.700,407.700,466.500,455.700,386.850,486.900,489.450,465.150,360.000,387.450,458.700,381.900,424.800,446.250,444.450,383.550,172.650,154.050,164.400,164.250,174.450,170.100,110.100,44.550,44.250,39.900,72.300,109.050,102.450,103.950,103.050,A,,,20050316014209,
|
6
|
+
200,NEM1201002,E1E2,E1,E1,N1,01002,KWH,30,
|
7
|
+
300,20050316,321.900,326.400,302.700,298.650,304.500,295.350,309.750,312.300,312.000,338.100,376.950,411.900,546.450,548.250,497.850,528.450,580.800,525.000,435.600,569.400,587.400,577.050,487.350,492.150,588.450,455.550,553.650,515.400,539.700,561.600,540.300,555.600,493.800,349.500,323.700,321.300,322.200,317.550,318.450,324.450,324.600,324.600,321.900,318.750,318.600,317.850,317.100,321.300,A,,,20050317032944,
|
8
|
+
200,NEM1201002,E1E2,E2,E2,N2,01002,KWH,30,
|
9
|
+
300,20050316,104.850,103.500,82.950,64.800,72.300,71.400,72.900,80.100,94.500,121.050,185.100,282.900,427.800,427.950,322.800,381.450,464.400,413.400,332.250,442.950,472.800,466.350,401.550,400.200,470.700,352.800,426.300,381.300,435.450,453.750,433.200,453.000,388.350,226.050,148.050,149.550,142.650,115.650,105.750,107.100,109.350,111.450,107.100,104.250,103.050,101.850,103.200,107.550,A,,,20050317032944,
|
10
|
+
200,NEM1201002,E1E2,E1,E1,N1,01002,KWH,30,
|
11
|
+
300,20050317,322.350,318.000,302.400,294.450,298.650,296.400,315.150,315.600,326.550,358.200,389.700,397.200,513.150,511.200,520.650,510.300,543.450,549.900,419.850,529.200,527.850,506.100,535.050,538.050,369.600,380.850,555.150,558.600,477.900,334.500,337.200,335.250,339.150,335.550,316.200,312.750,312.600,320.250,320.250,315.750,317.250,315.600,314.700,315.300,315.000,315.750,314.400,315.900,A,,,20050318014032,
|
12
|
+
200,NEM1201002,E1E2,E2,E2,N2,01002,KWH,30,
|
13
|
+
300,20050317,104.100,100.800,85.800,70.500,70.950,69.450,53.250,55.650,66.600,106.800,182.100,266.550,408.900,402.150,410.700,414.450,436.200,427.800,325.350,442.200,439.200,432.150,435.300,418.800,283.500,294.000,450.450,455.400,368.400,156.000,160.500,137.550,138.000,134.400,112.350,105.600,103.350,111.750,111.150,107.550,106.500,103.950,102.300,105.750,103.800,97.500,99.750,102.000,A,,,20050318014032,
|
14
|
+
200,NEM1201002,E1E2,E1,E1,N1,01002,KWH,30,
|
15
|
+
300,20050318,315.150,313.800,296.550,298.500,295.200,298.950,300.750,322.950,330.450,350.700,345.750,346.950,345.900,348.600,300.150,337.500,336.750,345.900,330.450,327.150,334.800,345.750,335.850,320.100,325.500,325.200,326.400,330.600,332.700,332.250,321.000,316.500,299.850,302.400,301.050,263.850,255.450,142.050,138.300,138.300,136.800,138.300,136.050,135.750,135.750,136.650,136.050,130.800,A,,,20050319014041,
|
16
|
+
200,NEM1201002,E1E2,E2,E2,N2,01002,KWH,30,
|
17
|
+
300,20050318,103.050,98.850,81.150,75.600,72.150,73.950,74.550,81.150,89.250,124.200,125.700,128.700,136.800,151.050,177.900,174.450,204.000,210.150,180.150,164.400,187.950,211.950,193.800,122.850,124.800,121.200,129.300,131.250,130.950,130.050,118.050,105.750,77.100,75.900,75.000,51.150,44.400,12.300,12.750,12.150,12.450,11.550,14.400,14.550,15.000,14.700,15.750,21.900,A,,,20050319014041,
|
18
|
+
900
|
data/spec/lib/aemo/nem12_spec.rb
CHANGED
@@ -48,9 +48,19 @@ describe AEMO::NEM12 do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
describe '#parse_nem12_200' do
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
context 'non-strict mode' do
|
52
|
+
it 'should not raise validation warning with bad NMI configuration' do
|
53
|
+
expect(AEMO::NEM12.parse_nem12_file(fixture(File.join('NEM12-Errors', 'NEM12#DerpyNMIConfig#CNRGYMDP#NEMMCO.csv')), false))
|
54
|
+
.to be_truthy
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'strict mode (default)' do
|
59
|
+
it 'should raise validation warning with bad NMI configuration' do
|
60
|
+
expect { AEMO::NEM12.parse_nem12_file(fixture(File.join('NEM12-Errors', 'NEM12#DerpyNMIConfig#CNRGYMDP#NEMMCO.csv'))) }
|
61
|
+
.to raise_error(ArgumentError, 'NMIConfiguration is not valid')
|
62
|
+
end
|
63
|
+
end
|
54
64
|
end
|
55
65
|
|
56
66
|
describe '#parse_nem12_300' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aemo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Courtney
|
@@ -392,6 +392,7 @@ files:
|
|
392
392
|
- spec/fixtures/NEM12-Errors/NEM12#000000000000023#CNRGYMDP#NEMMCO
|
393
393
|
- spec/fixtures/NEM12-Errors/NEM12#000000000000024#CNRGYMDP#NEMMCO
|
394
394
|
- spec/fixtures/NEM12-Errors/NEM12#000000000000025#CNRGYMDP#NEMMCO
|
395
|
+
- spec/fixtures/NEM12-Errors/NEM12#DerpyNMIConfig#CNRGYMDP#NEMMCO.csv
|
395
396
|
- spec/fixtures/NEM12/NEM12#000000000000001#CNRGYMDP#NEMMCO.csv
|
396
397
|
- spec/fixtures/NEM12/NEM12#000000000000002#CNRGYMDP#NEMMCO.csv
|
397
398
|
- spec/fixtures/NEM12/NEM12#000000000000003#CNRGYMDP#NEMMCO.csv
|
@@ -517,7 +518,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
517
518
|
version: '0'
|
518
519
|
requirements: []
|
519
520
|
rubyforge_project:
|
520
|
-
rubygems_version: 2.7.
|
521
|
+
rubygems_version: 2.7.6
|
521
522
|
signing_key:
|
522
523
|
specification_version: 4
|
523
524
|
summary: Gem providing functionality for the Australian Energy Market Operator data
|
@@ -538,6 +539,7 @@ test_files:
|
|
538
539
|
- spec/fixtures/NEM12-Errors/NEM12#000000000000023#CNRGYMDP#NEMMCO
|
539
540
|
- spec/fixtures/NEM12-Errors/NEM12#000000000000024#CNRGYMDP#NEMMCO
|
540
541
|
- spec/fixtures/NEM12-Errors/NEM12#000000000000025#CNRGYMDP#NEMMCO
|
542
|
+
- spec/fixtures/NEM12-Errors/NEM12#DerpyNMIConfig#CNRGYMDP#NEMMCO.csv
|
541
543
|
- spec/fixtures/NEM12/NEM12#000000000000001#CNRGYMDP#NEMMCO.csv
|
542
544
|
- spec/fixtures/NEM12/NEM12#000000000000002#CNRGYMDP#NEMMCO.csv
|
543
545
|
- spec/fixtures/NEM12/NEM12#000000000000003#CNRGYMDP#NEMMCO.csv
|