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

First-record scanning let trailing text be parsed as number #2613

Merged
merged 3 commits into from
Feb 1, 2020

Conversation

PaulWessel
Copy link
Member

The gmtio_examine_current_record failed to distinguish text from numbers.
In an example, the data record

0 2 -JX8cd/8c

ended up giving the (harmless but annoying) warning

-JX8c/8 not a valid number and may not be decoded properly

because gmt_scanf_arg was fooled. This tightens the check.

IN our example, the data record
0 2 -JX8cd/8c
ended up giving the harmless warning
-JX8c/8 not a valid number and may not be decoded properly
because gmt_scanf_arg was fooled.  This tightens the check.
@joa-quim joa-quim merged commit d698a2c into master Feb 1, 2020
@joa-quim joa-quim deleted the saferjunkcheck branch February 1, 2020 18:38
@joa-quim
Copy link
Member

joa-quim commented Feb 1, 2020

I'm still getting a

psrose [WARNING]: 12c/8 not a valid number and may not be decoded properly.

@PaulWessel
Copy link
Member Author

Ok, which test?

@joa-quim
Copy link
Member

joa-quim commented Feb 1, 2020

It's a Julia one.

julia> data=[20 5.4 5.4 2.4 1.2; 40 2.2 2.2 0.8 0.7; 60 1.4 1.4 0.7 0.7; 80 1.1 1.1 0.6 0.6; 100 1.2 1.2 0.7 0.7; 120 2.6 2.2 1.2 0.7; 140 8.9 7.6 4.5 0.9; 160 10.6 9.3 5.4 1.1; 180 8.2 6.2 4.2 1.1; 200 4.9 4.1 2.5 1.5; 220 4 3.7 2.2 1.5; 240 3 3 1.7 1.5; 260 2.2 2.2 1.3 1.2; 280 2.1 2.1 1.4 1.3;; 300 2.5 2.5 1.4 1.2; 320 5.5 5.3 2.5 1.2; 340 17.3 15 8.8 1.4; 360 25 14.2 7.5 1.3];

julia> rose(data, yx=[], A=20, R="0/25/0/360", B="xa10g10 ya10g10 +t\"Sector Diagram\"", W=1, G="orange", F=1, D=1, S=4, Vd=1)
        psrose  -R0/25/0/360 -JX12c/8c -Bxa10g10 -Bya10g10 -B+t"Sector -BDiagram" -: -A20 -D1 -F1 -S4 -Gorange -W1 -P -K > C:\TMP\GMTjl_tmp.ps
psrose [WARNING]: 12c/8 not a valid number and may not be decoded properly.

BTW, this should be a INFO too, no?

julia> G = surface(rand(100,3) * 150, R="0/150/0/150", I=1, Ll=-100, upper=100);
surface [WARNING]: Your upper value is < than max data value.

@joa-quim
Copy link
Member

joa-quim commented Feb 1, 2020

and this

julia> gmtsimplify([0.0 0; 1.1 1.1; 2 2.2; 3.3 3], T="3k", Vd=1);
        gmtsimplify  -T3k
gmtsimplify [WARNING]: gmtsimplify only implemented using Flat-Earth calculations.

@PaulWessel
Copy link
Member Author

OK, please fix - going on hike.

@PaulWessel
Copy link
Member Author

Odd to give differernt height and width for a square (circle) plot. I will look. psrose was the last module to actually tolerate -J. It had its own -Sradius forever. I probably am taking some short-cut and did not anticipate your crazy -J argument.

@joa-quim
Copy link
Member

joa-quim commented Feb 2, 2020

That's automatic generated code. Must add a check to make it square by default for roses.

@PaulWessel
Copy link
Member Author

OK, now that argument will cause an error on the psrose side (same for psternary)

@joa-quim
Copy link
Member

joa-quim commented Feb 2, 2020

Why forbid? If user want to deform just let him do that. And what if a subplot with rectangular subplots want to plot a rose? A warning is fine here, but erroring is is extreme.

@joa-quim
Copy link
Member

joa-quim commented Feb 2, 2020

Even if I use -JX12c/0, the complain is the same

julia> rose(data, yx=[], A=20, R="0/25/0/360", B="xa10g10 ya10g10 +t\"Sector Diagram\"", W=1, G="orange", F=1, D=1, S=4, Vd=1, show=1)
        psrose  -R0/25/0/360 -JX12c/0 -Bxa10g10 -Bya10g10 -B+t"Sector -BDiagram" -: -A20 -D1 -F1 -S4 -Gorange -W1 -P -K > C:\TMP\GMTjl_tmp.ps
psrose [WARNING]: 12c/0 not a valid number and may not be decoded properly.

@PaulWessel
Copy link
Member Author

Please update.

@joa-quim
Copy link
Member

joa-quim commented Feb 2, 2020 via email

@PaulWessel
Copy link
Member Author

Even if we allowed -JXa/b we are drawing the rose per polar coordinates using a radial scale. It makes absolutely no sense to give -JXa/b to prose and psternary. As for subplots, we are supposed to give a -JX? or -Jx? as the projection. Not sure if we have a test for this with rose and ternaries so that would be a good test.

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.

None yet

2 participants