<p><b>dwj07@fsu.edu</b> 2012-04-06 12:31:50 -0600 (Fri, 06 Apr 2012)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Fixing color bar, so low values are purple and high values are more redish.<br>
        Also, allowing users to specific the min and max values for the color bar.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/tools/mpas_draw/README
===================================================================
--- branches/tools/mpas_draw/README        2012-04-05 18:12:02 UTC (rev 1753)
+++ branches/tools/mpas_draw/README        2012-04-06 18:31:50 UTC (rev 1754)
@@ -38,11 +38,17 @@
                 b: (colorbar)
                         The lowercase b key toggles the color bar scale. 
                         MpasDraw starts with the color bar being scaled on the current slice that is being plotted.
+                        Pressing b cycles between this and coloring based on a user input color bar.
+
+                B: (colorbar)
+                        The uppercase B key toggles another method for the color bar scale. 
+                        MpasDraw starts with the color bar being scaled on the current slice that is being plotted.
                         Pressing b cycles between this and coloring based on all time and vert levels.
                         Coloring on a single slice is faster, but doesn't show global changes.
                         Coloring on all time takes longer to build the scaling range (if number of time steps is large)
                         but the color bar is static. Also, this colorbar only has to be computed once for the entire run of MpasDraw
 
+
                 r: (reset)
                         The lowercase r key resets the plot to the default parameters (for color, timestep, vertical level, position, rotation, and color bar).
 

Modified: branches/tools/mpas_draw/mpas_draw.cpp
===================================================================
--- branches/tools/mpas_draw/mpas_draw.cpp        2012-04-05 18:12:02 UTC (rev 1753)
+++ branches/tools/mpas_draw/mpas_draw.cpp        2012-04-06 18:31:50 UTC (rev 1754)
@@ -138,6 +138,7 @@
 vector&lt;GLfloat&gt; edge_colors;
 
 vector&lt; vector&lt;double&gt; &gt; ranges; // 0 - min, 1 - max
+vector&lt;double&gt; hard_ranges;
 
 vector&lt;GLfloat&gt; region_centers;
 vector&lt;GLfloat&gt; region_lines;
@@ -1131,7 +1132,7 @@
         double max, min;
         vector&lt;double&gt; temp_data;
 
