GenericMappingTools / gmtserver-admin

Cache data and script for managing the GMT data server
GNU Lesser General Public License v3.0
7 stars 3 forks source link

Replace decimal comma by points information files #192

Closed Esteban82 closed 1 year ago

Esteban82 commented 1 year ago

The faa and vgg files have commas as decimal separator. I replaced them by points.

It was generated when I run the make server-info on my pc.

I think that the solution is to temporarily set LANG=C in srv_tiler.sh, right? Not completly sure. See #163 for more details.

Esteban82 commented 1 year ago

BTW, I noticed that some earth_*_server.txt (like earth_age_server.txt) are not sorted by resolution and registration as earth_relief_server.txt. It is ok if I sort them, right?

WalterHFSmith commented 1 year ago

I don’t know the answer. But I remember that when we were first working to make GMT POSIX compliant and portable internationally we looked at what controls whether a point or a comma is used to mark the separation between integer and decimal fraction. If I recall, one way of controlling this was through LOCALE. But I don’t know if setting LANG=C also sets LOCALE, or which one takes precedence if both are set. Maybe if you have figured this out you can let me know so I will learn. Thanks for all you are doing for GMT.

Walter

On Mar 27, 2023, at 9:48 PM, Federico Esteban @.***> wrote:

The faa and vgg files have commas as decimal separator. I replaced them by points.

It was generated when I run the make server-info on my pc.

I think that the solution is to temporarily set LANG=C in srv_tiler.sh, right? Not completly sure. See #163 https://github.com/GenericMappingTools/gmtserver-admin/issues/163 for more details.

You can view, comment on, or merge this pull request online at:

https://github.com/GenericMappingTools/gmtserver-admin/pull/192 https://github.com/GenericMappingTools/gmtserver-admin/pull/192 Commit Summary

23344cf https://github.com/GenericMappingTools/gmtserver-admin/pull/192/commits/23344cf0b51131436b87a6579abf93bccb845547 Replace decimal comma by points File Changes (2 files https://github.com/GenericMappingTools/gmtserver-admin/pull/192/files) M information/earth_faa_server.txt https://github.com/GenericMappingTools/gmtserver-admin/pull/192/files#diff-c2480f0a390c53aab99036a909c0c6977a001de7112570295c00db4860f7bd5f (12) M information/earth_vgg_server.txt https://github.com/GenericMappingTools/gmtserver-admin/pull/192/files#diff-8b92811294e32f5bd6921d126ea26b1340d226a4fbd27969e8d2cc84e68b15f6 (12) Patch Links:

https://github.com/GenericMappingTools/gmtserver-admin/pull/192.patch https://github.com/GenericMappingTools/gmtserver-admin/pull/192.patch https://github.com/GenericMappingTools/gmtserver-admin/pull/192.diff https://github.com/GenericMappingTools/gmtserver-admin/pull/192.diff — Reply to this email directly, view it on GitHub https://github.com/GenericMappingTools/gmtserver-admin/pull/192, or unsubscribe https://github.com/notifications/unsubscribe-auth/APUT6GLZDRGPBT2VRSBA7SDW6I7NJANCNFSM6AAAAAAWJ4WQGQ. You are receiving this because your review was requested.

Esteban82 commented 1 year ago

Hi Walter

As far as I know, LOCALE (alone) is just to display the settings. Also, I learned that instead of LANG, I could use LC_NUMERIC to only "change the rules and symbols for formatting non-monetary numeric information".

From my tests, I see that I could use LC_NUMERIC=C to change the settings only in that line. After that it goes back to the original configuration.

# Commands
locale | grep LC_NUMERIC
LC_NUMERIC=C printf '%g\n' 1e-2
printf '%g\n' 1e-2

# Output
LC_NUMERIC="es_AR.UTF-8"
0.01
0,01

To change the configuration for the whole script I have to use export LC_NUMERIC=C

# Commands
locale | grep LC_NUMERIC
export LC_NUMERIC=C
printf '%g\n' 1e-2

# Output
C
0.01

If a then I run the script again but without export LC_NUMERIC=C I got my original configuration.

Conclusion

We should add export LC_NUMERIC=C in the scripts that deal with formatting numbers.

Federico

WalterHFSmith commented 1 year ago

Dear Federico,

Thanks for these tests and the clear explanation and recommendation.

W

On Mar 30, 2023, at 9:51 AM, Federico Esteban @.***> wrote:

Hi Walter

As far as I know, LOCALE (alone) is just to display the settings. Also, I learned that instead of LANG, I could use LC_NUMERIC to only "change the rules and symbols for formatting non-monetary numeric information".

From my tests, I see that I could use LC_NUMERIC=C to change the settings only in that line. After that it goes back to the original configuration.

Commands

locale | grep LC_NUMERIC LC_NUMERIC=C printf '%g\n' 1e-2 printf '%g\n' 1e-2

Output

LC_NUMERIC="es_AR.UTF-8" 0.01 0,01 To change the configuration for the whole script I have to use export LC_NUMERIC=C

Commands

locale | grep LC_NUMERIC export LC_NUMERIC=C printf '%g\n' 1e-2

Output

C 0.01

If a then I run the script again but without export LC_NUMERIC=C I got my original configuration.

Conclusion

We should add export LC_NUMERIC=C in the scripts that deal with formatting numbers.

Federico

— Reply to this email directly, view it on GitHub https://github.com/GenericMappingTools/gmtserver-admin/pull/192#issuecomment-1490343562, or unsubscribe https://github.com/notifications/unsubscribe-auth/APUT6GPR7CZUOCQD2QCZTNDW6WFXZANCNFSM6AAAAAAWJ4WQGQ. You are receiving this because your review was requested.