Skip to content

File name input in meca does not accept top comments #2613

@SeismoFelix

Description

@SeismoFelix

Description of the problem

Probably this is a minor thing, so sorry for the inconvenience and I hope it was useful for someone like me that is trying to migrate from pure GMT to PyGMT.

I installed PyGMT on Mar 25, 2022. However, I needed to use the meca feature including the option cmap and I realized that this is a recent improvement . Unfortunately, the same code that used to work with the old PyGMT version is not working with the new version unless I remove the top comment from the input file given in spec (using convention = "mt").

Text input file used to be and work:

Moment tensor list
#1: 2023_07_05_07_46
-22.19872 63.9277 6 -1.841e+22 1.235e+22 6.058e+21 -1.914e+22 1.27e+22 3.9e+22 1 0 0
#2: 2023_07_05_08_20
-22.19574 63.93407 6 -1.489e+22 2.587e+22 -1.098e+22 -2.85e+22 1.706e+22 4.669e+22 1 0 0
#3: 2023_07_05_09_49
-22.1753 63.93252 6 -6.451e+21 5.499e+21 9.525e+20 -6.693e+21 3.644e+21 1.318e+22 1 0 0

**The new PyGMT imposes removing the top comments or adding a "#" in front of the comment:

#1: 2023_07_05_07_46
-22.19872 63.9277 6 -1.841e+22 1.235e+22 6.058e+21 -1.914e+22 1.27e+22 3.9e+22 1 0 0
#2: 2023_07_05_08_20
-22.19574 63.93407 6 -1.489e+22 2.587e+22 -1.098e+22 -2.85e+22 1.706e+22 4.669e+22 1 0 0
#3: 2023_07_05_09_49
-22.1753 63.93252 6 -6.451e+21 5.499e+21 9.525e+20 -6.693e+21 3.644e+21 1.318e+22 1 0 0

Although the message is a warning the focal mechanisms are not plotted.

Minimal Complete Verifiable Example

fig.meca(
    spec='TXT/MT_sorted_by_time_colortime_version.txt',
    scale='0.5c',
    convention="mt",
    #cmap=True
)

Full error message

meca [WARNING]: No data records provided

System information

New:
PyGMT information:
  version: v0.9.0
System information:
  python: 3.8.17 | packaged by conda-forge | (default, Jun 16 2023, 07:11:34)  [Clang 14.0.6 ]
  executable: /Users/felix/opt/anaconda3/envs/mtuq_j/bin/python
  machine: macOS-10.16-x86_64-i386-64bit
Dependency information:
  numpy: 1.24.4
  pandas: 2.0.3
  xarray: 2022.11.0
  netCDF4: 1.6.4
  packaging: 23.1
  contextily: None
  geopandas: None

  ghostscript: 9.54.0
GMT library information:
  binary version: 6.4.0
  cores: 16
  grid layout: rows
  image layout: 
  library path: /Users/felix/opt/anaconda3/envs/mtuq_j/lib/libgmt.dylib
  padding: 2
  plugin dir: /Users/felix/opt/anaconda3/envs/mtuq_j/lib/gmt/plugins
  share dir: /Users/felix/opt/anaconda3/envs/mtuq_j/share/gmt
  version: 6.4.0

Old:
PyGMT information:
  version: v0.7.0
System information:
  python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:47)  [Clang 12.0.1 ]
  executable: /Users/felix/opt/anaconda3/envs/mtuq/bin/python
  machine: macOS-10.16-x86_64-i386-64bit
Dependency information:
  numpy: 1.23.1
  pandas: 1.4.3
  xarray: 2022.3.0
  netCDF4: 1.6.0
  packaging: 21.3
  geopandas: None
  ghostscript: 9.54.0
  gmt: 6.4.0
GMT library information:
  binary dir: /Users/felix/opt/anaconda3/envs/mtuq/bin
  cores: 16
  grid layout: rows
  library path: /Users/felix/opt/anaconda3/envs/mtuq/lib/libgmt.dylib
  padding: 2
  plugin dir: /Users/felix/opt/anaconda3/envs/mtuq/lib/gmt/plugins
  share dir: /Users/felix/opt/anaconda3/envs/mtuq/share/gmt
  version: 6.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions