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

Figure.timestamp: Let the 'text' parameter work for GMT<=6.4.0 and raise a warning for long text #2425

Merged
merged 2 commits into from
Mar 16, 2023

Conversation

seisman
Copy link
Member

@seisman seisman commented Mar 15, 2023

Description of proposed changes

Changes in this PR:

  1. -U's +t modifier was added Let -U take +ttext to override time stamp gmt#7127, so the text parameter doesn't work for GMT<=6.4.0. This PR implements the same feature for GMT<=6.4.0 by overrriding the timefmt parameter that will be passed to FORMAT_TIME_STAMP. Now, the text parameter works the same for any GMT versions.
  2. Text string passed to the text parameter will be truncated to 64 characters if its length exceeds 64. Now Figure.timestamp() raise a warning instead of an exception when getting a too long text argument.
  3. Add a test for passing a very long text string to the text parameter.

Fixes #

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman added enhancement Improving an existing feature skip-changelog Skip adding Pull Request to changelog and removed skip-changelog Skip adding Pull Request to changelog labels Mar 15, 2023
@seisman seisman added this to the 0.9.0 milestone Mar 15, 2023
@seisman seisman closed this Mar 15, 2023
@seisman seisman reopened this Mar 15, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 15, 2023

Summary of changed images

This is an auto-generated report of images that have changed on the DVC remote

Status Path
added pygmt/tests/baseline/test_timestamp_text_truncated.png

Image diff(s)

Added images

  • pygmt/tests/baseline/test_timestamp_text_truncated.png

Modified images

Path Old New

Report last updated at commit 351ea75

@seisman seisman added the needs review This PR has higher priority and needs review. label Mar 15, 2023
pygmt/src/timestamp.py Outdated Show resolved Hide resolved
@michaelgrund michaelgrund added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Mar 15, 2023
Co-authored-by: Michael Grund <[email protected]>
@seisman seisman merged commit 5793092 into main Mar 16, 2023
@seisman seisman deleted the timestamp-tests branch March 16, 2023 04:54
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants