Disallow passing arguments like -XNone to GMT
Arguments like -XNone are invalid for GMT.
This PR updates the function build_arg_string and checks if any value is None.
If yes, remove the argument.
@@ -127,7 +127,11 @@ def build_arg_string(kwargs):
Examples
--------
- >>> print(build_arg_string(dict(R="1/2/3/4", J="X4i", P="", E=200)))
+ >>> print(
+ ... build_arg_string(
+ ... dict(R="1/2/3/4", J="X4i", P="", E=200, X=None, Y=None)
+ ... )
+ ... )
-E200 -JX4i -P -R1/2/3/4
>>> print(
... build_arg_string(
@@ -147,6 +151,8 @@ def build_arg_string(kwargs):
if is_nonstr_iter(kwargs[key]):
for value in kwargs[key]:
sorted_args.append("-{}{}".format(key, value))
+ elif kwargs[key] is None: # arguments like -XNone are invalid
+ continue
else:
sorted_args.append("-{}{}".format(key, kwargs[key]))
