function strRGB(r,g,b){ var r = Math.round(r).toString(16); var g = Math.round(g).toString(16); var b = Math.round(b).toString(16); if(r.length<2) r = '0'+r; if(g.length<2) g = '0'+g; if(b.length<2) b = '0'+b; return ('#'+r+g+b).toUpperCase(); } function getRGBwind(x) { var r=255,g=255,b=255; if(x<0){return strRGB(r,g,b);} else if(x<=5){return strRGB(255,255,255 );} else if(x<=8.9){return strRGB(255+((x-(5))/3.9)*-152,255+((x-(5))/3.9)*-8,255+((x-(5))/3.9)*-14 );} else if(x<=13.5){return strRGB(103+((x-(8.9))/4.6)*-103,247+((x-(8.9))/4.6)*8,241+((x-(8.9))/4.6)*-241 );} else if(x<=18.8){return strRGB(0+((x-(13.5))/5.3)*255,255+((x-(13.5))/5.3)*-15,0 );} else if(x<=24.7){return strRGB(255,240+((x-(18.8))/5.9)*-190,0+((x-(18.8))/5.9)*44 );} else if(x<=31.7){return strRGB(255,50+((x-(24.7))/7)*-40,44+((x-(24.7))/7)*156 );} else if(x<=38){return strRGB(255,10+((x-(31.7))/6.3)*-10,200+((x-(31.7))/6.3)*55 );} else if(x<=45){return strRGB(255+((x-(38))/7)*-105,0+((x-(38))/7)*50,255 );} else if(x<=60){return strRGB(150+((x-(45))/15)*-90,50+((x-(45))/15)*10,255 );} else {return strRGB(60,60,255);} } function getRGBtemp(x) { var r=80,g=255,b=220; if(x<-25){return strRGB(r,g,b);} else if(x<=-15){return strRGB(80+((x-(-25))/10)*91,255+((x-(-25))/10)*-65,220+((x-(-25))/10)*35 );} else if(x<=0){return strRGB(171+((x-(-15))/15)*84,190+((x-(-15))/15)*65,255 );} else if(x<=10){return strRGB(255,255,255+((x-(0))/10)*-155 );} else if(x<=20){return strRGB(255,255+((x-(10))/10)*-85,100+((x-(10))/10)*-100 );} else if(x<=30){return strRGB(255,170+((x-(20))/10)*-120,0+((x-(20))/10)*50 );} else if(x<=35){return strRGB(255,50+((x-(30))/5)*-50,50+((x-(30))/5)*60 );} else if(x<=40){return strRGB(255,0,110+((x-(35))/5)*50 );} else {return strRGB(255,0,160);} } function getRGBcloud(x) { var r=255,g=255,b=255; if(x<0){return strRGB(r,g,b);} else if(x<=100){return strRGB(255+((x-(0))/100)*-120,255+((x-(0))/100)*-120,255+((x-(0))/100)*-120 );} else {return strRGB(135,135,135);} } function getRGBprecip(x) { var r=255,g=255,b=255; if(x<0){return strRGB(r,g,b);} else if(x<=9){return strRGB(255+((x-(0))/9)*-140,255+((x-(0))/9)*-140,255 );} else {return strRGB(115,115,255);} } function getRGBprecip1(x) { var r=255,g=255,b=255; if(x<0){return strRGB(r,g,b);} else if(x<=3){return strRGB(255+((x-(0))/3)*-140,255+((x-(0))/3)*-140,255 );} else {return strRGB(115,115,255);} } function getRGBhtsgw(x) { var r=255,g=255,b=255; if(x<0){return strRGB(r,g,b);} else if(x<=0.3){return strRGB(255,255,255 );} else if(x<=5){return strRGB(255+((x-(0.3))/4.7)*-165,255+((x-(0.3))/4.7)*-165,255 );} else if(x<=10){return strRGB(90+((x-(5))/5)*-50,90+((x-(5))/5)*-50,255+((x-(5))/5)*-55 );} else {return strRGB(40,40,200);} } function getRGBperpw(x) { var r=255,g=255,b=255; if(x<0){return strRGB(r,g,b);} else {return strRGB(255,255,255);} }