Skip to content

Refactor: Make pformat an internal variable in IDL loader#160

Merged
henry2004y merged 2 commits into
mainfrom
refactor-idl-pformat-internal
Nov 15, 2025
Merged

Refactor: Make pformat an internal variable in IDL loader#160
henry2004y merged 2 commits into
mainfrom
refactor-idl-pformat-internal

Conversation

@henry2004y

Copy link
Copy Markdown
Owner

The pformat attribute, used to determine the floating-point precision of binary IDL files, is an internal implementation detail of the file parser.

This commit removes the pformat attribute from the final xarray.Dataset's attrs dictionary. This prevents cluttering the dataset's metadata with information that is not relevant to the user, who can infer the data type directly from the loaded arrays.

The `pformat` attribute, used to determine the floating-point precision of binary IDL files, is an internal implementation detail of the file parser.

This commit removes the `pformat` attribute from the final `xarray.Dataset`'s `attrs` dictionary. This prevents cluttering the dataset's metadata with information that is not relevant to the user, who can infer the data type directly from the loaded arrays.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @henry2004y, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the IDL loader to enhance the clarity and relevance of metadata associated with xarray.Dataset objects. By identifying and removing the pformat attribute, which serves as an internal implementation detail, the dataset's attrs dictionary is streamlined. This ensures that users receive cleaner, more focused metadata, improving the overall usability and interpretability of loaded IDL data.

Highlights

  • Metadata Cleanup: The pformat attribute, which is an internal implementation detail for determining floating-point precision in binary IDL files, is now removed from the final xarray.Dataset's attrs dictionary.
  • Improved User Experience: This change prevents cluttering the dataset's metadata with information not directly relevant to the user, allowing them to infer data types directly from the loaded arrays.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request correctly refactors the IDL loader by removing the internal pformat attribute from the final dataset's metadata. This is a good improvement as it avoids cluttering the user-facing attributes with implementation details. The change is simple and effective. I have one minor suggestion to use a more idiomatic Python approach for removing the dictionary key, but the current implementation is also correct.

Comment thread src/flekspy/idl/idl.py Outdated
@codecov

codecov Bot commented Nov 15, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.31%. Comparing base (2177e73) to head (17b5f1e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #160   +/-   ##
=======================================
  Coverage   68.30%   68.31%           
=======================================
  Files          25       25           
  Lines        4190     4191    +1     
=======================================
+ Hits         2862     2863    +1     
  Misses       1328     1328           

☔ 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.

The `pformat` attribute, used to determine the floating-point precision of binary IDL files, is an internal implementation detail of the file parser.

This commit refactors the IDL loader to use `pformat` as a transient variable for parsing and then removes it from the final `xarray.Dataset`'s `attrs` dictionary. This prevents cluttering the dataset's metadata with information that is not relevant to the user, who can infer the data type directly from the loaded arrays. The `pop()` method is used for a more concise implementation.
@henry2004y henry2004y merged commit 4c8d077 into main Nov 15, 2025
2 checks passed
@henry2004y henry2004y deleted the refactor-idl-pformat-internal branch November 15, 2025 17:18
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.

1 participant