var type_color = []; type_color['ECONET'] = 'rgb(217, 4, 0)|white'; type_color['ASOS'] = 'rgb(35, 100, 0)|White'; type_color['AWOS'] = 'rgb(80, 0, 0)|white'; type_color['BUOY'] = 'rgb(0, 0, 255)|white'; type_color['RAWS'] = 'rgb(200, 0, 200)|white'; type_color['USCRN'] = 'rgb(255, 255, 255)|black'; type_color['NOS'] = 'rgb(0, 0, 70)|white'; type_color['CMAN'] = 'rgb(0, 255, 0)|black'; type_color['COOP'] = 'rgb(0, 0, 0)|white'; type_color['CoCoRaHS'] = 'rgb(100, 100, 100)|white'; type_color['Experiment'] = 'rgb(100, 0, 100)|white'; // Setup colors for overlays function FormatColors(variable,value){ // Returns an string of bgcolor|fgcolor var color = "rgb(255,255,255)|black"; //if(isNaN(value)) return color; // Have a white background if not number var format; if(variable == "type" || variable == "network"){ //color = type_color[value] if(value == 'ECONET') color = 'rgb(217, 4, 0)|white'; else if(value == 'ASOS') color = 'rgb(35, 100, 0)|White'; else if(value == 'AWOS') color = 'rgb(80, 0, 0)|white'; else if(value == 'BUOY') color = 'rgb(0, 0, 255)|white'; else if(value == 'RAWS') color = 'rgb(200, 0, 200)|white'; else if(value == 'USCRN') color = 'rgb(255, 255, 255)|black'; else if(value == 'NOS') color = 'rgb(0, 0, 70)|white'; else if(value == 'CMAN') color = 'rgb(0, 255, 0)|black'; else if(value == 'COOP') color = 'rgb(0, 0, 0)|white'; else if(value == 'CoCoRaHS') color = 'rgb(100, 100, 100)|white'; else color = 'rgb(100, 0, 100)|white'; //Experiment }else if(variable.substr(variable.length-4,4) == "flag"){ // Flag check if(value.search(/R4/i) > -1) color = "rgb(178, 0, 0)|white"; else if(value.search(/R3/i) > -1) color = "rgb(224, 67, 0)|white"; else if(value.search(/R2/i) > -1) color = "rgb(224, 165, 0)|white"; else if(value.search(/R1/i) > -1) color = "rgb(222, 232, 0)|white"; else if(value.search(/R0/i) > -1) color = "rgb(255, 255, 255)|white"; else if(value.search(/B4/i) > -1) color = "rgb(0, 0, 88)|white"; else if(value.search(/B3/i) > -1) color = "rgb(0, 0, 128)|white"; else if(value.search(/B2/i) > -1) color = "rgb(100, 0, 173)|white"; else if(value.search(/B1/i) > -1) color = "rgb(200, 0, 240)|white"; else if(value.search(/B0/i) > -1) color = "rgb(255, 255, 255)|white"; }else if(variable.substr(variable.length-5,5) == "score"){ // Flag check if(value.search(/QC3/i) > -1) color = "red|white"; else if(value.search(/QC2/i) > -1) color = "orange|white"; else if(value.search(/QC1/i) > -1) color = "yellow|white"; else if(value.search(/QC0/i) > -1) color = "green|white"; else if(value.search(/QC-1/i) > -1) color = "white|white"; // Temp }else if(variable.search(/temp/i) >= 0 || variable == "dew" || variable == "st" || variable == "stavg"){ if(value <= -20) color = "rgb(200, 0, 240)|white"; else if(value <= -15) color = "rgb(111, 0, 240)|white"; else if(value <= -10) color = "rgb(0, 0, 238)|white"; else if(value <= -5) color = "rgb(0, 0, 206)|white"; else if(value <= 0) color = "rgb(0, 0, 173)|white"; else if(value <= 5) color = "rgb(0, 35, 118)|white"; else if(value <= 10) color = "rgb(0, 60, 110)|white"; else if(value <= 15) color = "rgb(0, 85, 106)|white"; else if(value <= 20) color = "rgb(0, 98, 128)|white"; else if(value <= 25) color = "rgb(0, 124, 160)|white"; else if(value <= 30) color = "rgb(0, 156, 178)|white"; else if(value <= 32) color = "rgb(0, 190, 190)|white"; else if(value <= 35) color = "rgb(0, 190, 190)|black"; else if(value <= 40) color = "rgb(0, 208, 120)|black"; else if(value <= 45) color = "rgb(0, 180, 96)|black"; else if(value <= 50) color = "rgb(0, 152, 80)|black"; else if(value <= 55) color = "rgb(0, 138, 66)|black"; else if(value <= 60) color = "rgb(35, 146, 0)|black"; else if(value <= 65) color = "rgb(66, 178, 0)|black"; else if(value <= 70) color = "rgb(104, 205, 0)|black"; else if(value <= 75) color = "rgb(153, 222, 0)|black"; else if(value <= 80) color = "rgb(222, 232, 0)|black"; else if(value <= 85) color = "rgb(224, 212, 0)|black"; else if(value <= 90) color = "rgb(224, 165, 0)|black"; else if(value <= 95) color = "rgb(224, 115, 0)|white"; else if(value <= 100) color = "rgb(224, 67, 0)|white"; else if(value <= 105) color = "rgb(217, 4, 0)|white"; else if(value <= 110) color = "rgb(178, 0, 0)|white"; else if(value <= 115) color = "rgb(128, 0, 0)|white"; else color = "rgb(80, 0, 0)|white"; //120 // Wind }else if(variable == "ws" || variable == "wsavg" || variable == "wsmax" || variable == "gust"){ if(value <= 0) color = "rgb(104, 205, 0)|black"; else if(value <= 5) color = "rgb(153, 222, 0)|black"; else if(value <= 10) color = "rgb(222, 232, 0)|black"; else if(value <= 15) color = "rgb(224, 212, 0)|black"; else if(value <= 20) color = "rgb(224, 165, 0)|black"; else if(value <= 25) color = "rgb(224, 115, 0)|black"; else if(value <= 30) color = "rgb(224, 67, 0)|white"; else if(value <= 35) color = "rgb(217, 4, 0)|white"; else if(value <= 40) color = "rgb(178, 0, 0)|white"; else if(value <= 45) color = "rgb(128, 0, 0)|white"; else if(value <= 50) color = "rgb(80, 0, 0)|white"; else if(value <= 55) color = "rgb(45, 0, 45)|white"; else if(value <= 60) color = "rgb(10, 0, 80)|white"; else color = "rgb(0, 0, 128)|white"; //65 // Humidity }else if(variable == "rh" || variable == "rhavg"){ if(value <= 0) color = "rgb(204, 51, 0)|white"; else if(value <= 5) color = "rgb(223, 101, 0)|black"; else if(value <= 10) color = "rgb(255, 153, 0)|black"; else if(value <= 15) color = "rgb(255, 204, 0)|black"; else if(value <= 20) color = "rgb(255, 255, 0)|black"; else if(value <= 25) color = "rgb(255, 255, 51)|black"; else if(value <= 30) color = "rgb(255, 255, 102)|black"; else if(value <= 35) color = "rgb(255, 255, 153)|black"; else if(value <= 40) color = "rgb(255, 255, 204)|black"; else if(value <= 45) color = "rgb(255, 255, 255)|black"; else if(value <= 50) color = "rgb(255, 255, 255)|black"; else if(value <= 55) color = "rgb(255, 255, 255)|black"; else if(value <= 60) color = "rgb(204, 255, 204)|black"; else if(value <= 65) color = "rgb(153, 222, 153)|black"; else if(value <= 70) color = "rgb(102, 255, 102)|black"; else if(value <= 75) color = "rgb(76, 212, 76)|black"; else if(value <= 80) color = "rgb(51, 255, 51)|black"; else if(value <= 85) color = "rgb(25, 255, 25)|black"; else if(value <= 90) color = "rgb(0, 153, 0)|black"; else if(value <= 95) color = "rgb(0, 102, 0)|black"; else color = "rgb(0, 51, 0)|white"; //100 }else if(variable == "precip"){ // var precip = 0; // if(value == "Trace") precip="Trace"; // else if(value < 10) precip = Math.floor(value); // else precip = Math.min(value,10); // format = ""+precip; // color = precip_color[format]; if(value == 'Trace') color = "rgb(204, 255, 204)|black"; else if(value <= 0.1) color = "rgb(153, 222, 153)|black"; else if(value <= 0.2) color = "rgb(102, 255, 102)|black"; else if(value <= 0.3) color = "rgb(76, 212, 76)|black"; else if(value <= 0.4) color = "rgb(51, 255, 51)|black"; else if(value <= 0.5) color = "rgb(25, 255, 25)|black"; else if(value <= 0.75) color = "rgb(0, 153, 0)|black"; else if(value <= 1) color = "rgb(33, 123, 0)|black"; else if(value <= 1.5) color = "rgb(66, 178, 0)|black"; else if(value <= 2) color = "rgb(104, 205, 0)|black"; else if(value <= 2.5) color = "rgb(153, 222, 0)|black"; else if(value <= 3) color = "rgb(222, 232, 0)|black"; else if(value <= 3.5) color = "rgb(224, 212, 0)|black"; else if(value <= 4) color = "rgb(224, 165, 0)|white"; else if(value <= 4.5) color = "rgb(224, 115, 0)|white"; else if(value <= 5) color = "rgb(224, 67, 0)|white"; else if(value <= 5.5) color = "rgb(217, 4, 0)|white"; else if(value <= 6) color = "rgb(178, 0, 0)|white"; else if(value <= 6.5) color = "rgb(128, 0, 0)|white"; else if(value <= 7) color = "rgb(80, 0, 0)|white"; else if(value <= 7.5) color = "rgb(45, 0, 45)|white"; else if(value <= 8) color = "rgb(10, 0, 80)|white"; else if(value <= 9) color = "rgb(0, 0, 128)|white"; else color = "rgb(0, 0, 88)|white"; //10 } return color; } var hex = []; hex["temp:-20"] = "#0000f0"; hex["temp:-15"] = "#0000f0"; hex["temp:-10"] = "#0000ee"; hex["temp:-5"] = "#0000ce"; hex["temp:0"] = "#0000ad"; hex["temp:5"] = "#002376"; hex["temp:10"] = "#003c6e"; hex["temp:15"] = "#00556a"; hex["temp:20"] = "#006280"; hex["temp:25"] = "#007ca0"; hex["temp:30"] = "#009cb2"; hex["temp:32"] = "#00bebe"; hex["temp:35"] = "#00bebe"; hex["temp:40"] = "#00d078"; hex["temp:45"] = "#00b460"; hex["temp:50"] = "#009850"; hex["temp:55"] = "#008a42"; hex["temp:60"] = "#009200"; hex["temp:65"] = "#00b200"; hex["temp:70"] = "#00cd00"; hex["temp:75"] = "#00de00"; hex["temp:80"] = "#00e800"; hex["temp:85"] = "#00d400"; hex["temp:90"] = "#00a500"; hex["temp:95"] = "#007300"; hex["temp:100"] = "#004300"; hex["temp:105"] = "#000400"; hex["temp:110"] = "#000000"; hex["temp:115"] = "#000000"; hex["temp:120"] = "#000000"; hex["rh:0"] = "#003300"; hex["rh:5"] = "#006500"; hex["rh:10"] = "#009900"; hex["rh:15"] = "#00cc00"; hex["rh:20"] = "#00ff00"; hex["rh:25"] = "#00ff33"; hex["rh:30"] = "#00ff66"; hex["rh:35"] = "#00ff99"; hex["rh:40"] = "#00ffcc"; hex["rh:45"] = "#00ffff"; hex["rh:50"] = "#00ffff"; hex["rh:55"] = "#00ffff"; hex["rh:60"] = "#00ffcc"; hex["rh:65"] = "#00de99"; hex["rh:70"] = "#00ff66"; hex["rh:75"] = "#00d44c"; hex["rh:80"] = "#00ff33"; hex["rh:85"] = "#00ff19"; hex["rh:90"] = "#009900"; hex["rh:95"] = "#006600"; hex["rh:100"] = "#003300"; hex["precip:Trace"] = "#00ffcc"; hex["precip:0.1"] = "#00de99"; hex["precip:0.2"] = "#00ff66"; hex["precip:0.3"] = "#00d44c"; hex["precip:0.4"] = "#00ff33"; hex["precip:0.5"] = "#00ff19"; hex["precip:0.75"] = "#009900"; hex["precip:1"] = "#007b00"; hex["precip:1.5"] = "#00b200"; hex["precip:2"] = "#00cd00"; hex["precip:2.5"] = "#00de00"; hex["precip:3"] = "#00e800"; hex["precip:3.5"] = "#00d400"; hex["precip:4"] = "#00a500"; hex["precip:4.5"] = "#007300"; hex["precip:5"] = "#004300"; hex["precip:5.5"] = "#000400"; hex["precip:6"] = "#000000"; hex["precip:6.5"] = "#000000"; hex["precip:7"] = "#000000"; hex["precip:7.5"] = "#00002d"; hex["precip:8"] = "#000050"; hex["precip:9"] = "#000080"; hex["precip:10"] = "#000058"; hex["ws"] = []; hex["ws:0"] = "#00cd00"; hex["ws:5"] = "#00de00"; hex["ws:10"] = "#00e800"; hex["ws:15"] = "#00d400"; hex["ws:20"] = "#00a500"; hex["ws:25"] = "#007300"; hex["ws:30"] = "#004300"; hex["ws:35"] = "#000400"; hex["ws:40"] = "#000000"; hex["ws:45"] = "#000000"; hex["ws:50"] = "#000000"; hex["ws:55"] = "#00002d"; hex["ws:60"] = "#000050"; hex["ws:65"] = "#000080"; hex["type:ECONET"] = "#000400"; hex["type:ASOS"] = "#006400"; hex["type:AWOS"] = "#000000"; hex["type:BUOY"] = "#0000ff"; hex["type:RAWS"] = "#0000c8"; hex["type:USCRN"] = "#00ffff"; hex["type:NOS"] = "#000046"; hex["type:CMAN"] = "#00ff00"; hex["type:COOP"] = "#000000"; hex["type:CoCoRaHS"] = "#006464"; hex["type:Experiment"] = "#000064"; hex["flag:R4"] = "#000000"; hex["flag:R3"] = "#004300"; hex["flag:R2"] = "#00a500"; hex["flag:R1"] = "#00e800"; hex["flag:R0"] = "#00ffff"; hex["flag:B4"] = "#000058"; hex["flag:B3"] = "#000080"; hex["flag:B2"] = "#0000ad"; hex["flag:B1"] = "#0000f0"; hex["flag:B0"] = "#00ffff";