Skip to content
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

Renaming of dimensions and variables #34

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Renaming of dimensions and variables #34

wants to merge 7 commits into from

Conversation

shunt16
Copy link
Collaborator

@shunt16 shunt16 commented Nov 18, 2024

Fixes #21 and #33.

Adds methods (plus tests):

  • obsarray.unc_accessor.UncAccessor.rename
  • obsarray.unc_accessor.UncAccessor.rename_dims

Add function (plus tests):

  • obsarray.utils.append_name

Docs updated according:

  • API docs for above functions
  • Uncertainty interface section on renaming

@shunt16 shunt16 requested a review from pdevis November 18, 2024 14:59
@shunt16 shunt16 self-assigned this Nov 18, 2024
Copy link
Contributor

@pdevis pdevis left a comment

Choose a reason for hiding this comment

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

All looks great!

One suggestion for a useful addition would be a function that renames all the variables containing a specific string to another string. E.g. could be implemented along the lines of:

ds.unc.rename(dict([(key, key.replace("temperature", "temperature2")) for key in ds.variables.keys() if "temperature" in key]))

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.

Method to safely rename dimensions
2 participants