-
Notifications
You must be signed in to change notification settings - Fork 0
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 #35 from gisce/add_S24_support
ADD code to read S24 report
- Loading branch information
Showing
9 changed files
with
899 additions
and
2 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 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 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,49 @@ | ||
from expects import expect, equal | ||
from primestg.report import Report | ||
from ast import literal_eval | ||
|
||
with description('Report S24 examples'): | ||
with before.all: | ||
|
||
self.data_filenames = [ | ||
'spec/data/CIR4621511030_0_S24_0_20180529093051', | ||
'spec/data/CIR4621707229_0_S24_0_20180529200000', | ||
'spec/data/CIR4621707229_0_S24_0_20180529200000_warnings', | ||
] | ||
|
||
self.report = [] | ||
for data_filename in self.data_filenames: | ||
with open(data_filename) as data_file: | ||
self.report.append(Report(data_file)) | ||
|
||
with it('generates result with the expected fields'): | ||
|
||
expected_first_value_first_concentrator = ['cnc_name', 'meters', | ||
'season', 'timestamp'] | ||
|
||
concentrator = list(self.report[0].concentrators)[0] | ||
parameter = concentrator.parameters[0] | ||
first_task_first_concentrator = parameter.values | ||
expect(sorted(first_task_first_concentrator))\ | ||
.to(equal(expected_first_value_first_concentrator)) | ||
|
||
with it('generates the expected results for all reports'): | ||
|
||
result_filenames = [] | ||
warnings = [] | ||
for data_filename in self.data_filenames: | ||
result_filenames.append('{}_result.txt'.format(data_filename)) | ||
|
||
for key, result_filename in enumerate(result_filenames): | ||
result = [] | ||
with open(result_filename) as result_file: | ||
result_string = result_file.read() | ||
expected_result = literal_eval(result_string) | ||
for cnc in self.report[key].concentrators: | ||
for value in cnc.values: | ||
result.append(value) | ||
if cnc.warnings: | ||
warnings.append(cnc.warnings) | ||
expect(result).to(equal(expected_result)) | ||
expect(len(warnings)).to(equal(1)) | ||
expect(len(warnings[0])).to(equal(2)) |
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,95 @@ | ||
<Report IdRpt="S24" IdPet="0" Version="3.1.c"> | ||
<Cnc Id="CIR4621511030"> | ||
<S24 Fh="20180529093051000S"> | ||
<Meter MeterId="CIR0141406756" ComStatus="2" Date="20180529092508000S" Active="Y"/> | ||
<Meter MeterId="CIR0141413501" ComStatus="2" Date="20180529092832000S" Active="Y"/> | ||
<Meter MeterId="CIR0501221770" ComStatus="2" Date="20180529093008000S" Active="Y"/> | ||
<Meter MeterId="CIR0501222666" ComStatus="2" Date="20180529092512000S" Active="Y"/> | ||
<Meter MeterId="CIR0501308446" ComStatus="2" Date="20180529092852000S" Active="Y"/> | ||
<Meter MeterId="CIR0501401084" ComStatus="2" Date="20180529092928000S" Active="Y"/> | ||
<Meter MeterId="CIR0501403531" ComStatus="2" Date="20180529092944000S" Active="Y"/> | ||
<Meter MeterId="CIR0501403537" ComStatus="2" Date="20180529093040000S" Active="Y"/> | ||
<Meter MeterId="CIR0501407326" ComStatus="2" Date="20180529093012000S" Active="Y"/> | ||
<Meter MeterId="CIR0501407379" ComStatus="2" Date="20180529092556000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500210" ComStatus="2" Date="20180529092912000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500212" ComStatus="2" Date="20180529093024000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500213" ComStatus="2" Date="20180529092636000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500214" ComStatus="2" Date="20180529093004000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500226" ComStatus="2" Date="20180529092524000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500231" ComStatus="2" Date="20180529092840000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500232" ComStatus="2" Date="20180529092544000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500234" ComStatus="2" Date="20180529092712000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500235" ComStatus="2" Date="20180529093036000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500237" ComStatus="2" Date="20180529092620000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500238" ComStatus="2" Date="20180529092904000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500239" ComStatus="2" Date="20180529092828000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500241" ComStatus="2" Date="20180529092956000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500242" ComStatus="2" Date="20180529092844000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500243" ComStatus="2" Date="20180529093020000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500244" ComStatus="2" Date="20180529092624000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500245" ComStatus="2" Date="20180529092744000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500246" ComStatus="2" Date="20180529092834000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500248" ComStatus="2" Date="20180529092516000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500249" ComStatus="2" Date="20180529093016000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500251" ComStatus="2" Date="20180529092628000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500252" ComStatus="2" Date="20180529092716000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500253" ComStatus="2" Date="20180529092814000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500255" ComStatus="2" Date="20180529092608000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500256" ComStatus="2" Date="20180529092722000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500259" ComStatus="2" Date="20180529092816000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500260" ComStatus="2" Date="20180529092810000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500261" ComStatus="2" Date="20180529092616000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500262" ComStatus="2" Date="20180529092808000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500263" ComStatus="2" Date="20180529092610000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500264" ComStatus="2" Date="20180529092656000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500275" ComStatus="2" Date="20180529092746000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500277" ComStatus="2" Date="20180529092940000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500308" ComStatus="2" Date="20180529092952000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500316" ComStatus="2" Date="20180529092550000S" Active="Y"/> | ||
<Meter MeterId="CIR0501500336" ComStatus="0" Date="20180516093930000S" Active="N"/> | ||
<Meter MeterId="CIR0501516114" ComStatus="2" Date="20180529092752000S" Active="Y"/> | ||
<Meter MeterId="CIR2081511137" ComStatus="2" Date="20180529014715000S" Active="Y"/> | ||
<Meter MeterId="ITE0131750207" ComStatus="2" Date="20180529092536000S" Active="Y"/> | ||
<Meter MeterId="ITE0131750594" ComStatus="2" Date="20180529092804000S" Active="Y"/> | ||
<Meter MeterId="ITE0131751583" ComStatus="2" Date="20180529092652000S" Active="Y"/> | ||
<Meter MeterId="SAG0135150701" ComStatus="2" Date="20180529092908000S" Active="Y"/> | ||
<Meter MeterId="SAG0136960961" ComStatus="2" Date="20180529092528000S" Active="Y"/> | ||
<Meter MeterId="SAG0146963466" ComStatus="2" Date="20180529092848000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300042" ComStatus="2" Date="20180529092732000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300051" ComStatus="2" Date="20180529092724000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300054" ComStatus="2" Date="20180529092704000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300071" ComStatus="2" Date="20180529092612000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300074" ComStatus="2" Date="20180529092520000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300076" ComStatus="2" Date="20180529092604000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300077" ComStatus="2" Date="20180529092548000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300078" ComStatus="2" Date="20180529092856000S" Active="Y"/> | ||
<Meter MeterId="SAG0155300097" ComStatus="2" Date="20180529092948000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345831" ComStatus="2" Date="20180529092640000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345832" ComStatus="2" Date="20180529092914000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345833" ComStatus="2" Date="20180529092942000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345834" ComStatus="2" Date="20180529092924000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345837" ComStatus="2" Date="20180529092916000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345839" ComStatus="2" Date="20180529092510000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345840" ComStatus="2" Date="20180529092920000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345841" ComStatus="2" Date="20180529093010000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345843" ComStatus="2" Date="20180529092532000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345844" ComStatus="2" Date="20180529092648000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345845" ComStatus="2" Date="20180529092936000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345848" ComStatus="2" Date="20180529092542000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345850" ComStatus="2" Date="20180529092632000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345852" ComStatus="2" Date="20180529092748000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345857" ComStatus="2" Date="20180529092919000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345864" ComStatus="1" Date="20180528202953000S" Active="Y"/> | ||
<Meter MeterId="SAG0155345865" ComStatus="2" Date="20180529093028000S" Active="Y"/> | ||
<Meter MeterId="SAG0155379763" ComStatus="2" Date="20180529092846000S" Active="Y"/> | ||
<Meter MeterId="SAG0155385243" ComStatus="1" Date="20180528202353000S" Active="Y"/> | ||
<Meter MeterId="SAG0155385247" ComStatus="2" Date="20180529092812000S" Active="Y"/> | ||
<Meter MeterId="SAG0155385248" ComStatus="2" Date="20180529092720000S" Active="Y"/> | ||
<Meter MeterId="SAG0165753539" ComStatus="2" Date="20180529093032000S" Active="Y"/> | ||
<Meter MeterId="SAG0175822291" ComStatus="2" Date="20180529092600000S" Active="Y"/> | ||
<Meter MeterId="ZIV0036301504" ComStatus="2" Date="20180529092740000S" Active="Y"/> | ||
<Meter MeterId="ZIV0036303383" ComStatus="2" Date="20180529092728000S" Active="Y"/> | ||
<Meter MeterId="ZIV0036303384" ComStatus="2" Date="20180529092824000S" Active="Y"/> | ||
</S24> | ||
</Cnc> | ||
</Report> |
Oops, something went wrong.