Skip to content
Snippets Groups Projects
Commit d7f36fdd authored by Greg Quinn's avatar Greg Quinn
Browse files

Add crgen.diff_crs for validated generated CR data

parent b03b94a2
No related branches found
No related tags found
No related merge requests found
......@@ -2,14 +2,42 @@
"""EDOS PDS construction record generation for SUOMI NPP"""
from datetime import datetime
import copy
import difflib
import itertools
import logging
import os
import pprint
import edosl0util.crio as crio
from edosl0util.headers import DaySegmentedTimecode
from edosl0util.stream import jpss_packet_stream
def diff_crs(real_file, generated_file):
"""Print full diff output from a real EDOS CR to one generated by this module
Only fields which can be generated by this module via a packet scan are compared.
Nothing is output if the CRs are the same.
"""
def main():
real = crio.read(real_file)
generated = crio.read(generated_file)
make_comparable(real, generated)
if real != generated:
diff = difflib.ndiff(pprint.pformat(real).splitlines(),
pprint.pformat(generated).splitlines())
for line in diff:
print line
def make_comparable(real, generated):
insert_fake_cr_info(real)
del generated['completion_time'] # it seems CR completion time does not match PDS
del real['completion_time'] # creation time from the file name
main()
def test_build_apid_info():
# FIXME: build CR comparison into the CLI
calculated = build_cr('P1571289CRISSCIENCEAAT15320210920101.PDS')
......@@ -102,7 +130,7 @@ def get_pds_creation_time(pds_file_or_id):
def build_apid_info(scan_apid_info):
"""Build up apid_info resulting from scan_packets into a full apid_info for a CR"""
apid_info = deepcopy(scan_apid_info)
apid_info = copy.deepcopy(scan_apid_info)
for entry in apid_info:
entry['scid'] = npp_scid
entry['vcid_count'] = 1
......
......@@ -22,6 +22,7 @@ setup(
edosl0trunc = edosl0util.cli.trunc:main
edosl0info = edosl0util.cli.info:main
edosl0merge = edosl0util.cli.merge:main
edosl0crgen = edosl0util.cli.crgen:main
rdr2l0 = edosl0util.cli.rdr2l0:main
"""
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment