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

Add integer_to_string, pad_left, zero_fill functions to utilities_mod #646

Closed
wants to merge 3 commits into from

Conversation

johnsonbk
Copy link
Collaborator

Description:

Adds three functions to utilities_mod: zero_fill, pad_left and integer_to_string

Fixes issue

#645

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Documentation changes needed?

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Tests

I used all three functions in a test version of the lorenz_96 model_mod to ensure they work properly, testing edge cases such as passing the zero_fill and pad_left functions desired_length = 0 or passing an inputstring equal to the value of desired_length.

Checklist for merging

  • Updated changelog entry
  • Documentation updated
  • Update conf.py

Checklist for release

  • Merge into main
  • Create release from the main branch with appropriate tag
  • Delete feature-branch

Testing Datasets

  • Dataset needed for testing available upon request
  • Dataset download instructions included
  • No dataset needed

@hkershaw-brown
Copy link
Member

Hi Ben,

I'm going to close this pull request.
The Fortran format statement can be used when writing integers to strings (e.g. I4.4) so I don't think this code is needed.

Cheers,
Helen

@johnsonbk
Copy link
Collaborator Author

Hi Helen, can we discuss this further before the pull request is closed? I brought this up at software stand up on Tuesday. There was general consensus that since there are helper functions already in utilities mod such as string_to_integer (which yes, uses a format statement) it would be helpful to DART developers if there were complimentary functions such as integer_to_string and padding functions that users who are familiar with other languages such as python and MATLAB are accustomed to. Providing such functions in an obvious module such as the utilities_mod can encourage less code duplication, such as the str2int functions in the RTTOV forward operator code.

@johnsonbk johnsonbk closed this Feb 29, 2024
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.

2 participants