Skip to content

Python wrappers for TUV-x Profile and ProfileMap#611

Merged
mattldawson merged 4 commits intomainfrom
develop-598-profile
Sep 17, 2025
Merged

Python wrappers for TUV-x Profile and ProfileMap#611
mattldawson merged 4 commits intomainfrom
develop-598-profile

Conversation

@mattldawson
Copy link
Copy Markdown
Collaborator

This PR adds Python wrappers for the TUV-x Profile and ProfileMap classes. Also, updates existing C/C++ Profile and ProfileMap wrappers to return more meaningful error codes and messages.

closes #598

@github-actions
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Python wrappers for the TUV-x Profile and ProfileMap classes and improves error handling in the existing C/C++ wrappers with more specific error codes and descriptive error messages.

  • Adds comprehensive Python bindings for Profile and ProfileMap classes with dictionary-style access
  • Replaces generic error codes (1) with specific error constants and descriptive messages
  • Adds new C/C++ methods for profile management (get by index, remove, count profiles)

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
src/tuvx/profile_map.cpp Enhanced error handling with specific error codes and added new ProfileMap methods
src/tuvx/profile.cpp Improved error handling and added Profile name/units getter methods
src/tuvx/interface_profile_map.F90 Added Fortran implementations for new ProfileMap functionality
src/tuvx/interface_profile.F90 Added Profile name/units getters and improved error handling
musica/profile_map.py Python wrapper with dictionary-style ProfileMap interface
musica/profile.py Python wrapper for Profile class with numpy array integration
musica/profile_map.cpp Python C++ bindings for ProfileMap class
musica/profile.cpp Python C++ bindings for Profile class
Test files Comprehensive unit tests for Profile and ProfileMap functionality
Comments suppressed due to low confidence (5)

src/tuvx/interface_profile.F90:1

  • These assignments set error_code to success after the operations complete, but they should only be set if no error occurred. This could mask errors that happened during the array operations.
! Copyright (C) 2023-2025 National Center for Atmospheric Research

src/tuvx/interface_profile.F90:1

  • These assignments set error_code to success after the operations complete, but they should only be set if no error occurred. This could mask errors that happened during the array operations.
! Copyright (C) 2023-2025 National Center for Atmospheric Research

src/tuvx/interface_profile.F90:1

  • These assignments set error_code to success after the operations complete, but they should only be set if no error occurred. This could mask errors that happened during the array operations.
! Copyright (C) 2023-2025 National Center for Atmospheric Research

src/tuvx/interface_profile.F90:1

  • These assignments set error_code to success after the operations complete, but they should only be set if no error occurred. This could mask errors that happened during the array operations.
! Copyright (C) 2023-2025 National Center for Atmospheric Research

src/tuvx/interface_profile.F90:1

  • These assignments set error_code to success after the operations complete, but they should only be set if no error occurred. This could mask errors that happened during the array operations.
! Copyright (C) 2023-2025 National Center for Atmospheric Research

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 17, 2025

Codecov Report

❌ Patch coverage is 57.52809% with 189 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.65%. Comparing base (0910c25) to head (7ebeb9a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/tuvx/profile_map.cpp 43.33% 85 Missing ⚠️
src/tuvx/profile.cpp 37.39% 72 Missing ⚠️
src/tuvx/interface_profile_map.F90 74.25% 26 Missing ⚠️
src/tuvx/interface_profile.F90 83.33% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #611      +/-   ##
==========================================
- Coverage   79.92%   78.65%   -1.28%     
==========================================
  Files          54       54              
  Lines        6367     6783     +416     
==========================================
+ Hits         5089     5335     +246     
- Misses       1278     1448     +170     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@boulderdaze boulderdaze left a comment

Choose a reason for hiding this comment

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

Looks good! It might be helpful to organize the files under musica/ in a more hierarchical structure, as the number of files is growing and it doesn't seem to have a clear structure right now. This isn't something related to this task, though. Just one thing that I noticed while reviewing this.

@mattldawson mattldawson merged commit 0b666d2 into main Sep 17, 2025
68 checks passed
@mattldawson mattldawson deleted the develop-598-profile branch September 17, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose the TUV-x profile and profile map classes through the Python API

5 participants