Bug #1257

Custom Symbols: symbol variable type "s" picks wrong column from from input file

Added by Kristof 7 days ago. Updated 4 days ago.

Status:ResolvedStart date:2018-07-10
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next minor release
Affected version:5.4.x-svn Platform:

Description

When building a symbol using text substitution with the l macro command the declared variable type s picks the wrong column from the input file.

Example:

text_subst_sample_data.d

# LON  LAT  SIZE  STRING1  STRING2
# --------------------------------
   119  1    1     one      ONE
   120  1    2     two      TWO
   121  1    3     three    THREE

text_subst_symbol.def
N: 2 ss
0 0 1 $1 l -Gred
0 0 1 $2 l -Gblue

text_subst_test_script.sh
#!/bin/bash

FILE=test_subst.ps

pscoast \
    -R117/-1.5/122.5/3r \
    -JM15c \
    -Bag -Di -Ggrey -Wthinnest -A250 -P \
    -K \
    > $FILE

psxy \
    -R -J \
    text_subst_sample_data.d \
    -Sktext_subst_symbol \
    -O \
    >> $FILE

Result:

I expected the words one, two and three plotted in lowercase with red fill and the words ONE, TWO, THREE in uppercase and blue fill.

  • Feeding one variable to the symbol with N: 1 s
    • variable $1 returns the value from the column to the left, in this case SIZE instead of STRING1
  • Feeding two variables to the symbol with N: 2 ss
    • variable $1 returns the value from the column to the left, in this case SIZE instead of STRING1
    • variable $2 contains the value of what I would expect in $1, so as well the column left of it in the input file, here STRING1 instead of STRING2.

Additionally, I expected the strings to be equal size in each symbol with increasing symbol size from left to right. But this might be another problem.

Tested in 5.4.4_r20371

text_subst_result.png (98.4 KB) Kristof, 2018-07-10 00:45

Associated revisions

Revision 20409
Added by Paul 4 days ago

Address issue #1257

History

#1 Updated by Paul 4 days ago

  • Status changed from New to Resolved
  • Assignee set to Paul
  • Target version set to Candidate for next minor release
  • % Done changed from 0 to 100

I have had to redo how text is considered. Because trailing text follows numerical columns in GMT6 there are now four ways to place variable text:

  1. Use a variable like $2, which is a numerical column value and hence the N: entry must be o, not s (since not a string)
  2. Use the entire trailing text by using $t. N: requires s
  3. Specify a single word from the trailing text with $t:n, with n = 1,2,.... N: requires one s for each word your symbol accesses

This means your particular symbol definition must be

N: 2 ss
0 0 1 $t:1 l -Gred
0 0 1 $t:2 l -Gblue

Also, words in trailing text must be separated by single tabs or spaces, not multiple spaces (like in your case). With those changes your example works for me in r20409.

Also available in: Atom PDF