Skip to content

Pass a sequence that contains bool and string to a parameter #3981

Closed

Description

@Esteban82

Description of the problem

This does not work
fig.basemap(frame=[True, "+tThe Caribbean Sea"])

From the forum: link

Minimal Complete Verifiable Example

import pygmt
fig = pygmt.Figure()
fig.coast(region="IHO27",projection="M15c",water="lightblue")
fig.basemap(frame=[True, "+tThe Caribbean Sea"])
fig.savefig("1_FirstMap.png")

Full error message

basemap [ERROR]: Bad interval in -B option (x-component, a-info): True gave interval = 0
basemap [ERROR]: Bad interval in -B option (y-component, a-info): True gave interval = 0
basemap [ERROR]: Option -B parsing failure. Correct syntax:

-B Specify both (1) basemap frame settings and (2) axes parameters.
Frame settings are modified via an optional single invocation of -B[<axes>][+b][+g<fill>][+i[<val>]][+n][+o<lon>/<lat>][+s<subtitle>][+t<title>][+w[<pen>]][+x<fill>]⏎
       …[+y<fill>][+z<fill>]
Axes parameters are specified via one or more invocations of -B[p|s][x|y|z]<intervals>[+a<angle>|n|p][+e[l|u]][+f][+l|L<label>][+p<prefix>][+s|S<secondary_label>]⏎
       …[+u<unit>
<intervals> is composed of concatenated [<type>]<stride>[l|p] sub-strings. See basemap documentation for more details and examples of all settings.
basemap [ERROR]: Offending option -BTrue
Traceback (most recent call last):
  File "/home/esteban82/Github/Esteban82/Privado/4_EarthScope_GMT-ShortCourse/1_Modules/6_GMT_Advance/1_Scripts/3_PyGMT/1_FirstMap.py", line 32, in <module>
    fig.basemap(frame=[True, "+tThe Caribbean Sea"])
  File "/home/esteban82/miniforge3/lib/python3.10/site-packages/pygmt/helpers/decorators.py", line 609, in new_module
    return module_func(*args, **kwargs)
  File "/home/esteban82/miniforge3/lib/python3.10/site-packages/pygmt/helpers/decorators.py", line 773, in new_module
    return module_func(*bound.args, **bound.kwargs)
  File "/home/esteban82/miniforge3/lib/python3.10/site-packages/pygmt/src/basemap.py", line 87, in basemap
    lib.call_module(module="basemap", args=build_arg_list(kwargs))
  File "/home/esteban82/miniforge3/lib/python3.10/site-packages/pygmt/clib/session.py", line 656, in call_module
    raise GMTCLibError(
pygmt.exceptions.GMTCLibError: Module 'basemap' failed with status code 72:
basemap [ERROR]: Bad interval in -B option (x-component, a-info): True gave interval = 0
basemap [ERROR]: Bad interval in -B option (y-component, a-info): True gave interval = 0
basemap [ERROR]: Option -B parsing failure. Correct syntax:
basemap [ERROR]: Offending option -BTrue

System information

PyGMT information:
  version: v0.15.0
System information:
  python: 3.11.13 | packaged by conda-forge | (main, Jun  4 2025, 14:48:23) [GCC 13.3.0]
  executable: /opt/conda/envs/iris/bin/python
  machine: Linux-5.10.237-230.949.amzn2.x86_64-x86_64-with-glibc2.35
Dependency information:
  numpy: 2.3.0
  pandas: 2.2.3
  xarray: 2025.4.0
  netCDF4: 1.7.2
  packaging: 23.2
  contextily: None
  geopandas: 1.1.0
  IPython: 8.21.0
  pyarrow: None
  rioxarray: None
  gdal: None
  ghostscript: 9.55.0
GMT library information:
  version: 6.5.0
  padding: 2
  share dir: /opt/conda/envs/iris/share/gmt
  plugin dir: /opt/conda/envs/iris/lib/gmt/plugins
  library path: /opt/conda/envs/iris/lib/libgmt.so
  cores: 4
  grid layout: rows
  image layout: 
  binary version: 6.5.0

Activity

  1. added
    bug
    on Jun 18, 2025
  2. added this to the 0.17.0 milestone on Jun 19, 2025
  3. changed the title [-]Combine bool and string in a list[/-] [+]Pass a sequence that contains bool and string to an argument[/+] on Jun 24, 2025
  4. changed the title [-]Pass a sequence that contains bool and string to an argument[/-] [+]Pass a sequence that contains bool and string to a parameter[/+] on Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions