-
Notifications
You must be signed in to change notification settings - Fork 224
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
Allow passing arguments containing spaces into pygmt functions #1487
Changes from all commits
b5ad405
14648c2
924f439
707745f
03e4308
095449a
d81b80b
dd849cb
c29e632
83c8c3b
2ba8420
b58af8b
3ec7727
f19c41b
7a518a1
9774d5e
ff40d27
36fdec5
6c399ba
4770396
801ba01
ecb580e
a526d45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ def __init__(self, **kwargs): | |
self.old_defaults[key] = lib.get_default(key) | ||
|
||
# call gmt set to change GMT defaults | ||
arg_str = " ".join([f"{key}={value}" for key, value in kwargs.items()]) | ||
arg_str = " ".join([f'{key}="{value}"' for key, value in kwargs.items()]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I've fixed the |
||
with Session() as lib: | ||
lib.call_module("set", arg_str) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
outs: | ||
- md5: e6984efed2a94673754cc7f1f1d74832 | ||
size: 9069 | ||
path: test_basemap_utm_projection.png |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
outs: | ||
- md5: 3619720cdfcd857cbdbb49ed7fe6e930 | ||
size: 1392 | ||
path: test_config_format_date_map.png |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
outs: | ||
- md5: 8e1c47b1cf6001dad3b3c0875af4562e | ||
size: 150390 | ||
- md5: ce2d5cd1415b7c7bbeea5bf6ff39c480 | ||
size: 150288 | ||
path: test_rose_no_sectors.png |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,7 @@ def test_rose_no_sectors(data_fractures_compilation): | |
region=[0, 500, 0, 360], | ||
diameter="10c", | ||
labels="180/0/90/270", | ||
frame=["xg100", "yg45", "+t'Windrose diagram'"], | ||
frame=["xg100", "yg45", "+tWindrose diagram"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it does still work, but the single quotes would be printed. I think it was a typo from whoever wrote that test. |
||
pen="1.5p,red3", | ||
transparency=40, | ||
scale=0.5, | ||
|
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.
I know almost nothing about PROJ4, but does a PROJ4 string always contains
+proj=xxx
orEPSG
? If yes, then we can simplify the if-test to something like:The motivation is, since PROJ4 is not commonly used, it seems a waste of time to do call the
replace
method for GMT-style -J.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.
Not sure if all PROJ-strings have either
+proj=xxx
orEPSG
(see https://proj.org/operations/projections/index.html), but they probably do? I know that there's+init=EPSG:xxx
which kinda works when I tried here, but that's actually deprecated syntax (see https://pyproj4.github.io/pyproj/stable/gotchas.html#init-auth-auth-code-should-be-replaced-with-auth-auth-code) and probably not something we want to allow.Also unsure if 2 extra if-checks saves time, considering that either way, a
str.replace
still needs to happen for the space character - either to\040
or to nothing ``.