Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish correct start time for whole overpass #16

Merged
merged 5 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cspp_runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,22 @@ def publish_sdr(publisher, result_files, mda, site, mode,
to_send["orbit_number"] = kwargs['orbit']

to_send["dataset"] = []
start_times = set()
end_times = set()
for result_file in result_files:
filename = os.path.basename(result_file)
to_send[
'dataset'].append({'uri': urlunsplit(('ssh', socket.gethostname(),
result_file, '', '')),
'uid': filename})
(start_time, end_time) = get_sdr_times(filename)
start_times.add(start_time)
end_times.add(end_time)
to_send['format'] = 'SDR'
to_send['type'] = 'HDF5'
to_send['data_processing_level'] = '1B'
to_send['start_time'], to_send['end_time'] = get_sdr_times(filename)
to_send['start_time'] = min(start_times)
to_send['end_time'] = max(end_times)

LOG.debug('Site = %s', site)
LOG.debug('Publish topic = %s', publish_topic)
Expand Down
25 changes: 16 additions & 9 deletions cspp_runner/tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ def fakemessage(fakefile):
def fake_result_names(tmp_path):
p = tmp_path / "results"
all = []
for f in [
"GMTCO_j01_d20211221_t1436067_e1437312_b21200_c20211221144949626416_cspp_dev.h5",
"SVM12_j01_d20211221_t1436067_e1437312_b21200_c20211221145100921548_cspp_dev.h5",
"SVM10_j01_d20211221_t1436067_e1437312_b21200_c20211221145100419360_cspp_dev.h5",
"SVM02_j01_d20211221_t1436067_e1437312_b21200_c20211221145058798219_cspp_dev.h5",
"SVM09_j01_d20211221_t1436067_e1437312_b21200_c20211221145100251266_cspp_dev.h5"]:
new = p / f
all.append(new)
for lbl in ["GMTCO", "SVM02", "SVM09", "SVM10", "SVM12"]:
for f in [
f"{lbl:s}_j01_d20211229_t1342527_e1344173_b21313_c20211229140342734674_cspp_dev.h5",
f"{lbl:s}_j01_d20211229_t1344185_e1345430_b21313_c20211229140341407055_cspp_dev.h5",
f"{lbl:s}_j01_d20211229_t1345442_e1347070_b21313_c20211229140319026930_cspp_dev.h5",
f"{lbl:s}_j01_d20211229_t1347082_e1348327_b21313_c20211229140346771475_cspp_dev.h5",
f"{lbl:s}_j01_d20211229_t1348340_e1349585_b21313_c20211229140336541537_cspp_dev.h5",
f"{lbl:s}_j01_d20211229_t1349597_e1351242_b21313_c20211229140303590485_cspp_dev.h5",
f"{lbl:s}_j01_d20211229_t1351255_e1352482_b21313_c20211229140800466176_cspp_dev.h5",
f"{lbl:s}_j01_d20211229_t1352495_e1354140_b21313_c20211229142321678073_cspp_dev.h5",
f"{lbl:s}_j01_d20211229_t1354152_e1355397_b21313_c20211229142320304291_cspp_dev.h5"]:
new = p / f
all.append(new)
return all


Expand Down Expand Up @@ -117,6 +122,8 @@ def send(self, msg):
assert msg.startswith(
"pytroll://treasure/collected/complete/SDR/1B/wonderland"
"/test/polar/direct_readout dataset")
assert '"end_time": "2021-12-29T13:55:39.700000"' in msg
assert '"start_time": "2021-12-29T13:42:52.700000"' in msg


@pytest.mark.parametrize(
Expand Down Expand Up @@ -258,7 +265,7 @@ def fake_run_cspp(call, args, *rdrs):
(wd, rf) = cspp_runner.runner.spawn_cspp(
os.fspath(
tmp_path /
"RNSCA-RVIRS_j01_d20211221_t1436057_e1444378_b21199_c20211221144433345000_all-_dev.h5"),
"RNSCA-RVIRS_j01_d20211229_t1342527_e1355397_b21199_c20211229144433345000_all-_dev.h5"),
viirs_sdr_call="touch",
viirs_sdr_options=[],
granule_time_tolerance=10)
Expand Down