Feature #640

Supporting Date/Time as Range of makecpt

Added by Edith over 4 years ago. Updated 12 months ago.

Status:ClosedStart date:2014-11-15
Priority:NormalDue date:
Assignee:Paul% Done:


Target version:Candidate for next minor release


I would be most pleased if you would consider in one of the next GMT releases a fix that makecpt can support date/time as Range (-T) as asked/answered in User-Forum makecpt with time? on 11/11/14.

Thank you in advance,


#1 Updated by Florian over 4 years ago

  • Description updated (diff)

#2 Updated by Remko over 4 years ago

  • Assignee set to Remko
  • Target version set to Candidate for next minor release
  • Start date changed from 2014-11-11 to 2014-11-15

To be considered for implementation in 5.2.x, but after the release this month.

#3 Updated by Paul over 4 years ago

  • Status changed from New to Feedback
This is doable but will involve the machinery normally used for axis annotations. For example, running
makecpt -T2010T/2014T/3o

should mean 3-month intervals which have different number of days, just like when -Ba3o is used. Basically, we will then support the same increments as in -B, such as days, weeks, Gregorian weeks, months, etc.
I see the following changes to be involved:
  1. No longer use atof to parse min/max/inc since these could be dates, so use GMT_scanf as elsewhere.
  2. From these, build a coordinate array as is done in basemap plotting. Normally, these will be equidistant but not for time, necessarily.
  3. Set -f0T when min and max contains the "T" used to indicate date-time string so that the i/o machinery will work.
  4. Write date-time strings into the output cpt files (well, if -fo0t is used then relative time is written).
  5. Parsing of CPT files needs to use GMT_scanf since there may be date-strings.

#4 Updated by Paul about 1 year ago

  • Status changed from Feedback to Resolved
  • Assignee changed from Remko to Paul
  • % Done changed from 0 to 100

After reimplementing the parsing of -T in modules like makecpt and gmtmath we can now accept things like -T2017/2018/1o and get an uneven but monthly interval. This now carries through to CPT files which can now use an absolute time axis. As an example, see

gmt makecpt -T2017T/2018T/1o -Cjet > t.cpt

which is part of a new test script (tests/makecpt/timecpt.sh). In r19803

#5 Updated by Paul 12 months ago

  • Status changed from Resolved to Closed

Closing this as implemented.

Also available in: Atom PDF