Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gallery plots for each projection #292

Closed
leouieda opened this issue Mar 12, 2019 · 19 comments
Closed

Gallery plots for each projection #292

leouieda opened this issue Mar 12, 2019 · 19 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Helping hands are appreciated scipy-sprint Things to work on during the SciPy sprint!

Comments

@leouieda
Copy link
Member

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.

@leouieda leouieda added good first issue Good for newcomers documentation Improvements or additions to documentation help wanted Helping hands are appreciated labels Mar 12, 2019
@DefUs3r
Copy link

DefUs3r commented Mar 12, 2019

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?

@seisman
Copy link
Member

seisman commented Mar 15, 2019

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

@leouieda
Copy link
Member Author

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.

@leouieda
Copy link
Member Author

leouieda commented Mar 15, 2019

👋 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.

@phloose
Copy link
Contributor

phloose commented Jul 19, 2019

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?!

@leouieda
Copy link
Member Author

leouieda commented Jul 27, 2019

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.

@phloose
Copy link
Contributor

phloose commented Jul 28, 2019

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...

@phloose
Copy link
Contributor

phloose commented Jul 29, 2019

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?

@weiji14 weiji14 added this to the 0.1.0 milestone Oct 4, 2019
@weiji14 weiji14 removed this from the 0.1.0 milestone Apr 16, 2020
@liamtoney liamtoney added the scipy-sprint Things to work on during the SciPy sprint! label Jul 6, 2020
@willschlitzer
Copy link
Contributor

I'll work on this.

@willschlitzer
Copy link
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.

@seisman
Copy link
Member

seisman commented Dec 9, 2020

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

@willschlitzer
Copy link
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.

@willschlitzer
Copy link
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?

@willschlitzer
Copy link
Contributor

Are we missing any examples for gallery plots?

@seisman
Copy link
Member

seisman commented Dec 17, 2020

@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.

@seisman
Copy link
Member

seisman commented Dec 17, 2020

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?

@phloose
Copy link
Contributor

phloose commented Dec 17, 2020

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.

@willschlitzer
Copy link
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.

@seisman
Copy link
Member

seisman commented Dec 18, 2020

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
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Helping hands are appreciated scipy-sprint Things to work on during the SciPy sprint!
Projects
None yet
Development

No branches or pull requests

7 participants