[ncl-talk] read_colormap_file suggestion

Alan Brammer abrammer at albany.edu
Wed Sep 16 18:21:04 MDT 2015


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/99f803a7/attachment.html 


More information about the ncl-talk mailing list