GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Figure: Remove deprecated "timestamp" ("U") parameter, use "Figure.timestamp" instead (deprecated since v0.9.0) by yvonnefroehlich · Pull Request #3045 · GenericMappingTools/pygmt

Conversation

@yvonnefroehlich

@yvonnefroehlich yvonnefroehlich commented Feb 6, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Description of proposed changes

This PR removes the deprecated timestampe (U) parameter from all plotting methods (deprecated since v0.9.0).
The standalone method Figure.timestamp should be used instead.

Fixes partly #3033
Related to #2135

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 command is:

  • /format: automatically format and lint the code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
yvonnefroehlich added 3 commits February 6, 2024 11:56
@yvonnefroehlich
Remove U deprecation from decorators
af5f860
@yvonnefroehlich
Remove U deprecation from test
cca6dba
@yvonnefroehlich
Remove un-needed import
d00b48c
@yvonnefroehlich yvonnefroehlich added the deprecation Deprecating a feature label Feb 6, 2024
@yvonnefroehlich yvonnefroehlich mentioned this pull request Feb 6, 2024
Remove the deprecated parameter and alias names in v0.12.0 #3033
Closed
6 tasks done
@yvonnefroehlich yvonnefroehlich changed the title All plotting methods: Remove deprecated 'timestamp' ('U') parameter, use 'Figure.timestamp' instead (deprecated since v0.9.0) All plotting methods: Remove deprecated "timestamp" ("U") parameter, use "Figure.timestamp" instead (deprecated since v0.9.0) Feb 6, 2024
@yvonnefroehlich
Merge branch 'main' into rem-depr-timestamp
d7f1a15
seisman
seisman reviewed Feb 18, 2024
View reviewed changes
Comment thread pygmt/helpers/decorators.py
)
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)

# timestamp (U) is deprecated since v0.9.0.

@seisman seisman Feb 18, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

After this PR, the expected behaviors are:

  • if timestamp=True is used, Python will report the parameter is not recognized
  • if single-letter parameter U=True is used, PyGMT should tell users that U is not supported and Figure.timestamp should be used.

After removing lines 570-580, parameter timestamp is no longer recognized, but single-letter parameter U will still be processed. Thus, instead of removing these lines completely, we should change them to something like:

            # timestamp (U)is deprecated since v0.9.0.
            if "U" in kwargs:
                msg = (
                    "Parameter timestamp/U is no longer supported since v0.12.0."
                    "Use Figure.timestamp() instead."
                )
                raise GMTInvalidInput(msg)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@yvonnefroehlich yvonnefroehlich Feb 18, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ah, OK. Thanks! I have tried to change this in the commits 6977a57, 1501ccc, and 42fab3b. I also changed this in PR #3044 for xshift (X) and yshift (Y).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman seisman added this to the 0.12.0 milestone Feb 18, 2024
yvonnefroehlich added 3 commits February 18, 2024 14:18
@yvonnefroehlich
Keep warning when parameters 'U' or 'timestamp' are used
6977a57
@yvonnefroehlich
Keep warning when parameters 'U' or 'timestamp' are used
1501ccc
@yvonnefroehlich
Remove if query
42fab3b
@yvonnefroehlich yvonnefroehlich self-assigned this Feb 18, 2024
seisman
seisman reviewed Feb 19, 2024
View reviewed changes
Comment thread pygmt/tests/test_timestamp.py
Comment on lines -119 to -130
@pytest.mark.mpl_image_compare(filename="test_timestamp.png")
def test_timestamp_deprecated_u(faketime):
"""
Check if the deprecated parameter 'U' works but raises a warning.
"""
fig = Figure()
with pytest.warns(expected_warning=SyntaxWarning) as record:
with config(FORMAT_TIME_STAMP=faketime):
# plot nothing (the data is outside the region) but a timestamp
fig.plot(x=0, y=0, style="p", projection="X1c", region=[1, 2, 1, 2], U=True)
assert len(record) == 1 # check that only one warning was raised
return fig

@seisman seisman Feb 19, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Need to modify this test to check that the GMTInvalidInput exception is raised if U is used.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seisman seisman Feb 26, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

See https://github.com/GenericMappingTools/pygmt/pull/3045/files#r1502738446.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@yvonnefroehlich yvonnefroehlich Feb 27, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks @seisman for all your help and tips. However, I will not be able to work on this PR and PR #3044 in the next time. If you prefer to complete these two PRs soon, feel free to do so.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
yvonnefroehlich added 3 commits February 22, 2024 05:46
@yvonnefroehlich
Merge branch 'main' into rem-depr-timestamp
554231c
@yvonnefroehlich
Merge branch 'main' into rem-depr-timestamp
b45b45a
@yvonnefroehlich
Merge branch 'main' into rem-depr-timestamp
51e8659
seisman
seisman reviewed Feb 26, 2024
View reviewed changes
Comment thread pygmt/tests/test_timestamp.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

seisman added 2 commits February 27, 2024 20:32
@seisman
Update pygmt/tests/test_timestamp.py
f8a8f4e
@seisman
Merge branch 'main' into rem-depr-timestamp
6154526
@seisman

seisman commented Feb 27, 2024

Copy link
Copy Markdown
Member

/format

genericmappingtools-bot[bot] reacted with hooray emoji github-actions[bot] reacted with rocket emoji github-actions[bot] reacted with eyes emoji
All reactions
  • 🎉 1 reaction
  • 🚀 1 reaction
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

actions-bot and others added 2 commits February 27, 2024 12:34
@actions-bot
[format-command] fixes
a02315e
@seisman
Fix
ed766bb
seisman
seisman reviewed Feb 27, 2024
View reviewed changes
Comment thread pygmt/helpers/decorators.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@seisman
Update pygmt/helpers/decorators.py
b20ebb2
seisman
seisman approved these changes Feb 27, 2024
View reviewed changes
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Feb 27, 2024
@seisman
seisman merged commit 12df978 into main Feb 28, 2024
@seisman
seisman deleted the rem-depr-timestamp branch February 28, 2024 01:58
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Feb 28, 2024
@seisman seisman changed the title All plotting methods: Remove deprecated "timestamp" ("U") parameter, use "Figure.timestamp" instead (deprecated since v0.9.0) Figure: Remove deprecated "timestamp" ("U") parameter, use "Figure.timestamp" instead (deprecated since v0.9.0) Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@seisman seisman seisman approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@yvonnefroehlich yvonnefroehlich

Labels

deprecation Deprecating a feature

Projects

None yet

Milestone

0.12.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@yvonnefroehlich @seisman @actions-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.