# Trend1d model output question/feature request

**URL:** <https://forum.generic-mapping-tools.org/t/trend1d-model-output-question-feature-request/6211>\
**Category:** Q&A\
**Tags:** gmt, trend1d\
**Created:** [September 24, 2025, 7:09pm UTC](https://forum.generic-mapping-tools.org/t/trend1d-model-output-question-feature-request/6211 "2025-09-24T19:09:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkononets](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mkononets/32/4029_2.png) [@mkononets](https://forum.generic-mapping-tools.org/u/mkononets)\
**Post date:** [September 24, 2025, 7:09pm UTC](https://forum.generic-mapping-tools.org/t/trend1d-model-output-question-feature-request/6211/1 "2025-09-24T19:09:24Z")

</div>

Hi,

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`:

```auto
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:

```auto
gmt trend1d data.txt -Np2 -Fxm -T0/3000/100+n | gmt plot -W2 -N ...

```

`gmt regress` does the `-T...` thing same way as `gmt math` so it can be used to implement the one-liner above.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [September 25, 2025, 7:11pm UTC](https://forum.generic-mapping-tools.org/t/trend1d-model-output-question-feature-request/6211/2 "2025-09-25T19:11:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mkononets](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mkononets/32/4029_2.png) [@mkononets](https://forum.generic-mapping-tools.org/u/mkononets)\
**Post date:** [September 25, 2025, 7:41pm UTC](https://forum.generic-mapping-tools.org/t/trend1d-model-output-question-feature-request/6211/3 "2025-09-25T19:41:56Z")

</div>

Thanks for answering Joaquim.

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.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [September 25, 2025, 9:37pm UTC](https://forum.generic-mapping-tools.org/t/trend1d-model-output-question-feature-request/6211/4 "2025-09-25T21:37:49Z")

</div>

`trend1d` is one of the originals GMT modules from 2.1.4 (and likely older). Code shows it.

If @WHFSmith sees this topic he will certainly have some stories about this module.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [January 8, 2026, 12:31pm UTC](https://forum.generic-mapping-tools.org/t/trend1d-model-output-question-feature-request/6211/5 "2026-01-08T12:31:43Z")

</div>

Implemented in [Add a -T option that can be used with -Fxm (like in gmtregress). by joa-quim · Pull Request #8861 · GenericMappingTools/gmt · GitHub](https://github.com/GenericMappingTools/gmt/pull/8861)

---

<div class="post-metadata">

**Author:** ![mkononets](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mkononets/32/4029_2.png) [@mkononets](https://forum.generic-mapping-tools.org/u/mkononets)\
**Post date:** [January 9, 2026, 10:46am UTC](https://forum.generic-mapping-tools.org/t/trend1d-model-output-question-feature-request/6211/6 "2026-01-09T10:46:18Z")

</div>

Thanks, that’s great!

Hope to try it out once the development gmt build is updated in conda!
