Skip to content

Gallery plots for each projection #292

Closed

Description

@leouieda

Description of the desired feature

The user documentation contains a gallery of projections available. The plots showcase the projection so it's easy to choose which one you want (by clicking an image instead of having to google the name). We need to fill out this gallery with all projections listed in https://www.generic-mapping-tools.org/gmt/latest/proj_codes_GMT.html

To make a gallery plot, place a script that generates the figure in examples/projections and sphinx-gallery will take care of the rest. The file must have a specific format (see the other examples). Ideally, each projection should show a case in which it's ideal (e.g. not using Mercator for high latitudes).

Any help with this is greatly appreciated! We can build this out slowly, one example at a time.

Activity

  1. added
    good first issue
    documentation
    help wanted
    on Mar 12, 2019
  2. DefUs3r commented on Mar 12, 2019

    @DefUs3r

    Sir,
    I would like to take up this issue. I am a beginner and I have no idea of the codebase and a very slight idea of what this library does. I would like to make my first commit here. Can you help me out?

  3. seisman commented on Mar 15, 2019

    @seisman
    Member

    There is a chapter "GMT Map Projections" in the GMT cookbook. We can copy the examples.

  4. leouieda commented on Mar 15, 2019

    @leouieda
    MemberAuthor

    Thanks, @seisman. I was wondering where that was. I want to try this out here and hopefully copy some of it over to the GMT docs later on.

  5. leouieda commented on Mar 15, 2019

    @leouieda
    MemberAuthor

    👋 Hi @DefUs3r, thanks for offering to help! Please have a look at our Contributing Guide. You will need at least a bit of mapping knowledge, though, since the goal is to write example scripts.

  6. phloose commented on Jul 19, 2019

    @phloose
    Contributor

    I have a background in geoinformatics and i am slightly familiar with projections so i would like to give this a try. The commands used would be ideally the ones from the GMT Map Projections page @seisman mentioned? I also found the grouping of the projection parameters on this page into cylindrical, conic, azimutal, miscellaneus and non-geographic projections very good to make it easier for the user to select what he needs. Maybe a short description, what the primary purpose of a certain projection is, would be helpful too, especially for new, unexperienced users.

    I am already playing around with the examples and if i find it suitable will file a pull request if you don't mind?!

  7. leouieda commented on Jul 27, 2019

    @leouieda
    MemberAuthor

    Hi @xibalba01 we don't mind PRs at all 🙂 I agree that having a small description of when the projection should be used would be very helpful! I like the idea of grouping the examples as well.

  8. phloose commented on Jul 28, 2019

    @phloose
    Contributor

    I have problems building the docs under windows:

    Running make all or make html yields in:

    (pygmt) C:\Users\mo3kLo4r\Documents\Code\OpenSource\pygmt\doc>make all
    ECHO ist ausgeschaltet (OFF).
    "Building API docs."
    ECHO ist ausgeschaltet (OFF).
    sphinx-autogen -i -t _templates -o api/generated api/*.rst
    [autosummary] generating autosummary for: api/*.rst
    [autosummary] writing to api/generated
    Traceback (most recent call last):
      File "C:\Users\mo3kLo4r\Miniconda3\envs\pygmt\Scripts\sphinx-autogen-script.py", line 10, in <module>
        sys.exit(main())
      File "C:\Users\mo3kLo4r\Miniconda3\envs\pygmt\lib\site-packages\sphinx\ext\autosummary\generate.py", line 421, in main
        app=app)
      File "C:\Users\mo3kLo4r\Miniconda3\envs\pygmt\lib\site-packages\sphinx\ext\autosummary\generate.py", line 137, in generate_autosummary_docs
        items = find_autosummary_in_files(sources)
      File "C:\Users\mo3kLo4r\Miniconda3\envs\pygmt\lib\site-packages\sphinx\ext\autosummary\generate.py", line 253, in find_autosummary_in_files
        errors='ignore') as f:
      File "C:\Users\mo3kLo4r\Miniconda3\envs\pygmt\lib\codecs.py", line 898, in open
        file = builtins.open(filename, mode, buffering)
    OSError: [Errno 22] Invalid argument: 'api/*.rst'
    make: *** [api] Fehler 1
    

    A short workaround was to not use api/*.rst and instead use index.rst explicitly from the api/ folder, but then i get another error when trying to build the html pages:

    (pygmt) C:\Users\mo3kLo4r\Documents\Code\OpenSource\pygmt\doc>make html
    ECHO ist ausgeschaltet (OFF).
    "Building API docs."
    ECHO ist ausgeschaltet (OFF).
    sphinx-autogen -i -t _templates -o api/generated api/index.rst
    [autosummary] generating autosummary for: api/index.rst
    [autosummary] writing to api/generated
    ECHO ist ausgeschaltet (OFF).
    "Building HTML files."
    ECHO ist ausgeschaltet (OFF).
    sphinx-build -b html -d _build/doctrees   . _build/html
    Running Sphinx v1.8.5
    loading intersphinx inventory from https://docs.python.org/3/objects.inv...
    loading intersphinx inventory from https://docs.scipy.org/doc/numpy/objects.inv...
    loading intersphinx inventory from http://pandas.pydata.org/pandas-docs/stable/objects.inv...
    intersphinx inventory has moved: http://pandas.pydata.org/pandas-docs/stable/objects.inv -> https://pandas.pydata.org/pandas-docs/stable/objects.inv
    loading intersphinx inventory from http://xarray.pydata.org/en/stable/objects.inv...
    generating gallery...
    Der Befehl "gswin64c" ist entweder falsch geschrieben oder
    konnte nicht gefunden werden.
    WARNING: C:\Users\mo3kLo4r\Documents\Code\OpenSource\pygmt\examples\gallery\coast\borders.py failed to execute correctly: Traceback (most recent call last):
      File "C:\Users\mo3kLo4r\Miniconda3\envs\pygmt\lib\site-packages\sphinx_gallery\gen_rst.py", line 480, in _memory_usage
        out = func()
      File "C:\Users\mo3kLo4r\Miniconda3\envs\pygmt\lib\site-packages\sphinx_gallery\gen_rst.py", line 465, in __call__
        exec(self.code, self.globals)
      File "C:\Users\mo3kLo4r\Documents\Code\OpenSource\pygmt\examples\gallery\coast\borders.py", line 25, in <module>
        fig.show()
      File "c:\users\mo3klo4r\documents\code\opensource\pygmt\pygmt\figure.py", line 272, in show
        fmt="png", dpi=dpi, anti_alias=True, as_bytes=True, transparent=True
      File "c:\users\mo3klo4r\documents\code\opensource\pygmt\pygmt\figure.py", line 342, in _preview
        self.savefig(fname, dpi=dpi, **kwargs)
      File "c:\users\mo3klo4r\documents\code\opensource\pygmt\pygmt\figure.py", line 225, in savefig
        self.psconvert(prefix=prefix, fmt=fmt, crop=crop, **kwargs)
      File "c:\users\mo3klo4r\documents\code\opensource\pygmt\pygmt\helpers\decorators.py", line 187, in new_module
        return module_func(*args, **kwargs)
      File "c:\users\mo3klo4r\documents\code\opensource\pygmt\pygmt\helpers\decorators.py", line 282, in new_module
        return module_func(*args, **kwargs)
      File "c:\users\mo3klo4r\documents\code\opensource\pygmt\pygmt\figure.py", line 165, in psconvert
        lib.call_module("psconvert", build_arg_string(kwargs))
      File "c:\users\mo3klo4r\documents\code\opensource\pygmt\pygmt\clib\session.py", line 490, in call_module
        module, status, self._error_message
    pygmt.exceptions.GMTCLibError: Module 'psconvert' failed with status code 78:
    psconvert [ERROR]: Error opening HKLM key
    psconvert [ERROR]: Failed to parse response to GhostScript version query [n = -1 0 0].
    
    psconvert [ERROR]: Error opening HKLM key
    Der Befehl "gswin64c" ist entweder falsch geschrieben oder
    konnte nicht gefunden werden.
    psconvert [ERROR]: Failed to parse response to GhostScript version query [n = -1 0 0].
    
    Exception occurred:
      File "c:\users\mo3klo4r\documents\code\opensource\pygmt\pygmt\clib\session.py", line 490, in call_module
        module, status, self._error_message
    pygmt.exceptions.GMTCLibError: Module 'psconvert' failed with status code 78:
    psconvert [ERROR]: Error opening HKLM key
    psconvert [ERROR]: Failed to parse response to GhostScript version query [n = -1 0 0].
    The full traceback has been saved in C:\Users\mo3kLo4r\AppData\Local\Temp\sphinx-err-_hpy72rb.log, if you want to report the issue to the developers.
    Please also report this if it was a user error, so that a better error message can be provided next time.
    A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
    make: *** [html] Fehler 2
    

    Somehow psconvert can't find ghostscript even though its installed... Strange, since normal plotting within a jupyter notebook works. In the beginning i didnt had ghostscript installed so no plot worked and i got the same error. Any ideas?

    Under linux building the docs works, although initially i had problems with ghostscript. psconvert produced postscript files with decimal values that used a comma instead of a period. I could fix it by setting LC_NUMERIC to en_US.UTF-8 (i have a german system...)

    EDIT

    Ok obviously if ghostscript on windows is NOT installed via conda pygmt/gmt doesnt find its executable...

  9. phloose commented on Jul 29, 2019

    @phloose
    Contributor

    I split the projections folder into the main groups by creating subfolders with their own README.txt like it is described in the sphinx-gallery-docs. Now it appears like i was thinking it makes the most sense.

    Screenshot von 2019-07-29 13 50 53

    Do you think it would make sense to write a small general introduction for every type of projection?

  10. added this to the 0.1.0 milestone on Oct 4, 2019
  11. removed this from the 0.1.0 milestone on Apr 16, 2020
  12. added
    scipy-sprint
    on Jul 6, 2020
  13. willschlitzer commented on Dec 8, 2020

    @willschlitzer
    Contributor

    I'll work on this.

  14. willschlitzer commented on Dec 9, 2020

    @willschlitzer
    Contributor

    Should the different projections have a particular and standardized color scheme? The GMT docs don't seem to follow any standard color scheme, but all of the PyGMT projection examples have gray land and white water.

  15. seisman commented on Dec 9, 2020

    @seisman
    Member

    I don't think we have any standardized color scheme here. I actually prefer the maps in the GMT docs.

  16. willschlitzer commented on Dec 9, 2020

    @willschlitzer
    Contributor

    I prefer them as well. My thought is to copy the GMT example projection maps when able, as I think they are all good maps and there's no need to reinvent the wheel. I just want to make sure there isn't a plan in place already for standardized example projection maps.

  17. willschlitzer commented on Dec 10, 2020

    @willschlitzer
    Contributor

    I think it would be a good idea to have the home page of the projection gallery have some sort of table that lists the different projection codes. Even when the gallery is fleshed out, it won't be immediately clear to someone looking at PyGMT code what the given projection is, and this will keep them from having to click on all of the gallery examples to find out. I looked through the PyGMT docs to see if there are any examples of a table but couldn't find one; any ideas on how to implement this?

  18. willschlitzer commented on Dec 16, 2020

    @willschlitzer
    Contributor

    Are we missing any examples for gallery plots?

  19. seisman commented on Dec 17, 2020

    @seisman
    Member

    @willschlitzer Thanks again for your recent contributions! I think this issue is close to finishing.

    I think it would be better to also add logarithmic projection and power projection.

  20. seisman commented on Dec 17, 2020

    @seisman
    Member

    I think it would be a good idea to have the home page of the projection gallery have some sort of table that lists the different projection codes. Even when the gallery is fleshed out, it won't be immediately clear to someone looking at PyGMT code what the given projection is, and this will keep them from having to click on all of the gallery examples to find out. I looked through the PyGMT docs to see if there are any examples of a table but couldn't find one; any ideas on how to implement this?

    @willschlitzer Sounds a good idea. Could you open a new issue for this so that we can better discuss it?

  21. phloose commented on Dec 17, 2020

    @phloose
    Contributor

    Before you close this issue i would like to add that it would be nice to have some explanatory text about each projection like in the GMT cookbook . I proposed and started this with #318 and would think that this is very useful for people new to GMT and mapping, because projections are not easy to grasp for everyone.

  22. willschlitzer commented on Dec 18, 2020

    @willschlitzer
    Contributor

    Would we be able to copy the text directly from the GMT cookbook on the reasoning behind using different projections? I don't want to plagiarize, but I would also hope to avoid reinventing the wheel if possible.

  23. seisman commented on Dec 18, 2020

    @seisman
    Member

    I don't want to plagiarize, but I would also hope to avoid reinventing the wheel if possible.

    PyGMT and GMT belong to the same organization, so don't worry about plagiarization. We can just copy and paste from the cookbook, and even improve it if someone has more knowledge more about projections.

    Again, it would be good if @willschlitzer can open a new issue for your comment #292 (comment), and @phloose for your comment #292 (comment), as I don't want to make the discussions too long in this issue.

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

    documentationgood first issuehelp wantedscipy-sprint

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions