
//******************************************************************************
//
// Product definition section for Vertically Integrated Ice. Gives the name for
//   it followed by a full definition of the data being generated (the Category).
//

Product
 {
  Name = "VII"		// Unique name for product

  Category
   {
    Missing = 0		// physical value for ND
    Minimum = 0		// category minimum value
    Maximum = 100		// category maximum value
    Units   = "VII"

    ColorTable		// color table for category
     {
      Units    = "VII"
      Step     = 5

      Color[40   ] =           rgb( 255, 255, 255 )
      Color[21.30] =           rgb( 110,   0, 210 )
      Color[17.00] =           rgb(  80,   0, 200 )					// purple gradient
      Color[12.21] = gradient( rgb( 250,   0, 255 ), rgb(  90,   0, 202 ) )	// blue gradient
      Color[ 9.33] = gradient( rgb( 248,  26,  16 ), rgb( 106,   6,   4 ) )	// red gradient
      Color[ 6.33] = gradient( rgb( 250, 255,  16 ), rgb(  28, 158,   0 ) )	// yellow/green gradient
      Color[ 3.33] = gradient( rgb(  77, 255, 255 ), rgb(  58,   0, 255 ) )	// cyan/blue gradient
      Color[ 0   ] = gradient( rgb(  50,  50,  50 ), rgb( 190, 190, 190 ) )	// gray gradient
     }

   }

 }


//******************************************************************************
//
// Radar shader for VII. Uses the enumerate levels statement to walk upwards
//   through the tilts of BR, accumulating VII along the way. The return
//   statement applies the ugly scaling constant for VII. It also divides by
//   1000 to convert from grams to kilograms in the final output.
//

Program
 {
  float vii;


  vii = 0;										// initialize sum to zero

  enumerate levels from HGTfromTEMP( -10 ) to HGTfromTEMP( -40 )	// enumerate data heights from -10C to -40C
   {
    float z;
    z = pow( 10, BRfromHGT( level.height ) / 10 );			// sample BR and convert from dbz to z
    vii += pow( z, 4 / 7 ) * level.depth;					// integration step
   }

  return 0.006073394 / 1000 * vii;   					// apply messy constant, divide by 1000 to get kg
 }

