Re: [Plplot-devel] Loading segmented color scales with plspal1

2009-08-20 Thread Andrew Ross

Hez,

I've fixed up the other languages and implementations of example 16.
A relatively quick fix. Checked and working.

Andrew

On Wed, Aug 19, 2009 at 08:20:23PM -0500, Hezekiah M. Carty wrote:
 On Wed, Aug 19, 2009 at 7:16 PM, Hezekiah M.
 Cartyhezekiahca...@users.sourceforge.net wrote:
  On Wed, Aug 19, 2009 at 6:28 PM, Hezekiah M.
  Cartyhezekiahca...@users.sourceforge.net wrote:
  On Wed, Aug 19, 2009 at 4:55 PM, Andrew
  Rossandrewr...@users.sourceforge.net wrote:
  Having said both of these, I can see the use of something like this and 
  as Alan said
  now is the time to decide before we release with the new plscmap1 API. 
  Propagating
  changes is not a big problem since this is a relatively straightfoward 
  function and
  only a simple modification to the API.
 
  Sounds good. ??I will make the change and commit it.
 
  Done for C as commit 10302, and OCaml as commit 10303.
 
 The attached patch should update the plspal1 binding for all of the
 other languages except Fortran 77 and Fortran 90.  I don't have the
 prerequisites for most of the other language bindings installed on my
 system, so this patch is unfortunately not tested.  F77 and F90 are
 left out as I am uncertain how to handle them.
 
 I have not updated the example 16s of the languages other than C and
 OCaml as I do now know how the PLBOOL - language booleans are handled
 for each of them.  If this information is readily available I would be
 happy to assist in those changes as well.
 
 I will work to track down the language bindings dependencies issues on
 my system in the mean time.
 
 Hez
 
 -- 
 Hezekiah M. Carty
 Graduate Research Assistant
 University of Maryland
 Department of Atmospheric and Oceanic Science

 diff --git a/bindings/c++/plstream.cc b/bindings/c++/plstream.cc
 index 3dedcbc..65efa22 100644
 --- a/bindings/c++/plstream.cc
 +++ b/bindings/c++/plstream.cc
 @@ -1890,11 +1890,11 @@ void plstream::spal0(const char *filename)
  
  /* Set the colors for color table 1 from a cmap1 file */
  
 -void plstream::spal1(const char *filename)
 +void plstream::spal1(const char *filename, bool interpolate)
  {
set_stream();
  
 -  plspal1(filename);
 +  plspal1(filename, (PLBOOL) interpolate);
  }
  
  /* Set the pause (on end-of-page) status */
 diff --git a/bindings/d/plplot.d b/bindings/d/plplot.d
 index ecfb9f3..5f6211f 100644
 --- a/bindings/d/plplot.d
 +++ b/bindings/d/plplot.d
 @@ -451,9 +451,9 @@ void plspal0(string filename)
  }
  
  /* Set the colors for color table 1 from a cmap1 file */
 -void plspal1(string filename)
 +void plspal1(string filename, PLBOOL interpolate)
  {
 - c_plspal1(toStringz(filename));
 + c_plspal1(toStringz(filename), interpolate);
  }
  
  /* Set color map 0 colors by 8 bit RGB values */
 @@ -1903,7 +1903,7 @@ void c_plspage(PLFLT xp, PLFLT yp, PLINT xleng, PLINT 
 yleng, PLINT xoff, PLINT y
  void c_plspal0(char* filename);
  
  /* Set the colors for color table 1 from a cmap1 file */
 -void c_plspal1(char *filename);
 +void c_plspal1(char *filename, PLBOOL interpolate);
  
  /* Set the pause (on end-of-page) status */
  void c_plspause(PLBOOL pause);
 diff --git a/bindings/java/PLStream.java b/bindings/java/PLStream.java
 index d80c1d5..009aae5 100644
 --- a/bindings/java/PLStream.java
 +++ b/bindings/java/PLStream.java
 @@ -803,9 +803,9 @@ public void spal0(String filename) {
  plplotjavac.plspal0(filename);
  }
  
 -public void spal1(String filename) {
 +public void spal1(String filename, boolean interpolate) {
  if (set_stream() == -1) return;
 -plplotjavac.plspal1(filename);
 +plplotjavac.plspal1(filename, interpolate);
  }
  
  public void spause(boolean pause) {
 diff --git a/bindings/octave/plplot_octave.h.in 
 b/bindings/octave/plplot_octave.h.in
 index 0967cf1..ea7ae64 100644
 --- a/bindings/octave/plplot_octave.h.in
 +++ b/bindings/octave/plplot_octave.h.in
 @@ -1394,7 +1394,7 @@ void c_plspage(PLFLT xp, PLFLT yp, PLINT xleng, PLINT 
 yleng,
  
  /* Set the colors for color table 1 from a cmap1 file */
  
 -void c_plspal1(const char *filename); //%name plspal1
 +void c_plspal1(const char *filename, PLBOOL interpolate); //%name plspal1
  
  /* Set the pause (on end-of-page) status */
  
 diff --git a/bindings/swig-support/plplotcapi.i 
 b/bindings/swig-support/plplotcapi.i
 index 53647f2..9c9c2c2 100644
 --- a/bindings/swig-support/plplotcapi.i
 +++ b/bindings/swig-support/plplotcapi.i
 @@ -799,7 +799,7 @@ plspal0(const char *filename);
  
  %feature(autodoc, Set the color map 1 colors using a cmap1 color palette 
 file.) plspal1;
  void
 -plspal1(const char *filename);
 +plspal1(const char *filename, PLBOOL interpolate);
  
  %feature(autodoc, Set the pause (on end-of-page) status.) plspause;
  void
 diff --git a/bindings/tcl/plapi.tpl b/bindings/tcl/plapi.tpl
 index 20c3213..edf9013 100644
 --- a/bindings/tcl/plapi.tpl
 +++ b/bindings/tcl/plapi.tpl
 @@ -878,6 +878,7 @@ filename  const char *
  
  pltclcmd plspal1 void
  filename const char *
 

Re: [Plplot-devel] Loading segmented color scales with plspal1

2009-08-20 Thread Hezekiah M. Carty
On Thu, Aug 20, 2009 at 4:06 AM, Andrew
Rossandrewr...@users.sourceforge.net wrote:
 I've fixed up the other languages and implementations of example 16.
 A relatively quick fix. Checked and working.

Thank you very much Andrew!

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


[Plplot-devel] Loading segmented color scales with plspal1

2009-08-19 Thread Hezekiah M. Carty
I would like to add support for loading segmented colors scales with
plspal1, using plscmap1a rather than plscmap1la.  This way, the colors
would be separated by distinct cut-offs rather than continuous
transitions.  See the color bar used by the US National Weather
Service radar images as an example:

http://radar.weather.gov/ridge/radar.php?rid=lsxproduct=N0Roverlay=1110loop=no

This is a fairly straightforward change, and I have prepared it
locally.  However, two approaches seem reasonable to me and I would
like to as for others' opinions before settling on one.

The first, and the one I have implemented, is a new file format.
Rather than a v2 header, this one has a v2s header (s =
segmented).  No reverse field is needed, as it is not applicable here.
 This format is otherwise the same as the existing v2 format.

The second option I thought of after implementing the v2s file format
code is to change the plspal1 API to take a second argument to
determine if the file should be interpreted as discrete values or
interpolation points.  Something similar to plspal1(filename, true)
for an interpolated color map and plspal1(filename, false) for a
segmented color map.

I like the second option more because the same color palette files can
potentially be used for multiple purposes.  It does, however, require
a small API change to plspal1 (adding a PLBOOL parameter) which would
then have to be propagated to all the language bindings.

Any thoughts?  I understand that this is rather poor timing, given the
number of added plspaln to language X bindings Subversion commits
there have been recently.  This has unfortunately been my first chance
to dig in to this section of code and see how it works.

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Loading segmented color scales with plspal1

2009-08-19 Thread Andrew Ross
On Wed, Aug 19, 2009 at 01:54:32PM -0700, Alan Irwin wrote:
 On 2009-08-19 15:11-0500 Hezekiah M. Carty wrote:
 
  I would like to add support for loading segmented colors scales with
  plspal1, using plscmap1a rather than plscmap1la.  This way, the colors
  would be separated by distinct cut-offs rather than continuous
  transitions.  See the color bar used by the US National Weather
  Service radar images as an example:
 
  http://radar.weather.gov/ridge/radar.php?rid=lsxproduct=N0Roverlay=1110loop=no
 
  This is a fairly straightforward change, and I have prepared it
  locally.  However, two approaches seem reasonable to me and I would
  like to as for others' opinions before settling on one.
 
  The first, and the one I have implemented, is a new file format.
  Rather than a v2 header, this one has a v2s header (s =
  segmented).  No reverse field is needed, as it is not applicable here.
  This format is otherwise the same as the existing v2 format.
 
  The second option I thought of after implementing the v2s file format
  code is to change the plspal1 API to take a second argument to
  determine if the file should be interpreted as discrete values or
  interpolation points.  Something similar to plspal1(filename, true)
  for an interpolated color map and plspal1(filename, false) for a
  segmented color map.
 
  I like the second option more because the same color palette files can
  potentially be used for multiple purposes.  It does, however, require
  a small API change to plspal1 (adding a PLBOOL parameter) which would
  then have to be propagated to all the language bindings.
 
  Any thoughts?  I understand that this is rather poor timing, given the
  number of added plspaln to language X bindings Subversion commits
  there have been recently.  This has unfortunately been my first chance
  to dig in to this section of code and see how it works.
 
 I couldn't get the above link to work for me so I am having some trouble
 envisaging what you want to do.  Just to confirm I understand what you are
 proposing, will you be calling plscmap1a as an alternative to plscmap1la
 within plspal1 for the discrete case?
 
 Assuming we all agree this is a worthwhile thing to do, now (i.e., before
 our first official release with plspal1) is the time to be changing the API
 rather than after the release.  I would be willing to help you with
 the propagation work so let's not be concerned about that prospect, and
 instead make sure we have the API we want.

I think the idea is to have a single colour representing a range of values 
rather
than having a continuously varying colour map. I can see the practical use for
this. Some comments

1) The current plscmap1 / plscmap1l difference is a rather ugly kludge in my 
   opinion - no doubt for historic reasons. They use two different methods 
   (PLINT 0-255 and PLFLT 0.0-1.0) for specifying RGB values. This makes it
   slightly more complicated than just calling plscmap1 rather than plscmap1l.

2) You can fudge what you want by using a suitable palette with 2 control points
   close together spanning the colour boundaries to allow a rapid change in 
colour
   and two identical colour points to span the range, e.g. 

   pos = [0.0, 0.4999, 0.5001, 1.0]
   {red, green, blue} = [0.0, 0.0, 1.0, 1.0]

   would give 2 bands with black / white colours. I realise this is not perfect.

Having said both of these, I can see the use of something like this and as Alan 
said
now is the time to decide before we release with the new plscmap1 API. 
Propagating
changes is not a big problem since this is a relatively straightfoward function 
and
only a simple modification to the API.

Andrew

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Loading segmented color scales with plspal1

2009-08-19 Thread Hezekiah M. Carty
On Wed, Aug 19, 2009 at 7:16 PM, Hezekiah M.
Cartyhezekiahca...@users.sourceforge.net wrote:
 On Wed, Aug 19, 2009 at 6:28 PM, Hezekiah M.
 Cartyhezekiahca...@users.sourceforge.net wrote:
 On Wed, Aug 19, 2009 at 4:55 PM, Andrew
 Rossandrewr...@users.sourceforge.net wrote:
 Having said both of these, I can see the use of something like this and as 
 Alan said
 now is the time to decide before we release with the new plscmap1 API. 
 Propagating
 changes is not a big problem since this is a relatively straightfoward 
 function and
 only a simple modification to the API.

 Sounds good.  I will make the change and commit it.

 Done for C as commit 10302, and OCaml as commit 10303.

The attached patch should update the plspal1 binding for all of the
other languages except Fortran 77 and Fortran 90.  I don't have the
prerequisites for most of the other language bindings installed on my
system, so this patch is unfortunately not tested.  F77 and F90 are
left out as I am uncertain how to handle them.

I have not updated the example 16s of the languages other than C and
OCaml as I do now know how the PLBOOL - language booleans are handled
for each of them.  If this information is readily available I would be
happy to assist in those changes as well.

I will work to track down the language bindings dependencies issues on
my system in the mean time.

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science
diff --git a/bindings/c++/plstream.cc b/bindings/c++/plstream.cc
index 3dedcbc..65efa22 100644
--- a/bindings/c++/plstream.cc
+++ b/bindings/c++/plstream.cc
@@ -1890,11 +1890,11 @@ void plstream::spal0(const char *filename)
 
 /* Set the colors for color table 1 from a cmap1 file */
 
-void plstream::spal1(const char *filename)
+void plstream::spal1(const char *filename, bool interpolate)
 {
   set_stream();
 
-  plspal1(filename);
+  plspal1(filename, (PLBOOL) interpolate);
 }
 
 /* Set the pause (on end-of-page) status */
diff --git a/bindings/d/plplot.d b/bindings/d/plplot.d
index ecfb9f3..5f6211f 100644
--- a/bindings/d/plplot.d
+++ b/bindings/d/plplot.d
@@ -451,9 +451,9 @@ void plspal0(string filename)
 }
 
 /* Set the colors for color table 1 from a cmap1 file */
-void plspal1(string filename)
+void plspal1(string filename, PLBOOL interpolate)
 {
-	c_plspal1(toStringz(filename));
+	c_plspal1(toStringz(filename), interpolate);
 }
 
 /* Set color map 0 colors by 8 bit RGB values */
@@ -1903,7 +1903,7 @@ void c_plspage(PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, PLINT xoff, PLINT y
 void c_plspal0(char* filename);
 
 /* Set the colors for color table 1 from a cmap1 file */
-void c_plspal1(char *filename);
+void c_plspal1(char *filename, PLBOOL interpolate);
 
 /* Set the pause (on end-of-page) status */
 void c_plspause(PLBOOL pause);
diff --git a/bindings/java/PLStream.java b/bindings/java/PLStream.java
index d80c1d5..009aae5 100644
--- a/bindings/java/PLStream.java
+++ b/bindings/java/PLStream.java
@@ -803,9 +803,9 @@ public void spal0(String filename) {
 plplotjavac.plspal0(filename);
 }
 
-public void spal1(String filename) {
+public void spal1(String filename, boolean interpolate) {
 if (set_stream() == -1) return;
-plplotjavac.plspal1(filename);
+plplotjavac.plspal1(filename, interpolate);
 }
 
 public void spause(boolean pause) {
diff --git a/bindings/octave/plplot_octave.h.in b/bindings/octave/plplot_octave.h.in
index 0967cf1..ea7ae64 100644
--- a/bindings/octave/plplot_octave.h.in
+++ b/bindings/octave/plplot_octave.h.in
@@ -1394,7 +1394,7 @@ void c_plspage(PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng,
 
 /* Set the colors for color table 1 from a cmap1 file */
 
-void c_plspal1(const char *filename); //%name plspal1
+void c_plspal1(const char *filename, PLBOOL interpolate); //%name plspal1
 
 /* Set the pause (on end-of-page) status */
 
diff --git a/bindings/swig-support/plplotcapi.i b/bindings/swig-support/plplotcapi.i
index 53647f2..9c9c2c2 100644
--- a/bindings/swig-support/plplotcapi.i
+++ b/bindings/swig-support/plplotcapi.i
@@ -799,7 +799,7 @@ plspal0(const char *filename);
 
 %feature(autodoc, Set the color map 1 colors using a cmap1 color palette file.) plspal1;
 void
-plspal1(const char *filename);
+plspal1(const char *filename, PLBOOL interpolate);
 
 %feature(autodoc, Set the pause (on end-of-page) status.) plspause;
 void
diff --git a/bindings/tcl/plapi.tpl b/bindings/tcl/plapi.tpl
index 20c3213..edf9013 100644
--- a/bindings/tcl/plapi.tpl
+++ b/bindings/tcl/plapi.tpl
@@ -878,6 +878,7 @@ filename	const char *
 
 pltclcmd plspal1 void
 filename	const char *
+interpolate	PLINT
 
 # Set the pause (on end-of-page) status.
 
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover