Bug #1255
Example code of Transverse Mercator projection report errors
Status: | Closed | Start date: | 2018-06-25 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | - | |||
Target version: | Candidate for next minor release | |||
Affected version: | 6.x-svn | Platform: |
Description
Following code is from psbasemap documentation (http://gmt.soest.hawaii.edu/doc/latest/basemap.html#transverse-mercator-conformal):
$ gmt basemap -R69:30/71:45/-17/-15:15 -Jt70/1:1000000 -Bafg -B+t"Survey area" -pdf transmerc psbasemap [ERROR]: Projection standard latitude is not known; cannot convert -R<unit>... to geographic corners psbasemap [ERROR]: Syntax error -R option. Correct syntax: -R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>] Append r if giving lower left and upper right coordinates -Rg or -Rd for global domain -R<grdfile> to take the domain from a grid file psbasemap [ERROR]: Offending option -R69:30/71:45/-17/-15:15
History
#1
Updated by Paul over 2 years ago
- Status changed from New to Feedback
- Assignee set to Paul
Strange, runs fine for me. is the copy/paste getting some non-standard hidden characters? There is nothing wrong with it as far as I can tell.
#2
Updated by Andreas over 2 years ago
Beware of dubious hyphens.
#3
Updated by Dongdong over 2 years ago
I'm using GMT 6.0.0_r20280 provided by conda-forge (https://github.com/conda-forge/gmt-feedstock).
The following two commands are expected to be equivalent for GMT6. However, the classic one succeeds and the modern one fails.
$ gmt --version 6.0.0_r20280 $ gmt psbasemap -R69:30/71:45/-17/-15:15 -Jt70/1:1000000 -Bafg -B+t"Survey area" > test.ps $ gmt basemap -R69:30/71:45/-17/-15:15 -Jt70/1:1000000 -Bafg -B+t"Survey area" -pdf test psbasemap [ERROR]: Projection standard latitude is not known; cannot convert -R<unit>... to geographic corners psbasemap [ERROR]: Syntax error -R option. Correct syntax: -R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>] Append r if giving lower left and upper right coordinates -Rg or -Rd for global domain -R<grdfile> to take the domain from a grid file psbasemap [ERROR]: Offending option -R69:30/71:45/-17/-15:15
#4
Updated by Joaquim over 2 years ago
Try cleaning your .gmt/sessions dir. It works fine for me.
#5
Updated by Dongdong over 2 years ago
Joaquim wrote:
Try cleaning your .gmt/sessions dir. It works fine for me.
Still failing after removing .gmt/sessions directory:
$ rm -rv ~/.gmt/sessions removed directory: ‘/home/seisman/.gmt/sessions’ $ gmt basemap -R69:30/71:45/-17/-15:15 -Jt70/1:1000000 -Bafg -B+t"Survey area" -pdf test psbasemap [ERROR]: Projection standard latitude is not known; cannot convert -R<unit>... to geographic corners psbasemap [ERROR]: Syntax error -R option. Correct syntax: -R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>] Append r if giving lower left and upper right coordinates -Rg or -Rd for global domain -R<grdfile> to take the domain from a grid file psbasemap [ERROR]: Offending option -R69:30/71:45/-17/-15:15
#6
Updated by Dongdong over 2 years ago
All other plot commands (for different projections) in the psbasemap documentation work, except this one.
#7
Updated by Joaquim over 2 years ago
Hope no Ubuntu devil in that GMT build. It works fine in Wibuntu too (... which is based on Ubuntu).
It's a very weird error because standard lat is not mandatory in transverse mercator. You can try variations like
gmt basemap -R69:30/71:45/-17/-15:15 -Jt70/0/1:1000000 -Bafg -B+t"Survey area" -pdf test
or
gmt basemap -R69:30/71:45/-17/-15:15 -Jtmerc70/1:1000000 -Bafg -B+t"Survey area" -pdf test
but that's getting into the witchcraft world.
#8
Updated by Dongdong over 2 years ago
I'm feeling lost and confused with the results. Maybe there is something wrong with the conda-forge package?
$ gmt --version 6.0.0_r20280 $ which gmt ~/.anaconda/bin/gmt $ rm -rv ~/.gmt/sessions rm: cannot remove ‘/home/seisman/.gmt/sessions’: No such file or directory $ gmt basemap -R69:30/71:45/-17/-15:15 -Jt70/1:1000000 -Bafg -B+t"Survey area" -pdf test psbasemap [ERROR]: Projection standard latitude is not known; cannot convert -R<unit>... to geographic corners psbasemap [ERROR]: Syntax error -R option. Correct syntax: -R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>] Append r if giving lower left and upper right coordinates -Rg or -Rd for global domain -R<grdfile> to take the domain from a grid file psbasemap [ERROR]: Offending option -R69:30/71:45/-17/-15:15 $ gmt basemap -R69:30/71:45/-17/-15:15 -Jt70/0/1:1000000 -Bafg -B+t"Survey area" -pdf test ERROR: Caught signal number 11 (Segmentation fault) at /home/seisman/.anaconda/bin/../lib/libgmt.so.6(gmt_geo_to_xy_line+0x6c)[0x7fc7517edb5c] [0x0] Stack backtrace: /home/seisman/.anaconda/bin/../lib/libgmt.so.6(sig_handler+0x257)[0x7fc7516b4cd7] /lib64/libpthread.so.0(+0xf5e0)[0x7fc75025b5e0] /home/seisman/.anaconda/bin/../lib/libgmt.so.6(gmt_geo_to_xy_line+0x6c)[0x7fc7517edb5c] /home/seisman/.anaconda/bin/../lib/libgmt.so.6(gmt_linearx_grid+0x336)[0x7fc751806f66] /home/seisman/.anaconda/bin/../lib/libgmt.so.6(gmt_map_basemap+0x2596)[0x7fc751822c66] /home/seisman/.anaconda/bin/../lib/libgmt.so.6(GMT_psbasemap+0xb1c)[0x7fc75196dd2c] /home/seisman/.anaconda/bin/../lib/libgmt.so.6(GMT_Call_Module+0x115)[0x7fc7516cb595] gmt(main+0x1fd)[0x40117d] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7fc74b066c05] gmt[0x4019f5] $ gmt basemap -R69:30/71:45/-17/-15:15 -Jtmerc70/1:1000000 -Bafg -B+t"Survey area" -pdf test psbasemap [ERROR]: Could not decode merc70, return NaN. psbasemap [ERROR]: Syntax error -J option. Correct syntax: -Jt<lon0>/[<lat0>/]<scale> OR -JT<lon0>/[<lat0>/]<width> <scale> is <1:xxxx> or cm/degree, or use <width> in cm psbasemap [ERROR]: Offending option -Jtmerc70/1:1000000 psbasemap [ERROR]: Central meridian is not known; cannot convert -R<unit>... to geographic corners psbasemap [ERROR]: Syntax error -R option. Correct syntax: -R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>] Append r if giving lower left and upper right coordinates -Rg or -Rd for global domain -R<grdfile> to take the domain from a grid file psbasemap [ERROR]: Offending option -R69:30/71:45/-17/-15:15
#9
Updated by Joaquim over 2 years ago
Sorry, my -Jtmerc example was wrong. Should have been -Jtmerc/70/1:1000000
Regarding the other, I have no explanation. But why don't you build GMT yourself? I recently build it under Cygwin (what a pain) but compiling instruction I used was (just adapt for your case)
cmake --config Release /cygdrive/c/progs_cygw/GMTdev/gmt5/trunk -DDO_EXAMPLES=ON -DDO_TESTS=ON -DCOPY_GSHHG=TRUE -DCOPY_DCW=TRUE -DSUPPORT_EXEC_IN_BINARY_DIR=TRUE -DGSHHG_ROOT=/cygdrive/c/progs_cygw/GMTdev/gmt5/trunk/share/coast -DDCW_ROOT=/cygdrive/c/progs_cygw/GMTdev/gmt5/trunk/share/dcw -DGMT_OPENMP=ON
make -j
#10
Updated by Dongdong over 2 years ago
I built GMT r20292 myself. Below are the results:
$ gmt --version 6.0.0 $ which gmt /opt/GMT6-dev/bin/gmt $ rm -rv ~/.gmt/sessions removed directory: ‘/home/seisman/.gmt/sessions’ $ gmt basemap -R69:30/71:45/-17/-15:15 -Jt70/0/1:1000000 -Bafg -B+t"Survey area" -pdf test ERROR: Caught signal number 11 (Segmentation fault) at /opt/GMT6-dev/lib64/libgmt.so.6(gmt_geo_to_xy_line+0x6c)[0x7f00f54de5ec] [0x0] Stack backtrace: /opt/GMT6-dev/lib64/libgmt.so.6(sig_handler+0x257)[0x7f00f53a5f37] /lib64/libc.so.6(+0x35270)[0x7f00eec6b270] /opt/GMT6-dev/lib64/libgmt.so.6(gmt_geo_to_xy_line+0x6c)[0x7f00f54de5ec] /opt/GMT6-dev/lib64/libgmt.so.6(gmt_linearx_grid+0x336)[0x7f00f54f77f6] /opt/GMT6-dev/lib64/libgmt.so.6(gmt_map_basemap+0x2597)[0x7f00f5512637] /opt/GMT6-dev/lib64/libgmt.so.6(GMT_psbasemap+0xb1c)[0x7f00f565c62c] /opt/GMT6-dev/lib64/libgmt.so.6(GMT_Call_Module+0x115)[0x7f00f53bc805] gmt(main+0x1fd)[0x400ecd] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f00eec57c05] gmt[0x401743] $ gmt basemap -R69:30/71:45/-17/-15:15 -Jtmerc/70/1:1000000 -Bafg -B+t"Survey area" -pdf test psbasemap [ERROR]: Projection standard latitude is not known; cannot convert -R<unit>... to geographic corners psbasemap [ERROR]: Syntax error -R option. Correct syntax: -R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>] Append r if giving lower left and upper right coordinates -Rg or -Rd for global domain -R<grdfile> to take the domain from a grid file psbasemap [ERROR]: Offending option -R69:30/71:45/-17/-15:15 $ gmt basemap -R69:30/71:45/-17/-15:15 -Jt70/1:1000000 -Bafg -B+t"Survey area" -pdf test psbasemap [ERROR]: Projection standard latitude is not known; cannot convert -R<unit>... to geographic corners psbasemap [ERROR]: Syntax error -R option. Correct syntax: -R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>] Append r if giving lower left and upper right coordinates -Rg or -Rd for global domain -R<grdfile> to take the domain from a grid file psbasemap [ERROR]: Offending option -R69:30/71:45/-17/-15:15
#11
Updated by Joaquim over 2 years ago
OK, I'm as lost as you. My last attempt, but even if it works it won't explain previous errors. Try with proj syntax
gmt basemap -R69:30/71:45/-17/-15:15 -J+proj=tmerc+lon_0=70/1:1000000 -Bafg -B+t"Survey area" -pdf test
#12
Updated by Dongdong over 2 years ago
Unfortunately, it's still failing for me.
Joaquim wrote:
OK, I'm as lost as you. My last attempt, but even if it works it won't explain previous errors. Try with proj syntax
gmt basemap -R69:30/71:45/-17/-15:15 -J+proj=tmerc+lon_0=70/1:1000000 -Bafg -B+t"Survey area" -pdf test
#13
Updated by Joaquim over 2 years ago
But what was the error message?
#14
Updated by Dongdong over 2 years ago
Joaquim wrote:
But was is the error message?
$ gmt basemap -R69:30/71:45/-17/-15:15 -J+proj=tmerc+lon_0=70/1:1000000 -Bafg -B+t"Survey area" -pdf test ERROR: Caught signal number 11 (Segmentation fault) at [0x18a1840] [0x18a1840] Stack backtrace: /opt/GMT6-dev/lib64/libgmt.so.6(sig_handler+0x257)[0x7fe7085d0f37] /lib64/libc.so.6(+0x35270)[0x7fe701e96270] [0x18a1840]
#15
Updated by Joaquim over 2 years ago
So, only debugging can tell what's going on in your system.
#16
Updated by Paul over 2 years ago
Hi Dongdong, remind us again of your OS and if build with debug or for relelase. Are you able to run your examine in a debugger to see where/why it crashes?
#17
Updated by Paul over 2 years ago
Also, please run command with -Vd.
#18
Updated by Paul over 2 years ago
- Target version set to Candidate for next minor release
The message about standard latitude is only given by gmtinit_rectR_to_geoR which is only called when -R is given in projected units. That lead me to check how it might get in there and I found that an array double rect of length 4 is not initialized and could have random junk exceeding 360. Then, if the read for the meters fails then we may be comparing junk to see if values are degrees or meters. I have fixed this by initializing the array to zero and also check if the read is successfully converting 4 numbers. I suspect this was the problem. Let me know. In r20295.
#19
Updated by Dongdong over 2 years ago
Paul wrote:
The message about standard latitude is only given by gmtinit_rectR_to_geoR which is only called when -R is given in projected units. That lead me to check how it might get in there and I found that an array double rect of length 4 is not initialized and could have random junk exceeding 360. Then, if the read for the meters fails then we may be comparing junk to see if values are degrees or meters. I have fixed this by initializing the array to zero and also check if the read is successfully converting 4 numbers. I suspect this was the problem. Let me know. In r20295.
r20295 fixed the issue. The commands all succeed.