-        if(color_bar = 1){
+        if(color_bar == 2){
                 if(ranges[id].size() == 0){
                         cout &lt;&lt; &quot;Building min-max range for coloring.&quot; &lt;&lt; endl;
                         num_items = netcdf_mpas_field_num_items(filename, id);
@@ -1146,6 +1147,16 @@
                         ranges[id].push_back(max);
                         cout &lt;&lt; &quot;Range build complete.&quot; &lt;&lt; endl;
                 }
+        } else if(color_bar == 1){
+                hard_ranges.clear();
+                cout &lt;&lt; endl;
+                cout &lt;&lt; &quot;Input minimum for color bar:&quot; &lt;&lt; endl;
+                cin &gt;&gt; min;
+                cout &lt;&lt; &quot;Input maximum for color bar:&quot; &lt;&lt; endl;
+                cin &gt;&gt; max;
+
+                hard_ranges.push_back(min);
+                hard_ranges.push_back(max);
         } else {
                 switch(drawing){
                         case 0:
@@ -1672,9 +1683,12 @@
         } else {
                 netcdf_mpas_read_field(filename, cell_field, cell_values, cur_time, cur_level);
 
-                if(color_bar == 1){
+                if(color_bar == 2){
                         min = ranges[cell_field].at(0);
                         max = ranges[cell_field].at(1);
+                } else if (color_bar == 1){
+                        min = hard_ranges.at(0);
+                        max = hard_ranges.at(1);
                 } else {
                         r8vec_min_max(ncells, cell_values, min, max, missing_value);
                 }
@@ -1696,7 +1710,7 @@
                                         h = (cell_values[i] - min)/1.0 * range_factor;
                                 }
 
-                                hsv_to_rgb(h, s, v, r, g, b);
+                                hsv_to_rgb(0.8-h, s, v, r, g, b);
                         }
 
                         for(j = 0; j &lt; o*3; j++){
@@ -1750,9 +1764,12 @@
         } else {
                 netcdf_mpas_read_field(filename, vertex_field, triangle_values, cur_time, cur_level);
 
-                if(color_bar == 1){
+                if(color_bar == 2){
                         max = ranges[vertex_field][0];
                         min = ranges[vertex_field][1];
+                } else if(color_bar == 1) {
+                        min = hard_ranges.at(0);
+                        max = hard_ranges.at(1);
                 } else {
                         r8vec_min_max(nvertices, triangle_values, min, max, missing_value);
                 }
@@ -1771,7 +1788,7 @@
                                         h = (triangle_values[i] - min)/1.0 * range_factor;
                                 }
 
-                                hsv_to_rgb(h, s, v, r, g, b);
+                                hsv_to_rgb(0.8-h, s, v, r, g, b);
                         }
 
                         for(j = 0; j &lt; 3; j++){
@@ -1823,9 +1840,12 @@
         } else {
                 netcdf_mpas_read_field(filename, edge_field, edge_values, cur_time, cur_level);
 
-                if(color_bar == 1){
+                if(color_bar == 2){
                         min = ranges[edge_field][0];
                         max = ranges[edge_field][1];
+                } else if(color_bar == 1) {
+                        min = hard_ranges.at(0);
+                        max = hard_ranges.at(1);
                 } else {
                         r8vec_min_max(nedges, edge_values, min, max, missing_value);
                 }
@@ -1844,7 +1864,7 @@
                                         h = (edge_values[i] - min)/1.0 * range_factor;
                                 }
 
-                                hsv_to_rgb(h, s, v, r, g, b);
+                                hsv_to_rgb(0.8-h, s, v, r, g, b);
                         }
 
                         for(j = 0; j &lt; 6; j++){
@@ -1983,19 +2003,24 @@
                 case KEY_e:
                         projUpDown += 0.1;
                         break;
-                case KEY_b:
-                        color_bar = (color_bar + 1) % 2;
+                case KEY_B:
+                        if(color_bar != 2){
+                                color_bar = 2;
+                        } else {
+                                color_bar = 0;
+                        }
+
                         switch(color_bar){
                                 case 0:
                                         cout &lt;&lt; &quot;Coloring based on current time/vertlevel slice&quot; &lt;&lt; endl;
                                         break;
-                                case 1:
+                                case 2:
                                         cout &lt;&lt; &quot;Coloring base on entire time range&quot; &lt;&lt; endl;
                                         break;
                                 default:
                                         break;
                         }
-                        if(color_bar == 1){
+                        if(color_bar == 2){
                                 switch(drawing){
                                         case 0:
                                                 build_range(vertex_field);
@@ -2015,6 +2040,38 @@
                         }
 
                         break;
+                case KEY_b:
+                        color_bar = (color_bar + 1) % 2;
+                        switch(color_bar){
+                                case 0:
+                                        cout &lt;&lt; &quot;Coloring based on current time/vertlevel slice&quot; &lt;&lt; endl;
+                                        break;
+                                case 1:
+                                        cout &lt;&lt; &quot;Coloring base on hard coded ranges&quot; &lt;&lt; endl;
+                                        break;
+                                default:
+                                        break;
+                        }
+                        if(color_bar == 1){
+                                switch(drawing){
+                                        case 0:
+                                                build_range(vertex_field);
+                                                cout &lt;&lt; &quot; Range of values: Min = &quot; &lt;&lt; hard_ranges.at(0) &lt;&lt; &quot;, Max = &quot; &lt;&lt; hard_ranges.at(1) &lt;&lt; endl;
+                                                break;
+                                        case 1:
+                                                build_range(cell_field);
+                                                cout &lt;&lt; &quot; Range of values: Min = &quot; &lt;&lt; hard_ranges.at(0) &lt;&lt; &quot;, Max = &quot; &lt;&lt; hard_ranges.at(1) &lt;&lt; endl;
+                                                break;
+                                        case 2:
+                                                build_range(edge_field);
+                                                cout &lt;&lt; &quot; Range of values: Min = &quot; &lt;&lt; hard_ranges.at(0) &lt;&lt; &quot;, Max = &quot; &lt;&lt; hard_ranges.at(1) &lt;&lt; endl;
+                                                break;
+                                        default:
+                                                break;
+                                }
+                        }
+
+                        break;
                 case KEY_w:
                         draw_lines = (draw_lines + 1) % 2;
                         break;
@@ -2034,7 +2091,7 @@
                                 case 0:
                                         vertex_field = netcdf_mpas_list_nvertex_fields(filename);
                                         netcdf_mpas_print_field_info(filename, vertex_field);
-                                        if(color_bar == 1){
+                                        if(color_bar == 2){
                                                 build_range(vertex_field);
                                                 cout &lt;&lt; &quot; Range of values: Min = &quot; &lt;&lt; ranges.at(vertex_field).at(0) &lt;&lt; &quot;, Max = &quot; &lt;&lt; ranges.at(vertex_field).at(1) &lt;&lt; endl;
                                         }
@@ -2042,7 +2099,7 @@
                                 case 1:
                                         cell_field = netcdf_mpas_list_ncell_fields(filename);
                                         netcdf_mpas_print_field_info(filename, cell_field);
-                                        if(color_bar == 1){
+                                        if(color_bar == 2){
                                                 build_range(cell_field);
                                                 cout &lt;&lt; &quot; Range of values: Min = &quot; &lt;&lt; ranges.at(cell_field).at(0) &lt;&lt; &quot;, Max = &quot; &lt;&lt; ranges.at(cell_field).at(1) &lt;&lt; endl;
                                         }
@@ -2050,7 +2107,7 @@
                                 case 2:
                                         edge_field = netcdf_mpas_list_nedge_fields(filename);
                                         netcdf_mpas_print_field_info(filename, edge_field);
-                                        if(color_bar == 1){
+                                        if(color_bar == 2){
                                                 build_range(edge_field);
                                                 cout &lt;&lt; &quot; Range of values: Min = &quot; &lt;&lt; ranges.at(edge_field).at(0) &lt;&lt; &quot;, Max = &quot; &lt;&lt; ranges.at(edge_field).at(1) &lt;&lt; endl;
                                         }

</font>
</pre>