I calculate poly fit to my data using trend1d -Np2 and then would like to plot the polynomial.
What I do now is I parse gmt trend1d ... -Fp output to get poly coefficients and then generate a -T-based dataset using gmt math:
COEFFS=($(gmt trend1d data.txt -Np2 -Fp)) # populating a bash array from trend1d output
gmt math -T0/3000/3+n ${COEFFS[0]} T ${COEFFS[1]} MUL ADD T 2 POW ${COEFFS[2]} MUL ADD = | gmt plot -W2 -N
Am I missing some of trend1d capabilities? Or would it be a reasonable feature request to have -T... and -Fxm implemented in trend1d? This is to be able to plot the model using a one-liner like below:
I see the point (I’m a big fan of one-liners myself too) and thought it could be perhaps simple to implement, but unfortunately the coding logics of gmtregress & trend1d are quite different (a long time span between the two programs) making this not a such trivial thing to implement. … at least on a first look.
My 2nd degree polynomial example is one of the simplest examples possible that is easy to code using gmt math’s RPN. Imagine a model with several polynomial and harmonic terms: the corresponding gmt math code becomes long and more error-prone. Something that could just be avoided in case the -T... option was available.
Yes I read a bit (mostly here on the forum) after posting my topic and realized trend1d must be quite a different tool. trend1s has e.g. the capability of (de)trending multiple datasets contained in one data source. That capability alone makes trend1d incompatible with the -T... option, as far as I can understand.
Anyway it felt a reasoneble question to ask. Maybe gmt regress could potentially be upgraded with polynomial and harmonic regression term capabilities of trend1d. Or even a new regress-like tool created with trend1d trending capabilities.