-
Notifications
You must be signed in to change notification settings - Fork 215
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
Support changing gmt defaults #288
Comments
Using the dictionary syntax is doable through I like the with pygmt.set(bla=something):
pygmt.surface(...) That would make the documentation of other methods easier because they don't take GMT level configuration parameters. These are all handled by |
It seems to me like the most common use case of In spite of the apparent added complexity (I'm sorry to comment on something I know so little about here) I feel that a dictionary of values would certainly be most suitable. As @seisman has written it above, this would be essentially analogous to what matplotlib does with import matplotlib as mpl
mpl.rcParams['lines.linewidth'] = 2
mpl.rcParams['lines.color'] = 'r' If we were using this dictionary framework I think it would be less weird to use upper case arguments, since they're constants anyhow. This would make it simpler since we wouldn't have to come up with new, lower-case names for all of the default params, and folks could cross over from classic GMT more easily. |
Yep, that would be terrible. The way the new matplotlib styling works is that you can set a style globally or use a context manager to temporarily change the style. We can tell whether the context manager is called inside a pygmt.set(PARAMETER=value) # Global
# Locally set a value that will revert back to the default
with pygmt.set(PROJ_ELLIPSOID=value):
...
pygmt.whatever(...) What do you think?
That's a good point. But the
That was never my intension (sorry for not making it clear). We should keep the same parameter names with upper case letters.
If that's the case, then calling |
Okay, thanks for the clarification. I think the code block in your comment above represents an ideal implementation since users have both temp and global options. |
Description of the desired feature
Changing gmt defaults in GMT CLI:
gmt set PAR1=value1 PAR2=value2
gmt plot ... --PAR1=value1 --PAR2=value2
In pygmt, these two should be:
gmt.set(PAR1=value1, PAR2=value2)
gmt.plot(projection="xxx", region="xxx", PAR1=value1, PAR2=value2)
Another way is using dict, e.g.
gmt.conf['PAR1']=value1
, which seems more pythonic. But we need callgmt set
for each assignment. I'm not sure if it's technically possible.The text was updated successfully, but these errors were encountered: