Skip to content
Merged
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions ush/python/pyobsforge/task/atmos_bufr_prepobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,23 @@ def finalize(self) -> None:
logger.warning(f"Failed to create summary file {ready_file}: {e}")
logger.warning("Creating an empty ready file instead")
ready_file.touch()

# Run unified restriction filter AFTER finalize
stats_yaml = os.path.join(self.task_config.DATA, "stats.yaml")

script_path = os.path.join(
self.task_config.HOMEobsforge, "build", "bin", "ioda_restriction_filter.py"
)

logger.info(f"Running unified restriction filter using {stats_yaml}")

exec_cmd = Executable("python")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just curious if it makes more sense to call the main function in the python script in the other PR through python (import, etc.) rather than do it this way (execute it externally). Thoughts? Is there a benefit to doing it via a subprocess?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That’s a good point. I didn’t think about it that way initially. I’ll update the script so the task calls the main function directly instead of running it as a subprocess.

exec_cmd.add_default_arg(script_path)
exec_cmd.add_default_arg("--stats")
exec_cmd.add_default_arg(stats_yaml)

try:
exec_cmd()
except Exception as e:
logger.warning(f"ioda_restriction_filter.py failed: {e}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change

Loading