-
Notifications
You must be signed in to change notification settings - Fork 7
Add atms runner #22
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
Open
adybbroe
wants to merge
25
commits into
pytroll:main
Choose a base branch
from
adybbroe:add-atms-runner
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add atms runner #22
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a0eab76
Merge branch 'main' into add-atms-runner
4a1cd19
First attempts to add support for ATMS SDR processing
b423729
Add tests to cover the subprocess call
6587ccd
Add verbosity option
43a0f58
Remove pdb from code
9873a17
Fix call options for cspp/atms script
d41746a
create and send output messages when ATMS processing is ready
fb12b2a
Add missing stop method
17c4a48
Add more debug info
deb3a03
Fix correct orbit number in output messages
37a2d29
Bugfix, and refactor orbit number estimation
95060fa
Temporarily fix path without schema and host specification
dc26f06
Improve logging doing less info and more debug
517932a
Remove unused (commented out) code
5c5b61a
Merge branch 'add-atms-runner' into smhi-atms
a29bd84
Add template for atms cspp configuration
233f54c
Merge branch 'add-atms-runner' into smhi-atms
99ae1bc
Merge branch 'add-option-to-turn-off-lut-updating' into smhi-atms
cda5fd5
Merge branch 'main' into add-atms-runner
adybbroe 470e316
Fix directory name from one of the three SDR files
f87b378
Merge branch 'add-atms-runner' of github.com:adybbroe/pytroll-cspp-ru…
6205e1a
Fix test
7a4ef14
Merge branch 'add-atms-runner' into smhi-atms
e9e399d
Add some more debug printouts
2c8afef
Merge branch 'smhi-atms' into add-atms-runner
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,98 @@ | ||||||
| #!/usr/bin/env python | ||||||
| # -*- coding: utf-8 -*- | ||||||
|
|
||||||
| # Copyright (c) 2022, 2023 Pytroll developers | ||||||
|
|
||||||
| # Author(s): | ||||||
|
|
||||||
| # Adam Dybbroe <Firstname.Lastname at smhi.se> | ||||||
|
|
||||||
| # This program is free software: you can redistribute it and/or modify | ||||||
| # it under the terms of the GNU General Public License as published by | ||||||
| # the Free Software Foundation, either version 3 of the License, or | ||||||
| # (at your option) any later version. | ||||||
|
|
||||||
| # This program is distributed in the hope that it will be useful, | ||||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||
| # GNU General Public License for more details. | ||||||
|
|
||||||
| # You should have received a copy of the GNU General Public License | ||||||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||||
|
|
||||||
| """Level-1 processing for Direct Readout S-NPP/JPSS ATMS data. | ||||||
|
|
||||||
| Using the CSPP level-1 processor from the SSEC, Wisconsin, based on the ADL | ||||||
| software from NASA. Listen for pytroll messages of ready RDR files trigger | ||||||
| processing on direct readout RDR data (granules or full swaths). | ||||||
|
|
||||||
| """ | ||||||
|
|
||||||
| import argparse | ||||||
| import logging | ||||||
| import os | ||||||
| import sys | ||||||
| import logging.handlers | ||||||
|
|
||||||
| from cspp_runner.atms_rdr2sdr_runner import AtmsSdrRunner | ||||||
| from cspp_runner.logger import setup_logging | ||||||
|
|
||||||
| CSPP_SDR_HOME = os.environ.get("CSPP_SDR_HOME", '') | ||||||
|
|
||||||
| #: Default time format | ||||||
| _DEFAULT_TIME_FORMAT = '%Y-%m-%d %H:%M:%S' | ||||||
|
|
||||||
| #: Default log format | ||||||
| _DEFAULT_LOG_FORMAT = '[%(levelname)s: %(asctime)s : %(name)s] %(message)s' | ||||||
|
|
||||||
|
|
||||||
| LOG = logging.getLogger(__name__) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a constant, to |
||||||
|
|
||||||
|
|
||||||
| def get_parser(): | ||||||
| """Get parser for commandline-arguments.""" | ||||||
| parser = argparse.ArgumentParser() | ||||||
| parser.add_argument("-c", "--config-file", | ||||||
| required=True, | ||||||
| dest="config_file", | ||||||
| type=str, | ||||||
| default=None, | ||||||
| help="The file containing configuration parameters.") | ||||||
| parser.add_argument("-l", "--log-config", | ||||||
| help="Log config file to use instead of the standard logging.") | ||||||
| parser.add_argument("-v", "--verbose", dest="verbosity", action="count", default=0, | ||||||
| help="Verbosity (between 1 and 2 occurrences with more leading to more " | ||||||
| "verbose logging). WARN=0, INFO=1, " | ||||||
| "DEBUG=2. This is overridden by the log config file if specified.") | ||||||
| return parser | ||||||
|
|
||||||
|
|
||||||
| def parse_args(): | ||||||
| """Parse command-line arguments.""" | ||||||
| parser = get_parser() | ||||||
| return parser.parse_args() | ||||||
|
|
||||||
|
|
||||||
| def main(): | ||||||
| """Start the CSPP ATMS runner.""" | ||||||
| cmd_args = parse_args() | ||||||
| print("Read config from", cmd_args.config_file) | ||||||
|
|
||||||
| setup_logging(cmd_args) | ||||||
|
|
||||||
| try: | ||||||
| atms = AtmsSdrRunner(cmd_args.config_file) | ||||||
| except Exception as err: | ||||||
| LOG.error('ATMS RDR to SDR processing crashed: %s', str(err)) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
full traceback information is useful here, otherwise one might just get |
||||||
| sys.exit(1) | ||||||
| try: | ||||||
| atms.start() | ||||||
| atms.join() | ||||||
| except KeyboardInterrupt: | ||||||
| LOG.debug("Interrupting") | ||||||
| finally: | ||||||
| atms.close() | ||||||
|
|
||||||
|
|
||||||
| if __name__ == "__main__": | ||||||
| main() | ||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.