Let pygmt.info load datetime columns into a str dtype array#960
Merged
Let pygmt.info load datetime columns into a str dtype array#960
Conversation
Fixes problem with pygmt.info not being able to handle datetime64 inputs. I.e. `ValueError: could not convert string to float: '2021-01-01T12:34:56'` However, users will still need to use`pygmt.info(..., f="0T")` until upstream issue at GenericMappingTools/gmt#4241 is resolved. Also added two extra unit tests using numpy datetime64 types.
weiji14
commented
Feb 24, 2021
seisman
reviewed
Feb 25, 2021
weiji14
added a commit
that referenced
this pull request
Mar 3, 2021
Used to specify data types of input and/or output columns (time or geographical data). See also: - https://docs.generic-mapping-tools.org/6.1/gmt.html#f-full - https://github.com/GenericMappingTools/gmt/blob/6.1.1/doc/rst/source/explain_-f.rst_ - https://github.com/GenericMappingTools/gmt/blob/master/doc/rst/source/explain_-f_full.rst_ - https://docs.generic-mapping-tools.org/6.1/cookbook/options.html#data-type-selection-the-f-option Needed for the workaround datetime bugfix at #960
5 tasks
weiji14
added a commit
that referenced
this pull request
Mar 3, 2021
Used to specify data types of input and/or output columns (time or geographical data). See also: - https://docs.generic-mapping-tools.org/6.1/gmt.html#f-full - https://github.com/GenericMappingTools/gmt/blob/6.1.1/doc/rst/source/explain_-f.rst_ - https://github.com/GenericMappingTools/gmt/blob/master/doc/rst/source/explain_-f_full.rst_ - https://docs.generic-mapping-tools.org/6.1/cookbook/options.html#data-type-selection-the-f-option Needed for the workaround datetime bugfix at #960
Member
Author
|
Hmm, that crash on the Windows GMT dev test at https://github.com/GenericMappingTools/pygmt/runs/2025836161?check_suite_focus=true#step:15:86 at the start (before any tests got run) doesn't look nice. |
Member
|
/test-gmt-dev
It may be just a sporadic crash. Just re-triggered the dev tests. Edit: Jobs at https://github.com/GenericMappingTools/pygmt/actions/runs/619017413 |
Member
Author
|
Thanks! Windows tests have passed at https://github.com/GenericMappingTools/pygmt/runs/2026019634?check_suite_focus=true#step:15:867. Any other comment on this PR? |
seisman
approved these changes
Mar 3, 2021
sixy6e
pushed a commit
to sixy6e/pygmt
that referenced
this pull request
Dec 21, 2022
…MappingTools#994) Used to specify data types of input and/or output columns (time or geographical data). See also: - https://docs.generic-mapping-tools.org/6.1/gmt.html#f-full - https://github.com/GenericMappingTools/gmt/blob/6.1.1/doc/rst/source/explain_-f.rst_ - https://github.com/GenericMappingTools/gmt/blob/master/doc/rst/source/explain_-f_full.rst_ - https://docs.generic-mapping-tools.org/6.1/cookbook/options.html#data-type-selection-the-f-option Needed for the workaround datetime bugfix at GenericMappingTools#960
sixy6e
pushed a commit
to sixy6e/pygmt
that referenced
this pull request
Dec 21, 2022
…appingTools#960) Fixes problem with pygmt.info not being able to handle datetime64 inputs. I.e. `ValueError: could not convert string to float: '2021-01-01T12:34:56'` However, users will still need to use`pygmt.info(..., coltypes="0T")` until upstream issue at GenericMappingTools/gmt#4241 is resolved. Also added two extra unit tests using numpy datetime64 types. * Use common alias coltypes (f) in tests and make a note on the workaround
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of proposed changes
Fixes problem with pygmt.info not being able to handle datetime64 inputs. I.e.
ValueError: could not convert string to float: '2021-01-01T12:34:56'.However, users will still need to use
pygmt.info(..., f="0T")until upstream issue at GenericMappingTools/gmt#4241 is resolved. Something like so:Also added two extra unit tests using numpy datetime64 types.
References:
Addresses #597 on the pygmt side using fix mentioned in #597 (comment). Assuming that GenericMappingTools/gmt#4241 is fixed in GMT 6.2.0, then issue #597 can be closed once PyGMT bumps minimum required GMT version to 6.2.0.
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash commands are:
/format: automatically format and lint the code/test-gmt-dev: run full tests on the latest GMT development version