Skip to content

Conversation

@weiji14
Copy link
Member

@weiji14 weiji14 commented Apr 10, 2020

Description of proposed changes

There are 8 parameters in gmt.conf that don't have default settings, meaning they can't be reverted back easily when using pygmt.config. They are:

  • FONT (which changes the FONT_* settings below except FONT_LOGO)
  • FONT_ANNOT
  • FORMAT_TIME_MAP*
  • MAP_ANNOT_OFFSET
  • MAP_GRID_CROSS_SIZE
  • MAP_GRID_PEN
  • MAP_TICK_LENGTH
  • MAP_TICK_PEN

We can manually set the relevant *_PRIMARY and *_SECONDARY parameters for 7 of them (excluding FONT) in an allowlist.

Fixes #409

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 adding new functionality, add an example to docstrings or tutorials.

There are 7 parameters in gmt.conf that don't have default settings, meaning they can't be reverted back easily when using `pygmt.config`. This can be addressed for 6 of them in a whitelist (FONT_ANNOT, FORMAT_TIME_MAP, MAP_ANNOT_OFFSET, MAP_GRID_CROSS_SIZE, MAP_TICK_LENGTH, MAP_TICK_PEN) by manually setting the relevant `*_PRIMARY` and `*_SECONDARY` parameters. Tests added to check that those special parameters are indeed set and reverted back properly when using `pygmt.config` in a `with` statement.
Test number one to check that `FONT_ANNOT_PRIMARY`, `FONT_ANNOT_SECONDARY`, `FONT_LABEL`, and `FONT_TITLE` are modified when the `FONT` config is set.
@weiji14
Copy link
Member Author

weiji14 commented Apr 11, 2020

Just need some extra tests to ensure that setting FONT changes FONT_HEADING and FONT_TAG when using subplots. Might need to complete #412 first 😉

liamtoney added a commit to uafgeotools/rtm that referenced this pull request Apr 27, 2020
Can improve default param setting once
GenericMappingTools/pygmt#411 is merged
@weiji14 weiji14 marked this pull request as ready for review May 12, 2020 04:01
@weiji14
Copy link
Member Author

weiji14 commented May 12, 2020

Just need some extra tests to ensure that setting FONT changes FONT_HEADING and FONT_TAG when using subplots. Might need to complete #412 first wink

Functionality-wise, this bugfix PR is done. We could add the tests for FONT_HEADING and FONT_TAG at a later date once the subplot wrapper is done. What do you think? cc @liamtoney

Copy link
Member

@seisman seisman left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@weiji14 weiji14 merged commit 2c2566d into master May 12, 2020
@weiji14 weiji14 deleted the config/special_params branch May 12, 2020 04:34
@seisman seisman added this to the 0.1.x milestone May 22, 2020
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.

pygmt.conf() can't find default for FONT

3 participants