Skip to content

Wrapper for pstext #122

Closed
Closed

Description

@ziyixi

Hello, I have noticed there is no support for the common used command pstext. I have tried hours for supporting the command in my own machine. However, there seems to be some problems handling input like:

when I want to realize:

gmt pstext -J -R -F+f12p,1,black+jTL -D-1.5c/-0.15c -K -O >> $PS << EOF
-77.15 38.89 Washington
76.22 -69.22 Zhongshanzhan
EOF

a common choice in the python module is:

gmt.pstext(<some parameters>)

so how to input?

<< EOF
-77.15 38.89 Washington
76.22 -69.22 Zhongshanzhan
EOF

First I have tried use the virtual file you have used. However, it seems the virtual file only supports numbers but not strings like "Washington"..
Then, since we couldn't use the virtual database supported by GMT, then the only choice might be the python own virtual file, but it seems difficult to combine it with the console of libgmt....
Then we might need create a file in some place like /tmp or some place else to create a real file? or some realization similar to the GMT database..
I think this feather is really important and what's your advise?

Activity

  1. ziyixi commented on Jan 17, 2018

    @ziyixi
    Author

    I think supporting some feathers like:

        @fmt_docstring
        @use_alias()
        @kwargs_to_strings(R='sequence')
        def rawcommand(self, module=None, command=None):
            """
            """
            # kwargs = self._preprocess(**kwargs)
            with LibGMT() as lib:
                lib.call_module(module,command)
    

    in the module BasePlotting may be a good choice at the moment..... :) to console a command in the form like:

    fig.rawcommand(module='pstext',command='-F+f12p,1,black+jTL -D-1c/-0.15c temp/temp.txt')
    

    Here temp.txt is the input file I created.

  2. leouieda commented on Jan 17, 2018

    @leouieda
    Member

    @ziyixi there were some changes made to the internal data structures of GMT lately regarding text input. I still need to do some work on the undelying virtual file machinery to make this work but that is the way forward. This will have to wait a bit but it should be ready in the next couple of months. Then it would be possible to wrap text (there is no ps anymore in GMT modern mode).

    We decided not to add the raw GMT command-line option because it doesn't integrate well with Python and an be replaced by a subprocess call. We also try to avoid using temp files as much as possible and pass things in memory between GMT and Python.

    Thanks for the input! We'll keep you posted when the virtual file parts are ready for pstext.

  3. changed the title [-]Support for pstext[/-] [+]Wrapper for pstext[/+] on Apr 24, 2018
  4. added a commit that references this issue on Aug 20, 2019
  5. weiji14 commented on Oct 31, 2019

    @weiji14
    Member

    Hi @ziyixi, text is now implemented in PyGMT, you'll need to install it from Github and should be good to go. Let us know if you need any help :)

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

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions