Skip to content

Add atms runner#22

Open
adybbroe wants to merge 25 commits intopytroll:mainfrom
adybbroe:add-atms-runner
Open

Add atms runner#22
adybbroe wants to merge 25 commits intopytroll:mainfrom
adybbroe:add-atms-runner

Conversation

@adybbroe
Copy link
Contributor

@adybbroe adybbroe commented Feb 8, 2023

  • Closes #xxxx
  • Tests added
  • Tests passed: Passes pytest cspp_runner
  • Passes flake8
  • Fully documented

Adam.Dybbroe added 3 commits February 8, 2023 11:12
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
@adybbroe adybbroe requested a review from gerritholl February 8, 2023 20:01
@adybbroe adybbroe self-assigned this Feb 8, 2023
@adybbroe adybbroe requested a review from TAlonglong February 8, 2023 20:01
@adybbroe adybbroe marked this pull request as draft February 8, 2023 20:03
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #22 (37a2d29) into main (6f22cca) will decrease coverage by 1.69%.
The diff coverage is 72.86%.

❗ Current head 37a2d29 differs from pull request most recent head 6205e1a. Consider uploading reports for the commit 6205e1a to get more accurate results

@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
- Coverage   78.59%   76.91%   -1.69%     
==========================================
  Files          12       19       +7     
  Lines         995     1373     +378     
==========================================
+ Hits          782     1056     +274     
- Misses        213      317     +104     
Flag Coverage Δ
unittests 76.91% <72.86%> (-1.69%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
cspp_runner/config.py 100.00% <100.00%> (ø)
cspp_runner/constants.py 100.00% <100.00%> (ø)
cspp_runner/runner.py 85.60% <100.00%> (+0.62%) ⬆️
cspp_runner/tests/conftest.py 100.00% <100.00%> (ø)
cspp_runner/tests/test_config.py 100.00% <100.00%> (ø)
cspp_runner/tests/test_run_atms.py 100.00% <100.00%> (ø)
cspp_runner/viirs_dr_runner.py 96.66% <ø> (ø)
cspp_runner/logger.py 0.00% <0.00%> (ø)
cspp_runner/atms_rdr2sdr_runner.py 58.60% <58.60%> (ø)

... and 2 files with indirect coverage changes

Adam.Dybbroe added 11 commits February 9, 2023 10:57
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
@adybbroe adybbroe marked this pull request as ready for review May 2, 2023 09:08
Copy link
Member

@gerritholl gerritholl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work. I have only minor comments and some questions. Some functions can do with better docstrings.

Could you edit the PR description itself to better summarise the changes?

Comment on lines +6 to +8
# Author(s):

# Adam Dybbroe <Firstname.Lastname at smhi.se>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant, as the authors are already listed in AUTHORS.md.

_DEFAULT_LOG_FORMAT = '[%(levelname)s: %(asctime)s : %(name)s] %(message)s'


LOG = logging.getLogger(__name__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a constant, to logger would be a better name.

try:
atms = AtmsSdrRunner(cmd_args.config_file)
except Exception as err:
LOG.error('ATMS RDR to SDR processing crashed: %s', str(err))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LOG.error('ATMS RDR to SDR processing crashed: %s', str(err))
LOG.exception('ATMS RDR to SDR processing crashed: %s', str(err))

full traceback information is useful here, otherwise one might just get ...crashed: KeyError.

Comment on lines +1 to +3
#!/usr/bin/env python
# -*- coding: utf-8 -*-

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module is only for importing, so those lines are redundant.

Comment on lines +6 to +9
# Author(s):

# Adam Dybbroe <Firstname.Lastname@smhi.se>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authors are already listed in AUTHORS.md and cumbersome to maintain per module, so those lines could be removed here.

Comment on lines +1 to +3
#!/usr/bin/env python
# -*- coding: utf-8 -*-

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#!/usr/bin/env python
# -*- coding: utf-8 -*-

Redundant lines for a module.

Comment on lines +6 to +9
# Author(s):

# Adam Dybbroe <Firstname.Lastname@smhi.se>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Author(s):
# Adam Dybbroe <Firstname.Lastname@smhi.se>

Redundant lines; authors are in AUTHORS.md.

Comment on lines +142 to +158
def test_move_files_to_destination_pathlib(fake_yamlconfig_file, fake_sdr_homedir, fake_atms_sdr_files_one_pass):
"""Test move the ATMS SDR files to a destination dir."""
config = read_config(fake_yamlconfig_file)
patterns = config['sdr_file_patterns']

sdr_file_paths = glob(str(fake_atms_sdr_files_one_pass / '*h5'))
expected = [os.path.basename(f) for f in sdr_file_paths]
expected.sort()

filelist = move_files_to_destination(sdr_file_paths, patterns, fake_sdr_homedir)

assert len(filelist) == 3
assert os.path.basename(os.path.normpath(os.path.dirname(filelist[0]))) == "noaa20_20230209_1317_27088"
bnames = [os.path.basename(f) for f in filelist]
bnames.sort()

assert bnames == expected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function looks very similar to test_move_files_to_destination_dir_is_str. The two test functions can/should be merged into a single one that is parameterised.

posttroll:
level: ERROR
propagate: false
handlers: [console,]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the trailing , do anything in YAML?

author_email='adam.dybroe@smhi.se',
author='The Pytroll Team',
author_email='pytroll@googlegroups.com',
classifiers=["Development Status :: 3 - Alpha",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still Alpha if we're using it in production?

Adam.Dybbroe added 3 commits October 9, 2023 10:31
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Adam.Dybbroe and others added 3 commits October 9, 2023 10:39
# Conflicts:
#	cspp_runner/runner.py
Signed-off-by: Adam.Dybbroe <a000680@c22526.ad.smhi.se>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants