Errors in pygmt when there are spaces in string arguments

Oh, that’s another good workaround for the labels!

But the pygmt.config / gmtset interface for setting the date format does not fall for this, unfortunately. I then get the message:

GMTCLibError: Module 'set' failed with status code 72:
gmtset [ERROR]: Unacceptable date template o\040dd
gmtset [ERROR]: FORMAT_DATE_MAP given illegal value (o\040dd)!
gmtset [ERROR]:  1 GMT Defaults conversion errors from command options

I just tinkered some more, and the combining-two-types-of-quotes workaround does work for that, as long as the single quotes are on the outside and the double ones on the inside.

import pygmt
fig = pygmt.Figure()
pygmt.config(GMT_THEME="cookbook")
pygmt.config(FORMAT_DATE_MAP='"o dd"', FORMAT_CLOCK_MAP="hh:mm", FONT_ANNOT_PRIMARY="+9p")
fig.basemap(region="1969-7-21T/1969-7-23T/0/1", projection="X12c/0.5c", frame=["pxa6Hf1h", "sxa1K", "S"])
fig.basemap(frame=["pxa6Hf1h", "sxa1D", "S"], yshift="1.6c")
fig.show()

Happy to have found this solution, but it is pretty inelegant and unintuitive.

The FORMAT_DATE_MAP interpreter is pretty unforgiving. It allows “o dd yyyy” to get “July 21 1969”, but it does not accept “o dd, yyyy” to get “July 21, 1969”, with the added comma. But I guess that’s a GMT library problem, and not a pygmt problem.