gmt icon indicating copy to clipboard operation
gmt copied to clipboard

Recommand leading RCL for math macro use

Open PaulWessel opened this issue 2 years ago • 2 comments

The gmtmath and grdmath macro allows users to name an intermediate result (STO@name) and then recall it for use later on in the same command via [RCL]@name, and to clear it if need be via CLR@name. It is thus only the reference to it where the 3-char command is not required, i.e., one can just use @name.

This scheme predates remote cache files by years. While I have recently fixed g*math.c so that there is no confusion between @name and @cachefile, I wonder if we should insist on using the full RCL@name syntax (backwards compatible of course - i.e., we update the docs to not mention the optionality of RCL and carry this through in documentation and our scripts).

Thoughts on this, anyone?

PaulWessel avatar May 22 '22 14:05 PaulWessel

As long as the following syntax stays valid :

gmt math -foT --TIME_UNIT=d -T0/365/1 2 PI MUL T 1 SUB MUL 365 DIV STO@r POP \
			0.006818 \
			@r COS 0.39912 MUL SUB \
			@r SIN 0.0757 MUL ADD 2 \
			@r MUL COS 0.006758 MUL SUB 2 \
			@r MUL SIN 0.000907 MUL ADD 3 @r \
			MUL COS 0.002697 MUL SUB 3 @r \
			MUL SIN 0.00148 MUL ADD \
			180 PI DIV MUL = declination.txt

I'm happy. I managed with the doc as it is and it was good (except for the POP command that was not so clear and that I overlooked)

gd-a avatar May 30 '22 12:05 gd-a

Yes, it will be backwards compatible.

PaulWessel avatar May 30 '22 19:05 PaulWessel