Skip to content

Do not let go a -E<non-DCW code> and -M or -R. It would crash.#7486

Merged
joa-quim merged 2 commits intomasterfrom
fix-noDCW-and-dump
Jun 1, 2023
Merged

Do not let go a -E<non-DCW code> and -M or -R. It would crash.#7486
joa-quim merged 2 commits intomasterfrom
fix-noDCW-and-dump

Conversation

@joa-quim
Copy link
Copy Markdown
Member

@joa-quim joa-quim commented May 31, 2023

Fixes #7484

@joa-quim joa-quim requested review from Esteban82 and PaulWessel May 31, 2023 17:58
@joa-quim
Copy link
Copy Markdown
Member Author

Maybe @Esteban82 could give this a more extensive testing.

Copy link
Copy Markdown
Member

@Esteban82 Esteban82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this message with

gmt pscoast -EEUR+p0.5 -REUR -JD28.213/52.993/40.865633333333335/77.24743333333333/15c -Baf -BWSen -P -K > lixo.ps

coast [ERROR]: Passing other than DCW codes to option -E together with -M or -R options is not possible.

@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 1, 2023

Yes, that one I know it works. I just don't want to block any valid requests too.

@Esteban82
Copy link
Copy Markdown
Member

Great. Should we squash and merge?

@joa-quim joa-quim merged commit 9231878 into master Jun 1, 2023
@joa-quim joa-quim deleted the fix-noDCW-and-dump branch June 1, 2023 21:31
@anbj
Copy link
Copy Markdown
Contributor

anbj commented Jun 5, 2023

This causes custom codes from dcw.conf to fail to plot;

This works:

$ gmt pscoast -Enato -pdf test
-R4.650158/31.138197/57.966579/71.18811

This gives an error. I would expect a plot with all countries in the 'nato' collection to plot as red polygons. And I'm not using -E together with -M or `-R``:

$ gmt pscoast -Enato+gred -pdf test
coast [ERROR]: Passing other than DCW codes to option -E together with -M or -R options is not possible.

@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 5, 2023

But that didn't work before either

j@dell-from-hell:~$ gmt pscoast -Enato+gred -pdf test
coast [WARNING]: No country code matching nato (skipped)
psconvert [ERROR]: Unable to decode BoundingBox file /home/j/.gmt/sessions/gmt_session.10/psconvert_42c.bb (maybe no non-white features were plotted?)

And to help to the party:

WSL

gmt pscoast -Enato -pdf test
-R119.307869/122.000443/21.9018/25.29826

Windows

gmt pscoast -Enato -pdf test
-R-180/180/-90/90

@anbj
Copy link
Copy Markdown
Contributor

anbj commented Jun 5, 2023

I may be confused, but I'm very sure I was able to plot custom codes last(-ish) week.

I ran this command on 2023-05-25 10:41:28, and I'm almost certain it produced a plot.

gmt coast -Enato+gblack -png test -JS0/90/20c -Bafg -R0/360/60/90

@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 5, 2023

Right, I still can do this in WSL that uses an older GMT version

gmt coast -EUN021+gred -RUN021 -png lixo

What we can't do is

gmt pscoast -Enato -pdf test

because that's a modern mode command and in modern mode there is no such a thing as pscoast. No error about this was issued though.

But in summary, my change restricted what can be used and that's not good. So I need another condition that allows me to distinguish the DCW based regions from those that are purely set by a -R. These latter are the ones that we cannot let go into pscoast because they Kaboom it.

@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 5, 2023

BTW, is there any recommended way of creating custom regions? Do we have to edit the dcw-countries.txt file or anything else that is seek too?

@anbj
Copy link
Copy Markdown
Contributor

anbj commented Jun 5, 2023

See coast docs. Create a ~/gmt/dcw.conf and populate it with custom codes, like

# ~/.gmt/dcw.conf
# Arbitrary comments and blank lines anywhere

# The France-Italian union (2042-45) of gallery example 34.
tag: FRIT Franco-Italian Union
list: FR,IT
# Stay away from those dangerous eels!
tag: SARG Sargasso Sea
region: 70W/40W/20N/35N

@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 5, 2023

Thanks. So the drama is: we can't let go (with -R or -M) regions that defined only by a region: but we want to allow those made of lists of codes. How to tell one from the other?

@anbj
Copy link
Copy Markdown
Contributor

anbj commented Jun 5, 2023

Why can't -Eregion be used with -R or -M? I don't understand.

What about a strcmp('list'); then good to go; else no-go? (...)

@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 5, 2023

Why can't -Eregion be used with -R or -M? I don't understand.

That's where this all started. Because in cases where the region is not supported by a code list it crashes GMT, and I don't have the patience nor time to fix it at the very low level.

@anbj
Copy link
Copy Markdown
Contributor

anbj commented Jun 5, 2023

Ok, thanks. So it should work, but it crashes for some reason.

@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 5, 2023

It crashes because regions with no codes have nothing to print/dump but it still tries ... and crash.

@anbj
Copy link
Copy Markdown
Contributor

anbj commented Jun 6, 2023

Got it, thanks.

joa-quim added a commit that referenced this pull request Jun 6, 2023
@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 6, 2023

FYI, I've reverted this change directly on master. So, we are in the potential crash land again.

@anbj
Copy link
Copy Markdown
Contributor

anbj commented Jun 6, 2023

And now my command works again (plotting custom codes).

@PaulWessel
Copy link
Copy Markdown
Member

Not sure what this means:

gmt coast -Enato -pdf test
-R1483228800/1514764800/10000/40000

@joa-quim
Copy link
Copy Markdown
Member Author

joa-quim commented Jun 6, 2023

That's some pscoast joke. You don't have the Andreas custom collection where he's is playing that old game that I forgot the name right now.

@PaulWessel
Copy link
Copy Markdown
Member

Now gone - maybe my gmt.conf had something.

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 this pull request may close these issues.

pscoast -E<valid-code-but-not-DCW> crashes

4 participants