# Makecpt qestion

**URL:** <https://forum.generic-mapping-tools.org/t/makecpt-qestion/908>\
**Category:** Q&A\
**Created:** [September 24, 2020, 4:39am UTC](https://forum.generic-mapping-tools.org/t/makecpt-qestion/908 "2020-09-24T04:39:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RustyCuth](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@RustyCuth](https://forum.generic-mapping-tools.org/u/RustyCuth)\
**Post date:** [September 24, 2020, 4:39am UTC](https://forum.generic-mapping-tools.org/t/makecpt-qestion/908/1 "2020-09-24T04:39:48Z")

</div>

Can’t quite get makecpt to do what I want.  
Am creating grid files with data going from 0 up to some variable number x. I want to plot (via grdimage) all data **except** the zeroes with a palette (say “cool”) that goes from zero to x. ie. Leave all zeroes as “white”.  
Have tried setting the zeroes to NaN as I created the grid file (xyz2grd -di0) - that didn’t work.  
I can manually edit the .cpt file each time but would like to be able to do it automatically as I create the file.

---

<div class="post-metadata">

**Author:** ![TimMakins](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/timmakins/32/162_2.png) [@TimMakins](https://forum.generic-mapping-tools.org/u/TimMakins)\
**Post date:** [September 24, 2020, 6:43am UTC](https://forum.generic-mapping-tools.org/t/makecpt-qestion/908/2 "2020-09-24T06:43:44Z")

</div>

Its very easy to make small step changes or offset ramps like that with my CPT Designer program:  
[https://www.mapability.com/cptd/index.php](https://www.mapability.com/cptd/index.php)

---

<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:** [September 24, 2020, 6:28pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-qestion/908/3 "2020-09-24T18:28:40Z")

</div>

Simplest would be to set the zeros to NaN as you describe. What is not working about that + grdimage -Q?

---

<div class="post-metadata">

**Author:** ![RustyCuth](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@RustyCuth](https://forum.generic-mapping-tools.org/u/RustyCuth)\
**Post date:** [September 24, 2020, 9:47pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-qestion/908/4 "2020-09-24T21:47:43Z")

</div>

I had altered the -R values in xyz2grd. However these were incompatible with the -I setting causing xyz2grd to not work. But xyz2grd gives no error message at all so I didn’t realise the grid file was not being updated (could this be looked into?).  
Once the -R -I problem was fixed, I used NaNs as suggested.  
Thanks.

---

<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:** [September 25, 2020, 12:07am UTC](https://forum.generic-mapping-tools.org/t/makecpt-qestion/908/5 "2020-09-25T00:07:19Z")

</div>

Sure, send me your bad -R -I combo. I think GMT defaults kick in to make it “work” which may not be what you meant.

---

<div class="post-metadata">

**Author:** ![RustyCuth](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@RustyCuth](https://forum.generic-mapping-tools.org/u/RustyCuth)\
**Post date:** [September 30, 2020, 11:01pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-qestion/908/6 "2020-09-30T23:01:12Z")

</div>

P  
Sorry for the delay. Got sidetracked.

Did some testing. Not an issue with the -R -I combination. GMT seems to handle that as you said.

Found that (with xyz2grd) -fg produces output but -fiog does not.

R
