[ncl-talk] read_colormap_file suggestion

Rick Brownrigg brownrig at ucar.edu
Wed Sep 16 19:18:48 MDT 2015


Hi Alan,

I think its fairly straightforward to decree that, at least as far as NCL
is concerned, that colormaps will be comprised of either RGB 3-tuples, or
RGBa 4-tuples, one tuple per line, with the individual components on a line
separated by whitespace, and with whitespace defined to be space, tab, or
comma.  Let someone else get rid of the commas if they find them a problem
 ;-)

my $0.02,
Rick

On Wed, Sep 16, 2015 at 6:21 PM, Alan Brammer <abrammer at albany.edu> wrote:

> Looking at the man page for ncview I see they require space separated
> columns. Elsewhere it seems to be a free for all on format.
> In retrospect, I'm happy for this to not be included if a space separated
> file is the preferred input and the inclusion of comma and spaces may cause
> issues down the line.  Easy enough to get rid of the commas.
> On 16 Sep 2015 5:11 p.m., "David Brown" <dbrown at ucar.edu> wrote:
>
>> The original colormap reader for NCL was built to be reasonably
>> permissive in the format of the file. It ignores lines that start with
>> non-numeric characters, allows any amount of whitespace and/or a comma
>> in between numbers, and figures out from the range of the numbers
>> encountered whether the rgb components are represented as 8 bit or 16
>> bit integers or as 0-1 floating point values. Also it doesn't care
>> whether there are 1 or 3 or N components to a line. It will stop
>> reading the file once it has encountered 3 * 256 valid numbers.
>> The code was tested using files containing native NCL format floating
>> point rgb triplets in the 0-1 range, as well as .gp files from the
>> GIST plotting package, and .ncmap files from ncview.
>>  -dave
>>
>>
>> On Wed, Sep 16, 2015 at 1:09 PM, Rick Brownrigg <brownrig at ucar.edu>
>> wrote:
>> > Hi Alan,
>> >
>> > That's a good suggestion, and I'll make sure it gets into 6.3.1.
>> >
>> > FWIW, I don't know of any formal spec for these file; the current
>> version of
>> > read_colormap_file() was written to accommodate all the variations we
>> had at
>> > the time.
>> >
>> > Thanks for the suggestion!
>> > Rick
>> >
>> >
>> > On Wed, Sep 16, 2015 at 12:49 PM, Alan Brammer <abrammer at albany.edu>
>> wrote:
>> >>
>> >> line 199 $NCARG_ROOT/lib/ncarg/nclscripts/utilities.ncl  (v6.3.0)
>> >>
>> >>     tokens = str_split(lines(i), " ")
>> >>
>> >> This only allows for space separated rgb files.  I can't find any true
>> >> specifications on rgb file format but I have csv rgb files that work
>> with
>> >> the other NCL functions but not read_colormap_file().
>> >>
>> >> If the above line is edited to the below it allows both space and comma
>> >> delimiters.
>> >>
>> >>     tokens = str_split(lines(i), " ,")
>> >>
>> >> Side note, there's no documentation that str_split accepts multiple
>> >> delimiters.
>> >>
>> >> Thanks,
>> >> Alan.
>> >>
>> >> _______________________________________________
>> >> ncl-talk mailing list
>> >> ncl-talk at ucar.edu
>> >> List instructions, subscriber options, unsubscribe:
>> >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >>
>> >
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > ncl-talk at ucar.edu
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150916/9d096b24/attachment.html 


More information about the ncl-talk mailing list