Plot swath profile using pygmt

Dear all,

It seems grdtrack is implemented in pygmt but I can not keys similar https://docs.generic-mapping-tools.org/latest/grdtrack.html

Is it possible to plot this example in pygmt

Best regards,
Mohammad

Yes it should be possible. The -G in grdtrack has been aliased to grid in PyGMT, though it’s not appearing in the docs. For example, the GMT command like:

gmt grdtrack ridge.txt -Gspac_33.nc -C400k/2k/10k+v -Sm+sstack.txt > table.txt

would look like this in PyGMT:

pygmt.grdtrack(points="ridge.txt", grid="spac_33.nc", crossprofile="400k/2k/10k+v", stack="m+sstack.txt", outfile="table.txt")

See also code at https://github.com/GenericMappingTools/pygmt/blob/v0.7.0/pygmt/src/grdtrack.py#L329 where this is being handled.

1 Like