# \-C question

**URL:** <https://forum.generic-mapping-tools.org/t/c-question/2650>\
**Category:** Q&A\
**Tags:** gmt\
**Created:** [February 22, 2022, 3:17am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650 "2022-02-22T03:17:18Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunzhe-96](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/sunzhe-96/32/2034_2.png) [@sunzhe-96](https://forum.generic-mapping-tools.org/u/sunzhe-96)\
**Post date:** [February 22, 2022, 3:17am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/1 "2022-02-22T03:17:18Z")

</div>

Hello everyone,recently I use -Cdr\_plot.cpt that has been running without results and can run the results without using the dr\_plot.cpt

 ![colorbar](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/e/e9e546940d854ccd71399317cfd9ddab4cf3f2b3.jpeg) ![colorbar2](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/8/8163d83143b874adab9073e940559ace278394c0.jpeg) [dr\_plot.txt](https://forum.generic-mapping-tools.org/uploads/short-url/7w979Neu3L65CRIo9KiPsudLguz.txt) (343 Bytes)

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [February 22, 2022, 3:35am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/2 "2022-02-22T03:35:11Z")

</div>

I am not sure. But I have just check dr\_plot.txt file and I think that the CPT needs only integer values. If I were you, I would try that.

```
-30	48/18/59	-20	70/106.75/226.63
-20	70/106.75/226.63	-10	40.5/187.25/235.75
-10	40.5/187.25/235.75	0	48.875/241.62/153.13
0	48.875/241.62/153.13	10	162.5/252.5/60.5
10	162.5/252.5/60.5	20	236.75/208.25/58
20	236.75/208.25/58	30	251/128.25/33.75
30	251/128.25/33.75	40	209.75/48.75/5
40	209.75/48.75/5	50	122/4/3
B	48/18/59
F	122/4/3
N	127.5
```

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [February 22, 2022, 3:37am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/3 "2022-02-22T03:37:40Z")

</div>

When you say “without any results” do you mean that the atm\_a.png file is not created and there are no messages/errors in the process?

---

<div class="post-metadata">

**Author:** ![sunzhe-96](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/sunzhe-96/32/2034_2.png) [@sunzhe-96](https://forum.generic-mapping-tools.org/u/sunzhe-96)\
**Post date:** [February 22, 2022, 5:26am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/4 "2022-02-22T05:26:08Z")

</div>

Thank you for your reply,I’ll try

---

<div class="post-metadata">

**Author:** ![sunzhe-96](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/sunzhe-96/32/2034_2.png) [@sunzhe-96](https://forum.generic-mapping-tools.org/u/sunzhe-96)\
**Post date:** [February 22, 2022, 5:35am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/5 "2022-02-22T05:35:02Z")

</div>

Yeah, when running the script with -Cdr\_plot.cpt, that has no response, and no image is generated just like the first picture on question top.

---

<div class="post-metadata">

**Author:** ![sunzhe-96](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/sunzhe-96/32/2034_2.png) [@sunzhe-96](https://forum.generic-mapping-tools.org/u/sunzhe-96)\
**Post date:** [February 22, 2022, 5:39am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/6 "2022-02-22T05:39:09Z")

</div>

I run the modified script and this happened

 ![colorbar3](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/0/06fd0b0c366a50766fe8c676a26845d844718ee0.jpeg)

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [February 22, 2022, 5:49am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/7 "2022-02-22T05:49:33Z")

</div>

In modern mode, if you really need to access the CPT file by name then you need to add -H. But most of the time you would just say

```
gmt makecpt -Cturbo -T-30/50/10 -Z -D
gmt grdimage vel2_atm.grd -JX6i+ -Q -B
gmt colorbar-rect-default -Bxaf+l"...."
gmt end

```

The makecpt command sets the “current CPT” and then grdimage and colorbar will use it by default.

---

<div class="post-metadata">

**Author:** ![sunzhe-96](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/sunzhe-96/32/2034_2.png) [@sunzhe-96](https://forum.generic-mapping-tools.org/u/sunzhe-96)\
**Post date:** [February 22, 2022, 6:04am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/8 "2022-02-22T06:04:49Z")

</div>

Thank you so much,it can work!

---

<div class="post-metadata">

**Author:** ![volkerk](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@volkerk](https://forum.generic-mapping-tools.org/u/volkerk)\
**Post date:** [February 23, 2022, 8:47am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/9 "2022-02-23T08:47:13Z")

</div>

I also came across the described problem. After the conversion, now I found the description of the ‘-H’ option on the module page of grdimage, but only as a comment for modern mode at the end of the page. I recommend to add the ‘-H’ flag option, and to give a hint at the -C option.

---

<div class="post-metadata">

**Author:** ![volkerk](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@volkerk](https://forum.generic-mapping-tools.org/u/volkerk)\
**Post date:** [February 23, 2022, 9:01am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/10 "2022-02-23T09:01:53Z")

</div>

sorry conversation of course 🙂

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [February 23, 2022, 9:05am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/11 "2022-02-23T09:05:49Z")

</div>

Well, we cannot add a -H option to on the grdimage man page; the -H is an option of makecpt and grd2cpt. I will see if we can add a hint-link near -C that takes you down to the discussion of current CPTs. Our main concerns have been to allow users of classic mode to work as they always have, but once you are writing modern mode scripts then you must follow how things are done in modern mode regarding CPTs etc.

---

<div class="post-metadata">

**Author:** ![volkerk](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@volkerk](https://forum.generic-mapping-tools.org/u/volkerk)\
**Post date:** [February 23, 2022, 9:24am UTC](https://forum.generic-mapping-tools.org/t/c-question/2650/12 "2022-02-23T09:24:54Z")

</div>

Thanks, I got it. The -H option in makecpt I was not aware of.
