Fill the bars by using .cpt file

Hello all,

I would like to fill the bars according to azimuth. I used the following commands and I had

–gmt makecpt -T0/180/1 -Cjet > angle.cpt
–cat $inputfile | awk ‘{print $14,$13,$9,$11}’ | gmt psxy -R -JM -SVb0.01/0.001/0.001 -W0.5 -O -K -V -Cangle.cpt >> $ps

In $inputfile;
14. column: Longitude
13. column: Latitude
9. column: azimuth
11. column: length

I would like to plot the colored bars according to their azimuths (9th column of the data)

Do you have any suggestions to plot this type of map?

Bests,
Thank you!!

What result do you get? Any error in the terminal?

I get the following error,

psxy: Mismatch between actual (4) and expected (5) fields near line 1

Could it be that the 9th column is actually the 8th ? (gmt starts counting at 0)

You need to print $9 (azimuth) twice so that it can be both “z” (for CPT lookup) as well as azimuth for the definition of your vectors. The input has to look like

lon lat azimuth azimuth length

i.e., 5 columns. If something else where to affect the color then you would pick another “z”.

Thank you,
I tried your suggestion but the lines are not colored with azimuth. I get the following warnings,

psxy: Warning: Length unit z not supported - revert to default unit [point]
psxy: Warning: 0.5+ not a valid number and may not be decoded properly.

How can i revert the length unit to default?

Please add the commands used.

cat $ifile | awk ‘{print $14,$13,$9,$9,$11/2}’ | gmt psxy -R -JM -SVb0.01/0.001/0.001 -W0.5 -O -K -V -Cangle.cpt >> $ps

Now I use this command, I didnt get previous warnings.
But the lines are not coloured with azimuth ($9)

I create the angle.cpt as following,

gmt makecpt -T0/180/1 -C/opt/local/share/gmt/cpt/jet.cpt > angle.cpt

Mmm… If there are no warning, then it must be working fine. So I only can think that the values of azimuth are not between 0-180. What colored do you get? Can you show some lines of your data?

I copied 5 rows of the input file to below.

AAA 2010181072227 16.396 -97.782 6.3 20 306 106 11 4 2.35 0.30 38.04 27.73
AAA 2010342052435 -56.412 -25.741 6.3 29.4 208 104 173 9 1.40 0.25 37.80 27.80
AAA 2011065143236 -56.422 -27.063 6.5 87.7 208 105 1 7 1.70 0.35 37.80 27.79
AAA 2011246044857 -56.451 -26.847 6.4 84 208 105 159 25 0.95 0.35 37.80 27.80
AAA 2012093173642 16.395 -98.316 6 9 306 106 6 4 2.15 0.25 38.04 27.73

Actually, 9. column includes azimuth and values vary from 0 to 180.

Mmm, I can’t find any error. I would need to take a look at the full script (or a reduced version that produce the same error) and the map created.

Hi all,

I realized a very simple mistake in the command and I fixed the problem.

In the command, I set a very small width for the bar (-SVb0.01/0.001/0.001), it is not enough to observe the color, because line width (-W0.5) is too thick.

$$ cat $ifile | awk ‘{print $14,$13,$9,$9,$11/2}’ | gmt psxy -R -JM -SVb0.01/0.001/0.001 -W0.5 -O -K -V -Cangle.cpt >> $ps

I changed the command from as above so as below and it works.

$$ cat $ifile | awk ‘{print $14,$13,$9,$9,$11/2}’ | gmt psxy -R -JM -SVb0.1/0.001/0.001 -W0.1 -O -K -V -Cangle.cpt >> $ps

Thank you all so much for your help.