Skip to content
Open
Show file tree
Hide file tree
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
Feb 8, 2023
4a1cd19
First attempts to add support for ATMS SDR processing
Feb 8, 2023
b423729
Add tests to cover the subprocess call
Feb 8, 2023
6587ccd
Add verbosity option
Feb 9, 2023
43a0f58
Remove pdb from code
Feb 9, 2023
9873a17
Fix call options for cspp/atms script
Feb 9, 2023
d41746a
create and send output messages when ATMS processing is ready
Feb 10, 2023
fb12b2a
Add missing stop method
Feb 10, 2023
17c4a48
Add more debug info
Feb 10, 2023
deb3a03
Fix correct orbit number in output messages
Feb 10, 2023
37a2d29
Bugfix, and refactor orbit number estimation
Feb 10, 2023
95060fa
Temporarily fix path without schema and host specification
Feb 10, 2023
dc26f06
Improve logging doing less info and more debug
Apr 6, 2023
517932a
Remove unused (commented out) code
May 2, 2023
5c5b61a
Merge branch 'add-atms-runner' into smhi-atms
May 4, 2023
a29bd84
Add template for atms cspp configuration
May 4, 2023
233f54c
Merge branch 'add-atms-runner' into smhi-atms
May 4, 2023
99ae1bc
Merge branch 'add-option-to-turn-off-lut-updating' into smhi-atms
May 5, 2023
cda5fd5
Merge branch 'main' into add-atms-runner
adybbroe May 22, 2023
470e316
Fix directory name from one of the three SDR files
Oct 9, 2023
f87b378
Merge branch 'add-atms-runner' of github.com:adybbroe/pytroll-cspp-ru…
Oct 9, 2023
6205e1a
Fix test
Oct 9, 2023
7a4ef14
Merge branch 'add-atms-runner' into smhi-atms
Oct 9, 2023
e9e399d
Add some more debug printouts
Mar 13, 2024
2c8afef
Merge branch 'smhi-atms' into add-atms-runner
May 26, 2025
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
98 changes: 98 additions & 0 deletions bin/atms_dr_runner.py
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>
Comment on lines +6 to +8
Copy link
Copy Markdown
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.


# 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__)
Copy link
Copy Markdown
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.



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))
Copy link
Copy Markdown
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.

sys.exit(1)
try:
atms.start()
atms.join()
except KeyboardInterrupt:
LOG.debug("Interrupting")
finally:
atms.close()


if __name__ == "__main__":
main()
Loading
Loading