-
Notifications
You must be signed in to change notification settings - Fork 343
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
Bug with grdtrack and -Ejustification and -C?? #8194
Comments
Yes. I will try to debug @Esteban82 example - it is annoying but I spent a lot of time on the grid version already... |
This is what I have learned. grdtrack -E creates the profiles, then the cross track machinery computes the angle of the cross profiles to be 180. Then we can sincosd (angle, &s, &c) and get cos = -1 (good) and sin = -1.2246467991473532E-16 (oops). Then, coordinates are computed and instead of getting y = 1 we get 0.99999999999999988 and then it is determined by BCR that the point is outside the grid and we get the default NaN answer. I think for some reason sincosd fails since it actually calls sincos (angle*D2R) and hence roundoff is likely. So where do we intercept? Make the macro check for angle being exact multiple of 90 and set those returns manually? This is in many places... Suggestions - gotta take a break. |
Can the BCR be made a bit more tolerant on what is outside? If “sufficiently close accept it”?
Go make the break(s). If necessary, this can stay as a bug (again, our release process is so heavy that it prevents more often releases. I would drop most of the steps in the check list). Only really important bug to fix is that padding effect that makes grdimage crash.
From: Paul Wessel ***@***.***>
Sent: Sunday, December 17, 2023 5:46 PM
To: GenericMappingTools/gmt ***@***.***>
Cc: Joaquim Manuel Freire Luís ***@***.***>; Comment ***@***.***>
Subject: Re: [GenericMappingTools/gmt] Bug with grdtrack and -Ejustification and -C?? (Issue #8194)
This is what I have learned. grdtrack -E creates the profiles, then the cross track machinery computes the angle of the cross profiles to be 180. Then we can sincosd (angle, &s, &c) and get cos = -1 (good) and sin = -1.2246467991473532E-16 (oops). Then, coordinates are computed and instead of getting y = 1 we get 0.99999999999999988 and then it is determined by BCR that the point is outside the grid and we get the default NaN answer.
I think for some reason sincosd fails since it actually calls sincos (angle*D2R) and hence roundoff is likely. So where do we intercept? Make the macro check for angle being exact multiple of 90 and set those returns manually? This is in many places... Suggestions - gotta take a break.
—
Reply to this email directly, view it on GitHub<#8194 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAEDF2N2HO4T2LOUO55KXQ3YJ4VU3AVCNFSM6AAAAABAWXO2GOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGIZTIMZSHE>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
Ah, and I have another dinner tonight.
From: Paul Wessel ***@***.***>
Sent: Sunday, December 17, 2023 5:46 PM
To: GenericMappingTools/gmt ***@***.***>
Cc: Joaquim Manuel Freire Luís ***@***.***>; Comment ***@***.***>
Subject: Re: [GenericMappingTools/gmt] Bug with grdtrack and -Ejustification and -C?? (Issue #8194)
This is what I have learned. grdtrack -E creates the profiles, then the cross track machinery computes the angle of the cross profiles to be 180. Then we can sincosd (angle, &s, &c) and get cos = -1 (good) and sin = -1.2246467991473532E-16 (oops). Then, coordinates are computed and instead of getting y = 1 we get 0.99999999999999988 and then it is determined by BCR that the point is outside the grid and we get the default NaN answer.
I think for some reason sincosd fails since it actually calls sincos (angle*D2R) and hence roundoff is likely. So where do we intercept? Make the macro check for angle being exact multiple of 90 and set those returns manually? This is in many places... Suggestions - gotta take a break.
—
Reply to this email directly, view it on GitHub<#8194 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAEDF2N2HO4T2LOUO55KXQ3YJ4VU3AVCNFSM6AAAAABAWXO2GOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGIZTIMZSHE>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
Lamely, this fixes the issue
|
WHile sincos/sincosd are used in places where speed matters map projections) we also use it in places where time is not relevant but accuracy is, such as the silliness of #8194. This PR introduces local function sincosdegree in gmt_support that makes sure if we are within 10^-4 degrees of a multiple of 90 that we return sin and cosine exactly 0 or ±1. Closes #8194.
WHile sincos/sincosd are used in places where speed matters map projections) we also use it in places where time is not relevant but accuracy is, such as the silliness of #8194. This PR introduces local function sincosdegree in gmt_support that makes sure if we are within 10^-4 degrees of a multiple of 90 that we return sin and cosine exactly 0 or ±1. Closes #8194.
I strangely got some NaN with the third command where I only revert the sense of the main profile (-E)
Output:
The text was updated successfully, but these errors were encountered: