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

Example 5 fails when using GMT 5.4.5 #7

Open
molinav opened this issue Dec 9, 2020 · 1 comment · May be fixed by #8
Open

Example 5 fails when using GMT 5.4.5 #7

molinav opened this issue Dec 9, 2020 · 1 comment · May be fixed by #8

Comments

@molinav
Copy link

molinav commented Dec 9, 2020

This is the traceback:

vic@onyx:/mnt/vic/Documents/Coding/GitHub/python-gmtpy$ python examples/example5.py
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter TIME_LANGUAGE is deprecated. Use GMT_LANGUAGE instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
gmt: Warning: Parameter PAGE_COLOR is deprecated. Use PS_PAGE_COLOR instead.
Please see http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html#new-features-in-gmt-5 for more information.
Traceback (most recent call last):
  File "examples/example5.py", line 95, in <module>
    gmtpy.nice_palette( gmt, palette_widget, guru, cptfile )
  File "/mnt/vic/Documents/Coding/GitHub/python-gmtpy/gmtpy.py", line 4204, in nice_palette
    label_font = gmt.label_font()
  File "/mnt/vic/Documents/Coding/GitHub/python-gmtpy/gmtpy.py", line 3248, in label_font
    return font_tab_rev(self.gmt_config['FONT_LABEL'].split(',')[1])
TypeError: 'dict' object is not callable

Apart from the deprecation warnings which are caused by not having a specific defaults string for this GMT version, the error of this issue appears because font_tab_rev is defined in the library as a dict object but later the library tries to access an item of this dict using parentheses instead of brackets.

@molinav molinav linked a pull request Dec 9, 2020 that will close this issue
@molinav
Copy link
Author

molinav commented Dec 9, 2020

I created a pull request replacing the parentheses with brackets in the problematic code line.

This change is not enough to make example5.py work again with GMT 5.4.5. The reason is that the following line creates a temporary file without .cpt extension for the palette file:

cptfile = gmt.tempfilename()

Later in the example, we find this line:

gmt.makecpt( I=True, C="hot", Z=True, out_filename=cptfile, *guru.T())

and because cptfile does not end with .cpt, the file extension is added internally to out_filename and we get an OSError because the path does not exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant