'); mywindow.document.close(); // necessary for IE >= 10 mywindow.focus(); // necessary for IE >= 10 mywindow.print(); mywindow.close(); return true; } function initialize(pw) { //browserZoom = window.outerWidth / window.innerWidth; // browserZoom hard coded to 1. on 08/25/2023 (KSL). Yields best downloads. browserZoom = 1.; var pw = pw || false; //$("#green").fitText(0.2); $('#obsTempsChgPointRange').find('.ui-slider-handle').eq(0).text('>'); $('#obsTempsChgPointRange').find('.ui-slider-handle').eq(1).text('<'); if (document.getElementById('droughtMonDateBox')) { var val = document.getElementById('droughtMonDateBox').value; var date = new Date(Date.parse(val.substr(4,2) + "/" + val.substr(6,2) + "/" + val.substr(0,4)) + 2*86400000); //alert(val+" "+val.substr(4,2) + "/" + val.substr(6,2) + "/" + val.substr(0,4)); document.getElementById('droughtMonDate').innerHTML = "Selection Valid: " + val.substr(4,2) + "/" + val.substr(6,2) + "/" + val.substr(0,4) + "   Issued: " + date.f("MM/dd/yyyy"); } if (document.getElementById('NOHRSCDateBox')) { var val = document.getElementById('NOHRSCDateBox').value; document.getElementById('NOHRSCDate').innerHTML = "Selected date: " + val.substr(4,2) + "/" + val.substr(6,2) + "/" + val.substr(0,4); } var boxes = document.getElementsByName("box"); for(var i = 0; i < boxes.length; i++) { //boxes[i].checked = false; } var briefing = "0"; var centerLat = parseFloat(38.02); var centerLon = parseFloat(-120); var zoomLevel = parseInt(6); //var attribution = new ol.control.Attribution({ //label: 'Tiles © ArcGIS' //}); var attribution = 'Tiles © ArcGIS'; //var attributionNM = new ol.control.Attribution({ //label: 'Tiles © The National Map' //}); var attributionNM = 'Tiles © The National Map'; esriTopo = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://server.arcgisonline.com/ArcGIS/rest/services/' + 'World_Topo_Map/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }) topo2 = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://server.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}' //url: 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}' //url: 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }) satBG1 = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://server.arcgisonline.com/ArcGIS/rest/services/' + 'World_Imagery/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }) satBG2 = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://server.arcgisonline.com/ArcGIS/rest/services/' + 'Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}' }), zIndex: 1050 }) satBG3 = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://server.arcgisonline.com/ArcGIS/rest/services/' + 'Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}' }), zIndex: 1051 }) topo3 = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], url: https+'://wtb.maptiles.arcgis.com/arcgis/rest/services/World_Topo_Base/MapServer/tile/{z}/{y}/{x}', crossOrigin: 'anonymous', //url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0, opacity: 0.7 }) citiesLayer = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', //url: 'http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}' //url: 'http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}' url: https+'://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}' }), zIndex: 1050 }) roadsLayer = new ol.layer.Tile({ source: new ol.source.XYZ({ url: https+'://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}', crossOrigin: 'anonymous', }), zIndex: 1049, opacity: 0.8 }); lightGrayLayer = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }); lightGrayCitiesLayer = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}' }), zIndex: 1050 }); shadedRelief = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }); federalLands = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], url: https+'://gis.blm.gov/arcgis/rest/services/lands/BLM_Natl_SMA_Cached_without_PriUnk/MapServer/tile/{z}/{y}/{x}', crossOrigin: 'anonymous', //url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0, //opacity: 0.7 }); federalLandsReference = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], url: https+'://gis.blm.gov/arcgis/rest/services/lands/BLM_Natl_SMA_LimitedScale/MapServer/tile/{z}/{y}/{x}', crossOrigin: 'anonymous', //url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}' }), zIndex: 1050, //opacity: 0.1 }); /* federalLands = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], url: https+'://gis.blm.gov/arcgis/rest/services/lands/BLM_Natl_SMA_LimitedScale/MapServer/tile/{z}/{y}/{x}', //crossOrigin: 'anonymous', //url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0, opacity: 0.7 }) */ /* streetMap = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' + 'World_Street_Map/MapServer/tile/{z}/{y}/{x}' }) }) */ natGeoMap = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://services.arcgisonline.com/ArcGIS/rest/services/' + 'NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }); oceans = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://services.arcgisonline.com/arcgis/rest/services/' + 'Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }); oceansReference = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], crossOrigin: 'anonymous', url: https+'://services.arcgisonline.com/arcgis/rest/services/' + 'Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}' }), zIndex: 1050 }); /* hucs = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attributionNM], //crossOrigin: 'anonymous', url: https+'://basemap.nationalmap.gov/arcgis/rest/services/' + 'USGSHydroCached/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }) */ hucs = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attributionNM], crossOrigin: 'anonymous', url: https+'://basemap.nationalmap.gov/arcgis/rest/services/' + 'USGSTopo/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }); extentRadar = ol.proj.transformExtent([-126, 24, -66, 50], 'EPSG:4326', 'EPSG:3857'); /* hucs = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attributionNM], crossOrigin: 'anonymous', url: https+'://basemap.nationalmap.gov/arcgis/rest/services/nhd/MapServer/tile/{z}/{y}/{x}' }), zIndex: 0 }) */ map = new ol.Map({ target: document.getElementById('map'), controls: ol.control.defaults.defaults().extend([ new ol.control.FullScreen(), new ol.control.ZoomToExtent({label: '', className: 'homeIcon', extent: [-14171628.876147104, 3750616.659747102, -12545048.914238555, 5413886.395232537]}) ]), layers: [topo3,citiesLayer,roadsLayer], //layers: [esriTopo], /* layers: [ new ol.layer.Tile({ source: new ol.source.MapQuest({layer: 'osm'}) //source: new ol.source.TileWMS({ // url: 'http://demo.opengeo.org/geoserver/wms', // params: { // 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR' // } //}) }) ], */ view: new ol.View({ //projection: 'EPSG:4326', center: ol.proj.transform([centerLon, centerLat], 'EPSG:4326', 'EPSG:3857'), //center: [-119.25,38.15], zoom: zoomLevel, constrainResolution: true }) }); markerLayer = new ol.layer.Vector({ source: new ol.source.Vector({}) }); var listener = markerLayer.getSource().on('change', function(e) { layerLoaded = true; console.log('markers loaded'); //if (markerLayer.getSource().getState() == 'ready') { // ol.Observable.unByKey(listener); // //callback(); //} }); //console.log(map.getView()); /* map.getView().on('change:layerGroup',function() { console.log('put cities back on top'); map.removeLayer(citiesLayer); map.addLayer(citiesLayer); }); */ //var select = new ol.interaction.Select(); //map.addInteraction(select); //selectedFeatures = select.getFeatures(); popupDIV = document.getElementById('popup'); popupDIVcontent = document.getElementById('popup-content'); popup = new ol.Overlay({ element: popupDIV, positioning: 'top-center', stopEvent: true, offset: [4,-25], insertFirst: true, autoPan: true }); map.addOverlay(popup); closer = document.getElementById('popup-closer'); /** * Add a click handler to hide the marker popup. * @return {boolean} Don't follow the href. */ closer.onclick = function() { popup.setPosition(undefined); //map.removeOverlay(popup); closer.blur(); return false; }; popupGEODIV = document.getElementById('popupGEO'); popupDIVcontentGEO = document.getElementById('popup-contentGEO'); popupGEO = new ol.Overlay({ element: popupGEODIV, positioning: 'top-center', stopEvent: true, offset: [0,-10], insertFirst: true, //autoPan: true }); map.addOverlay(popupGEO); var closerGEO = document.getElementById('popup-closerGEO'); /** * Add a click handler to hide the geocode popup. * @return {boolean} Don't follow the href. */ closerGEO.onclick = function() { popupGEO.setPosition(undefined); closerGEO.blur(); return false; }; /* map.on('postcompose', function(event) { var canvas = event.context.canvas; context = canvas.getContext('2d'); base_image = new Image(); base_image.src = '/data/icons/logos/google_nws_noaa.png'; base_image.onload = function(){ context.drawImage(base_image, 45, 5); }; }); */ // Default imageBounds for GFE gridded overlays. window.imageBounds = ol.proj.transformExtent([-124.48,32.5,-114.105,43.375],'EPSG:4326','EPSG:3857'); // Unprojected imageBounds for GFE gridded overlays. window.imageBoundsMQCcustom = [-124.48,32.5,-114.105,43.375]; // imageBounds for radar overlay. window.imageBoundsRadar = ol.proj.transformExtent([-127.6203750,27.94249444,-112.5244778,49.50806111],'EPSG:4326','EPSG:3857'); // imageBounds for NOHRSC overlays. window.imageBoundsNOHRSC = ol.proj.transformExtent([-126.25,24.1,-62.25,53.96666667],'EPSG:4326','EPSG:3857'); window.imageBoundsNOHRSC4326 = [-126.25,24.1,-62.25,53.96666667]; var CNRFC = ""; if (CNRFC == "") { toggleOverlay(true, "CNRFC", 'none'); } // unloadMarkers(['all']); var prod = "fcstPointsFcst"; var year = "2024"; var month = "Jul"; var curmo2 = ""; // if (prod == "SWEbasins") { // toggleKML2Area(true,'SWEbasins',0,month,year,'waterResources'); // if (briefing == 0) { // document.getElementById('archiveAreasnow').checked=true; // } // } else if (prod=="hucPrecip") { // if (briefing == 0) { // document.getElementById('archiveAreaprecip').checked=true; // } // } var typeID = "riverReservoir"; var scriptID = "toggleKMLRivFcst"; var productID = "fcstPointsFcst"; var foundProduct = "1"; var setCheckMark = "fcstPointsFcst"; var time = ""; var PNGtypeID = ""; var cursorReadout = ""; var showElev = ""; var useEst = ""; var id2ID = ""; var typeID2 = "wwa"; var scriptID2 = "toggleWWA"; var productID2 = "wwa"; var foundProduct2 = "0"; var setCheckMark2 = ""; var overlays = ["CNRFC","STATES","COUNTIES","HYDROGRAPHY","MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","WFOS","LAKES"]; var overlayValues = ["","","","","","","","","",""]; var overlaysTile = []; var overlayTileValues = []; var filters = ["Elev","QPEPoint","obsTempsPoint","obsTempsChgPoint","SWEPoint","SWEChg","SDPoint","SDChg","waterTempsPoint","peakDates"]; var filterMax = ["-9999","-9999","-9999","-9999","-9999","-9999","-9999","-9999","-9999",""]; var filterMin = ["-9999","-9999","-9999","-9999","-9999","-9999","-9999","-9999","-9999",""]; var typesOpacity = ["riverReservoir","radar","QPE","QPF","obsTemps","fcstTemps","FzLevel","FFG","QPFverif","waterResources","snow","wwa"]; // var opacities = ; var opacity = -1; var controlsDocked = true; var typesAnimate = ["radarrefl","QPE6hr","QPF6hr","QPF24hr","TempObs6hr","MaxTFcstMaxT","MinTFcstMinT","FzLevel6hrObs","FzLevel6hrFcst"]; var animate = ["","","","","","","","",""]; var animateSpeed = ["-1","-1","-1","-1","-1","-1","-1","-1","-1"]; var precipToggle = ""; var obsTempsChgInvert = ""; var origExtent = ""; if (obsTempsChgInvert == "true") { document.getElementById('obsTempsChgInvert').checked = true; document.querySelector('#obsTempsChgPointRange .ui-slider-range').style.backgroundColor = 'white'; document.getElementById('obsTempsChgPointRange').style.backgroundColor = '#1763AB'; $('#obsTempsChgPointRange').find('.ui-slider-handle').eq(0).text('<'); $('#obsTempsChgPointRange').find('.ui-slider-handle').eq(1).text('>'); } if (precipToggle == "precipDots") { document.getElementById('precipDots').checked = true; } var cat = ["","","","","","",""]; if (id2ID != '') { if (document.getElementById(id2ID) && (id2ID == productID || (id2ID == productID2))) { window.id2 = id2ID; } } else { window.id2 = id2ID; } /* for (var i = 0; i < typesOpacity.length; i++) { var type = typesOpacity[i]; //alert(overlay+" " +overlayValues[i]); if (opacities[i] > -1 && opacities[i] <= 100) { $('#'+type+'slider').slider('value',opacities[i]); } } */ if (opacity > -1 && opacity <= 100) { $('#imageslider').slider('value',opacity); } if (controlsDocked == false && 0 == 0 ) { toggleDataControls(); } for (var i = 0; i < typesAnimate.length; i++) { var type = typesAnimate[i]; //alert(overlay+" " +overlayValues[i]); if (document.getElementById(type+'Animate')) { if (animate[i] == "true") { document.getElementById(type+'Animate').checked = true; } else if (animate[i] == "false") { document.getElementById(type+'Animate').checked = false; } } if (animateSpeed[i] > -2000 && animateSpeed[i] <= -100) { $('#'+type+'speed').slider('value',animateSpeed[i]); PNGanimateSpeed[type]= -1*animateSpeed[i]; } } for (var i = 0; i < overlays.length; i++) { var overlay = overlays[i]; //alert(overlay+" " +overlayValues[i]); if (overlayValues[i] == "true") { document.getElementById(overlay).checked = true; toggleOverlay(true,overlay,'none'); } if (overlayValues[i] == "false") { document.getElementById(overlay).checked = false; toggleOverlay(false,overlay,'none'); } } for (var i = 0; i < overlaysTile.length; i++) { var overlay = overlaysTile[i]; //console.log(overlay+" " +overlayTileValues[i]); if (overlayTileValues[i] == "true") { document.getElementById(overlay).checked = true; toggleTile(true,overlay,'none'); } if (overlayValues[i] == "false") { document.getElementById(overlay).checked = false; toggleTile(false,overlay,'none'); } } for (var i = 0; i < filters.length; i++) { var filter = filters[i]; var filterMaxName = filter+"Max"; var filterMinName = filter+"Min"; var countFilters = 0; //alert("length "+filters.length+" filter "+filter+" Max "+filterMax[i]+" Exists: "+document.getElementById(filterMaxName)+" Max: "+filterMax[i]); if (document.getElementById(filterMaxName) && filterMax[i] != -9999 && filterMax[i] != "") { document.getElementById(filterMaxName).value = filterMax[i]; countFilters++; } if (document.getElementById(filterMinName) && filterMin[i] != -9999 && filterMin[i] != "") { document.getElementById(filterMinName).value = filterMin[i]; countFilters++; } if (countFilters > 0) { document.getElementById(filter+"Apply").click(); } } //alert(foundProduct); if (foundProduct == 1) { manageFilters(true,productID); for (var i = 0; i < cat.length; i++) { cat2 = cat[i]; j=i+1; if (document.getElementById('cat'+j)) { if (cat2 == "true") { document.getElementById('cat'+j).checked = true; } else if (cat2 == "false") { document.getElementById('cat'+j).checked = false; } } } if (document.getElementById('cursorReadout')) { document.getElementById('cursorReadout').checked = true; } if (document.getElementById('showElev')) { if (showElev != "false") { document.getElementById('showElev').checked = true; } } if (document.getElementById('useEst')) { if (useEst == "true") { document.getElementById('useEst').checked = true; } else if (useEst == "false") { document.getElementById('useEst').checked = false; } } if (document.getElementById(setCheckMark)) { document.getElementById(setCheckMark).checked = true; } //alert(setCheckMark); //Start product window.imageType = productID; if (scriptID=="toggleKMLRivFcst") { if(productID.substr(0,4) == "fcst") { window[scriptID](true,productID,0.0,typeID,'fcst'); } else { window[scriptID](true,productID,0.0,typeID,'other'); } } else if (scriptID=="toggleKMLRivFcst2") { window[scriptID](true,productID,0.0,typeID,'fcst'); } else if (scriptID=="toggleKML1" || scriptID=="toggleKML2" || scriptID=="toggleKML3") { window[scriptID](true,productID,-30.0,typeID); } else if (scriptID=="toggleKML2Area") { if (briefing == "1") { window['loadKML1Area'](true,productID,month,year,'waterResources'); } else { window[scriptID](true, productID, 0, document.getElementById('month'+typeID).value,document.getElementById('year'+typeID).value, typeID); } } else if (scriptID=="toggleKML2AreaDaily") { if (briefing == "1") { window['loadKML1Area'](true,productID,month,year,'waterResources'); } else { window[scriptID](true, productID, 0, document.getElementById('month'+typeID).value,document.getElementById('year'+typeID).value, typeID, false, document.getElementById('day'+typeID).value); } } else if (scriptID=="toggleOverlay") { window[scriptID](true,productID,typeID); } else if (scriptID=="togglePNG") { window[scriptID](PNGtypeID,true,time,productID); } else if (scriptID=="toggleWWA" || scriptID=="toggleTile") { window[scriptID](true,productID,typeID); } else if (scriptID == "whichPlottingFunction") { window[scriptID](true,productID,0,document.getElementById('month'+typeID).value,document.getElementById('year'+typeID).value,typeID); } } //Start product2 if (foundProduct2 == 1) { window.imageType = productID2; manageFilters(true,productID2); //alert(setCheckMark2); if (document.getElementById(setCheckMark2)) { document.getElementById(setCheckMark2).checked = true; } if (scriptID2=="toggleKMLRivFcst") { if(productID2.substr(0,4) == "fcst") { window[scriptID2](true,productID2,0.0,typeID2,'fcst'); } else { window[scriptID2](true,productID2,0.0,typeID2,'other'); } } else if (scriptID2=="toggleKMLRivFcst2") { window[scriptID2](true,productID2,0.0,typeID2,'fcst'); } else if (scriptID2=="toggleKML1" || scriptID2=="toggleKML2" || scriptID2=="toggleKML3") { window[scriptID2](true,productID2,-30.0,typeID2); } else if (scriptID2=="toggleKML2Area") { if (briefing == "1") { window['loadKML1Area'](true,productID2,month,year,typeID2); } else { window[scriptID2](true, productID2, 0, document.getElementById('month'+typeID2).value,document.getElementById('year'+typeID2).value, typeID2); } } else if (scriptID2=="toggleKML2AreaDaily") { if (briefing == "1") { window['loadKML1Area'](true,productID2,month,year,typeID2); } else { window[scriptID2](true, productID2, 0, document.getElementById('month'+typeID2).value,document.getElementById('year'+typeID2).value, typeID2,false,document.getElementById('day'+typeID2).value); } } else if (scriptID2=="toggleOverlay") { window[scriptID2](true,productID2,typeID2); } else if (scriptID2=="togglePNG") { window[scriptID2](PNGtypeID,true,time,productID2); } else if (scriptID2=="toggleWWA" || scriptID2=="toggleTile") { window[scriptID2](true,productID2,typeID2); } else if (scriptID2 == "whichPlottingFunction") { window[scriptID2](true,productID2,0,document.getElementById('month'+typeID2).value,document.getElementById('year'+typeID2).value,typeID2); console.log(document.getElementById('month'+typeID2).value + "/" + document.getElementById('year'+typeID2).value); } } if (briefing == "0") { loadStns(); } prevZoom = parseInt(map.getView().getZoom()); if (briefing == "1") { map.getView().on('change:resolution',function() { if (!markersLoaded) { return; } var newLevel = parseInt(map.getView().getZoom()); oldLevel = prevZoom; prevZoom = newLevel; //alert("Zoom was changed from "+oldLevel+ " to "+newLevel+"!"); var mode = $('#loadMode').val(); //abc123 //console.log(mode + " " + oldLevel + " " + newLevel + " " + neverZoomed); if (mode == "default" && ((oldLevel <=7 && newLevel >=8) || (neverZoomed == 1 && newLevel >=8))) { //alert('switching to percentages'); if (markerTypes && markerTypes.length) { unloadMarkers(['all'],true,false); loadMarkers(window.textRes2,true); } //document["legend1"].src = legendAltSrc; } else if (oldLevel >=8 && newLevel <=7 && mode == "default") { //alert('switching to dots'); if (markerTypes && markerTypes.length) { unloadMarkers(['all'],true,true); loadMarkers(window.textRes2); } //document["legend1"].src = legendSrc; } neverZoomed = 0; }); //End zoom_change } loadedFirstTime = 0; map.once('postcompose',function(event) { if (loadedFirstTime) { return; } //console.log('tiles loaded'); loadedFirstTime = 1; var mapBG = "topo3"; if (mapBG != "topo3") { toggleMapBG(mapBG); } /* var MapOptions = ""; document.getElementById('MapOptionsLbl').style.display = 'inline'; document.getElementById('MapOptions').style.display = 'inline'; if (MapOptions == "false") { document.getElementById('MapOptions').value = false; toggleMap("false"); } */ var mode = ""; var product = "fcstPointsFcst"; ; var zoomLevel = parseInt(map.getView().getZoom()); var len = markersList.length; if (briefing == "0") { updateTextMaster(); window.setInterval(function(){updateTextMaster()},timeRefreshInterval); } else { document.getElementById('loadMode').value = mode; if (product != "SWENOHRSC" && product != "SWE7DayChange" && product != "SWE0" && product.substr(0,3) != "huc" && product.substr(0,4) != "peak" && product.substr(0,9) != "SWEbasins") { document.getElementById('loadModeLbl').style.display = 'inline'; document.getElementById('loadMode').style.display = 'inline'; } } if (0) { findSelected(); //clickDataType(4); if (0) { prod = 'ForecastFlow'; if ($('#' + prod)) { $('#' + prod).click(); } } else { if ($('#ForecastFlow')) { $('#ForecastFlow').click(); } } } if (pw) { toggleKML1(true, "gpsIPW", 0,"PW",150) } }); //test = new ol.maps.GroundOverlay("/new.png",window.imageBounds); //test.setMap(gmap); //test.setOpacity(0.65); dataCheckClick(); /* console.log(map.getView().on.getProperties); */ /* map.getView().on('change:resolution',function() { //console.log("Let's count some points, shall we?"); //console.log(map.getView().calculateExtent(map.getSize())); var featuresinBox = []; markerLayer.getSource().forEachFeature(function(e) { if (ol.extent.containsCoordinate(map.getView().calculateExtent(map.getSize()), e.getGeometry().getCoordinates())) { featuresinBox.push(e); } }); console.log("Hey, I found "+featuresinBox.length+" points on the map!!"); }); */ /* map.on('moveend',function() { //console.log("Let's count some points, shall we?"); //console.log(map.getView().calculateExtent(map.getSize())); var featuresinBox = []; if (markerLayer && checkLayer(markerLayer)) { markerLayer.getSource().forEachFeature(function(e) { if (ol.extent.containsCoordinate(map.getView().calculateExtent(map.getSize()), e.getGeometry().getCoordinates())) { featuresinBox.push(e); } }); console.log("Hey, I found "+featuresinBox.length+" points on the map!!"); } }); */ map.on('postrender',function() { if (!highlighted) { markerCount() } checkPostRender(); }); function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } origExtent = map.getView().calculateExtent(); function onMoveEnd(evt){ if (document.getElementById('wwa').checked) { drawWWALegend(); } } map.on('moveend', onMoveEnd); /* map.getView().on('change:center',function() { //console.log("Let's count some points, shall we?"); //console.log(map.getView().calculateExtent(map.getSize())); var featuresinBox = []; markerLayer.getSource().forEachFeature(function(e) { if (ol.extent.containsCoordinate(map.getView().calculateExtent(map.getSize()), e.getGeometry().getCoordinates())) { featuresinBox.push(e); } }); console.log("Hey, I found "+featuresinBox.length+" points on the map!!"); }); */ /**/ var dataTable = "false"; if (dataTable == "true") { $("#markerTable").dialog("open"); } } var images = new Array(); //var imagesIn = new Array('/data/icons/homeIconHover.png'); //preload(imagesIn); function checkLayer(layer) { var res = false; for (var i=0;i= 10.0) { cat = '19'; } } else if (colorScale == 40) { if (amt < 0.1) { cat = '0'; } else if (amt < 0.25) { cat = '1'; } else if (amt < 0.5) { cat = '2'; } else if (amt < 1.0) { cat = '3'; } else if (amt < 1.5) { cat = '4'; } else if (amt < 2.0) { cat = '5'; } else if (amt < 3.0) { cat = '6'; } else if (amt < 4.0) { cat = '7'; } else if (amt < 6.0) { cat = '8'; } else if (amt < 8.0) { cat = '9'; } else if (amt < 10.0) { cat = '10'; } else if (amt < 12.0) { cat = '11'; } else if (amt < 14.0) { cat = '12'; } else if (amt < 17.0) { cat = '13'; } else if (amt < 20.0) { cat = '14'; } else if (amt < 25.0) { cat = '15'; } else if (amt < 30.0) { cat = '16'; } else if (amt < 35.0) { cat = '17'; } else if (amt < 40.0) { cat = '18'; } else if (amt >= 40.0) { cat = '19'; } } else if (colorScale == 100) { if (amt < 0.5) { cat = '0'; } else if (amt < 1.0) { cat = '1'; } else if (amt < 2.0) { cat = '2'; } else if (amt < 4.0) { cat = '3'; } else if (amt < 6.0) { cat = '4'; } else if (amt < 9.0) { cat = '5'; } else if (amt < 12.0) { cat = '6'; } else if (amt < 16.0) { cat = '7'; } else if (amt < 20.0) { cat = '8'; } else if (amt < 25.0) { cat = '9'; } else if (amt < 30.0) { cat = '10'; } else if (amt < 35.0) { cat = '11'; } else if (amt < 42.0) { cat = '12'; } else if (amt < 50.0) { cat = '13'; } else if (amt < 60.0) { cat = '14'; } else if (amt < 70.0) { cat = '15'; } else if (amt < 80.0) { cat = '16'; } else if (amt < 90.0) { cat = '17'; } else if (amt < 100.0) { cat = '18'; } else if (amt >= 100.0) { cat = '19'; } } if (cat == '0') { bgColor = [255,255,255]; textColor = 'black'; } else if (cat == '1') { bgColor = [226,255,193]; textColor = 'black'; } else if (cat == '2') { bgColor = [182,255,180]; textColor = 'black'; } else if (cat == '3') { bgColor = [94,255,89]; textColor = 'black'; } else if (cat == '4') { bgColor = [111,176,237]; textColor = 'black'; } else if (cat == '5') { bgColor = [147,204,255]; textColor = 'black'; } else if (cat == '6') { bgColor = [131,225,255]; textColor = 'black'; } else if (cat == '7') { bgColor = [131,255,249]; textColor = 'black'; } else if (cat == '8') { bgColor = [194,181,229]; textColor = 'black'; } else if (cat == '9') { bgColor = [200,156,245]; textColor = 'black'; } else if (cat == '10') { bgColor = [247,89,255]; textColor = 'black'; } else if (cat == '11') { bgColor = [255,89,89]; textColor = 'black'; } else if (cat == '12') { bgColor = [255,116,116]; textColor = 'black'; } else if (cat == '13') { bgColor = [255,157,131]; textColor = 'black'; } else if (cat == '14') { bgColor = [255,190,138]; textColor = 'black'; } else if (cat == '15') { bgColor = [255,198,116]; textColor = 'black'; } else if (cat == '16') { bgColor = [255,229,138]; textColor = 'black'; } else if (cat == '17') { bgColor = [255,249,138]; textColor = 'black'; } else if (cat == '18') { bgColor = [255,253,204]; textColor = 'black'; } else if (cat == '19') { bgColor = [0,0,0]; textColor = 'white'; } return {cat:cat,bgColor:bgColor,textColor:textColor}; } function findCategoryPW(amt) { if (amt < 0.25) { bgColor = [177,155,83]; textColor = 'black'; } else if (amt < 0.5) { bgColor = [177,155,83]; textColor = 'black'; } else if (amt < 0.75) { bgColor = [151,134,71]; textColor = 'black'; } else if (amt < 1.0) { bgColor = [132,116,61]; textColor = 'white'; } else if (amt < 1.25) { bgColor = [0,76,0]; textColor = 'white'; } else if (amt < 1.5) { bgColor = [0,126,0]; textColor = 'white'; } else if (amt < 1.75) { bgColor = [0,189,0]; textColor = 'black'; } else if (amt < 2.0) { bgColor = [0,228,0]; textColor = 'black'; } else { bgColor = [0,255,255]; textColor = 'black'; } return {bgColor:bgColor,textColor:textColor}; } function findCategory(amt){ if (amt == "noforecast") { cat = "NA"; } else if (amt < 50) { cat = "cat1"; } else if (amt < 70) { cat = "cat2"; } else if (amt < 90) { cat = "cat3"; } else if (amt < 110) { cat = "cat4"; } else if (amt < 130) { cat = "cat5"; } else if (amt < 150) { cat = "cat6"; } else { cat = "cat7"; } return cat; } function findCategoryPercentNormal(amt){ if (amt == "noforecast") { cat = "NA"; bgColor = [255,255,255]; textColor = 'black'; } else if (amt < 50) { cat = "cat1"; bgColor = [135,24,24]; textColor = 'white'; } else if (amt < 70) { cat = "cat2"; bgColor = [255,0,0]; textColor = 'black'; } else if (amt < 90) { cat = "cat3"; bgColor = [255,164,0]; textColor = 'black'; } else if (amt < 110) { cat = "cat4"; bgColor = [192,255,45]; textColor = 'black'; } else if (amt < 130) { cat = "cat5"; bgColor = [0,196,30]; textColor = 'black'; } else if (amt < 150) { cat = "cat6"; bgColor = [0,255,255]; textColor = 'black'; } else { cat = "cat7"; bgColor = [0,0,213]; textColor = 'white'; } return {cat:cat,bgColor:bgColor,textColor:textColor}; } function findCategoryCapacity(amt){ if (amt < 15) { cat = "cat1"; bgColor = [135,24,24]; textColor = 'white'; } else if (amt < 30) { cat = "cat2"; bgColor = [255,0,0]; textColor = 'black'; } else if (amt < 45) { cat = "cat3"; bgColor = [255,164,0]; textColor = 'black'; } else if (amt < 60) { cat = "cat4"; bgColor = [192,255,45]; textColor = 'black'; } else if (amt < 75) { cat = "cat5"; bgColor = [0,196,30]; textColor = 'black'; } else if (amt < 90) { cat = "cat6"; bgColor = [0,255,255]; textColor = 'black'; } else { cat = "cat7"; bgColor = [0,0,213]; textColor = 'white'; } return {cat:cat,bgColor:bgColor,textColor:textColor}; } function findCategoryTemps(amt){ if (amt < -20) { bgColor = [204,204,255]; } else if (amt < -10) { bgColor = [255,204,255]; } else if (amt < 0) { bgColor = [255,153,255]; } else if (amt < 10) { bgColor = [204,153,255]; } else if (amt < 20) { bgColor = [153,102,204]; } else if (amt < 30) { bgColor = [51,153,255]; } else if (amt < 40) { bgColor = [0,204,204]; } else if (amt < 50) { bgColor = [102,255,255]; } else if (amt < 60) { bgColor = [51,255,153]; } else if (amt < 70) { bgColor = [115,253,66]; } else if (amt < 80) { bgColor = [224,253,66]; } else if (amt < 90) { bgColor = [253,242,66]; } else if (amt < 100) { bgColor = [253,207,66]; } else if (amt < 110) { bgColor = [253,128,66]; } else if (amt < 120) { bgColor = [216,103,103]; } else { bgColor = [255,255,255]; } return {bgColor:bgColor,textColor:'black'}; } function findCategoryTempChg(amt){ if (amt < -35) { bgColor = [204,204,255]; } else if (amt < -30) { bgColor = [255,204,255]; } else if (amt < -25) { bgColor = [255,153,255]; } else if (amt < -20) { bgColor = [204,153,255]; } else if (amt < -15) { bgColor = [153,102,204]; } else if (amt < -10) { bgColor = [51,153,255]; } else if (amt < -5) { bgColor = [0,204,204]; } else if (amt < 0) { bgColor = [102,255,255]; } else if (amt < 5) { bgColor = [51,255,153]; } else if (amt < 10) { bgColor = [115,253,66]; } else if (amt < 15) { bgColor = [224,253,66]; } else if (amt < 20) { bgColor = [253,242,66]; } else if (amt < 25) { bgColor = [253,207,66]; } else if (amt < 30) { bgColor = [253,128,66]; } else if (amt < 35) { bgColor = [216,103,103]; } else { bgColor = [255,255,255]; } return {bgColor:bgColor,textColor:'black'}; } function findCategorySWE(amt){ if (amt < 0.1) { bgColor = [255,255,255]; textColor = 'black'; } else if (amt < 10) { bgColor = [220,255,255]; textColor = 'black'; } else if (amt < 20) { bgColor = [153,255,255]; textColor = 'black'; } else if (amt < 30) { bgColor = [142,210,255]; textColor = 'black'; } else if (amt < 40) { bgColor = [132,181,255]; textColor = 'black'; } else if (amt < 50) { bgColor = [106,120,255]; textColor = 'white'; } else if (amt < 60) { bgColor = [108,71,255]; textColor = 'white'; } else if (amt < 70) { bgColor = [141,25,255]; textColor = 'white'; } else if (amt < 80) { bgColor = [187,0,234]; textColor = 'white'; } else if (amt < 90) { bgColor = [214,0,191]; textColor = 'white'; } else if (amt < 100) { bgColor = [193,0,116]; textColor = 'white'; } else { bgColor = [173,0,50]; textColor = 'white'; } return {bgColor:bgColor,textColor:textColor}; } function findCategorySnowDepth(amt){ if (amt < 0.2) { bgColor = [255,255,255]; textColor = 'black'; } else if (amt < 12) { bgColor = [220,255,255]; textColor = 'black'; } else if (amt < 30) { bgColor = [153,255,255]; textColor = 'black'; } else if (amt < 50) { bgColor = [142,210,255]; textColor = 'black'; } else if (amt < 80) { bgColor = [132,181,255]; textColor = 'black'; } else if (amt < 100) { bgColor = [106,120,255]; textColor = 'white'; } else if (amt < 120) { bgColor = [108,71,255]; textColor = 'white'; } else if (amt < 140) { bgColor = [141,25,255]; textColor = 'white'; } else if (amt < 160) { bgColor = [187,0,234]; textColor = 'white'; } else if (amt < 180) { bgColor = [214,0,191]; textColor = 'white'; } else if (amt < 200) { bgColor = [193,0,116]; textColor = 'white'; } else { bgColor = [173,0,50]; textColor = 'white'; } return {bgColor:bgColor,textColor:textColor}; } function findCategorySWEChg(amt){ if (amt < -20) { bgColor = [204,204,255]; } else if (amt < -10) { bgColor = [255,204,255]; } else if (amt < -5) { bgColor = [255,153,255]; } else if (amt < -2.5) { bgColor = [204,153,255]; } else if (amt < -1.5) { bgColor = [153,102,204]; } else if (amt < -1.0) { bgColor = [51,153,255]; } else if (amt < -0.5) { bgColor = [0,204,204]; } else if (amt < -0.1) { bgColor = [102,255,255]; } else if (amt < 0.1) { bgColor = [255,255,255]; } else if (amt < 0.5) { bgColor = [51,255,153]; } else if (amt < 1.0) { bgColor = [115,253,66]; } else if (amt < 1.5) { bgColor = [224,253,66]; } else if (amt < 2.5) { bgColor = [253,242,66]; } else if (amt < 5) { bgColor = [253,207,66]; } else if (amt < 10) { bgColor = [253,128,66]; } else if (amt < 20) { bgColor = [216,103,103]; } else { bgColor = [204,51,102]; } return {bgColor:bgColor,textColor:'black'}; } function findCategorySnowDepthChg(amt){ if (amt < -100) { bgColor = [204,204,255]; } else if (amt < -50) { bgColor = [255,204,255]; } else if (amt < -25) { bgColor = [255,153,255]; } else if (amt < -15) { bgColor = [204,153,255]; } else if (amt < -10) { bgColor = [153,102,204]; } else if (amt < -5) { bgColor = [51,153,255]; } else if (amt < -2.5) { bgColor = [0,204,204]; } else if (amt < -0.5) { bgColor = [102,255,255]; } else if (amt < 0.5) { bgColor = [255,255,255]; } else if (amt < 2.5) { bgColor = [51,255,153]; } else if (amt < 5.0) { bgColor = [115,253,66]; } else if (amt < 10.0) { bgColor = [224,253,66]; } else if (amt < 15.0) { bgColor = [253,242,66]; } else if (amt < 25) { bgColor = [253,207,66]; } else if (amt < 50) { bgColor = [253,128,66]; } else if (amt < 100) { bgColor = [216,103,103]; } else { bgColor = [204,51,102]; } return {bgColor:bgColor,textColor:'black'}; } function findCategoryWaterTemps(amt){ if (amt < 40) { bgColor = [51,153,255]; } else if (amt < 50) { bgColor = [0,204,204]; } else if (amt < 60) { bgColor = [102,255,255]; } else if (amt < 70) { bgColor = [51,255,153]; } else if (amt < 80) { bgColor = [115,253,66]; } else if (amt < 90) { bgColor = [224,253,66]; } else if (amt < 100) { bgColor = [253,242,66]; } else { bgColor = [253,207,66]; } return {bgColor:bgColor,textColor:'black'}; } function findCategoryDate(amt){ var mon = amt.substring(0,2); if (mon == '04') { bgColor = [102,102,204]; textColor='white'; } else if (mon == '05') { bgColor = [102,204,204]; textColor='black'; } else if (mon == '06') { bgColor = [153,204,102]; textColor='black'; } else if (mon == '07') { bgColor = [255,255,102]; textColor='black'; } else if (mon == '08') { bgColor = [255,153,51]; textColor='black'; } else if (mon == '09') { bgColor = [204,102,102]; textColor='black'; } return {bgColor:bgColor,textColor:textColor}; } function createMarkerBetter(stn,latpoint,lonpoint,html,url,bgColor,textColor,amt,specialZero,suffix,secondary,switchZindex,forceSign,date) { //console.log("BETTER!"); bgColor = bgColor || [255,255,255]; textColor = textColor || 'black'; secondary = secondary || false; amt = amt || 0.0; specialZero = specialZero || false; suffix = suffix || ''; switchZindex = switchZindex || false; forceSign = forceSign || false; date = date || false; id = stn.match(/\([^()]*\)/g).pop().replace(/(\(|\))/g,"").replace(/(^\s+|\s+$)/g,""); var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([lonpoint,latpoint],'EPSG:4326','EPSG:3857')), html: html, //type: 'marker', id: id, stn: stn, amt: amt }); iconFeature.setId(id); var offsetX = 6; var offsetY = -15; var fontSize = '11'; if (amt == 'noforecast') { var zIndexVal = Math.random(); } else { var zIndexVal = Math.abs(amt) * 100 + Math.random(); } if (switchZindex) { zIndexVal = 1000 - zIndexVal; } if (amt == 0.00 && specialZero) { url = '/data/icons/precip_icons/0.00.png' amt = ""; } if (forceSign && amt > 0) { amt = "+" + amt; } if (date) { var mon = amt.substring(0,2); var day = amt.substring(2,4); if (mon == '04') { amt = 'Apr '+day; } else if (mon == '05') { amt = 'May '+day; } else if (mon == '06') { amt = 'Jun '+day; } else if (mon == '07') { amt = 'Jul '+day; } else if (mon == '08') { amt = 'Aug '+day; } else if (mon == '09') { amt = 'Sep '+day; } offsetX = 7; offsetY = -7; fontSize = '10'; } var text = amt+suffix; if (text == 'noforecast%') { text = 'N/A'; } var iconStyle = new ol.style.Style({ text: new ol.style.Text({ text: text, offsetY: offsetY, offsetX: offsetX, font: '900 '+fontSize+'px Roboto', fill: new ol.style.Fill({ color: textColor }), //stroke: new ol.style.Stroke({ // color: 'black' //}) }), image: new ol.style.Icon({ anchor: [0.32, 1.0], anchorXUnits: 'fraction', anchorYUnits: 'fraction', opacity: 1.0, src: url, color: bgColor }), zIndex: zIndexVal }); var iconStyleText = new ol.style.Style({ text: new ol.style.Text({ text: stn.replace(/\/$/, "").split('(').shift(), offsetY: 5, stroke: new ol.style.Stroke({ color: 'white', width: 2 }), }), zIndex: zIndexVal }); iconFeatureText = jQuery.extend(true,new ol.Feature(),iconFeature); iconFeatureText.setStyle(iconStyleText); markerSourceText.addFeature(iconFeatureText); iconFeature.setStyle(iconStyle); iconFeature.set('type','marker'); if (!secondary) { markerSource.addFeature(iconFeature); } else { markerSource2.addFeature(iconFeature); } } function filterWS(file,amt,elev) { var maxElev = parseFloat(document.getElementById('ElevMax').value); var minElev = parseFloat(document.getElementById('ElevMin').value); var proceed = false; if (file == "wsfcst" || file == "flow2dateWY" || file == "espfcst" || file == "espfcstWY" || file.substring(0,11) == "monthlyFlow" || file.substring(0,3) == "PNS" || file.substring(0,3) == "PNM") { if (elev >= minElev && elev <= maxElev) { if (document.getElementById('cat1').checked && amt <=50) { proceed = true; } else if (document.getElementById('cat2').checked && amt >=50 && amt < 70) { proceed = true; } else if (document.getElementById('cat3').checked && amt >=70 && amt < 90) { proceed = true; } else if (document.getElementById('cat4').checked && amt >=90 && amt < 110) { proceed = true; } else if (document.getElementById('cat5').checked && amt >=110 && amt < 130) { proceed = true; } else if (document.getElementById('cat6').checked && amt >=130 && amt < 150) { proceed = true; } else if (document.getElementById('cat7').checked && amt >=150) { proceed = true; } } } else { if (elev >= minElev && elev <= maxElev) { if (document.getElementById('cat1').checked && amt <=50) { proceed = true; } else if (document.getElementById('cat2').checked && amt >=50 && amt < 70) { proceed = true; } else if (document.getElementById('cat3').checked && amt >=70 && amt < 90) { proceed = true; } else if (document.getElementById('cat4').checked && amt >=90 && amt < 110) { proceed = true; } else if (document.getElementById('cat5').checked && amt >=110 && amt < 130) { proceed = true; } else if (document.getElementById('cat6').checked && amt >=130 && amt < 150) { proceed = true; } else if (document.getElementById('cat7').checked && amt >=150) { proceed = true; } } } return proceed; } function pad(num, size) { var s = num+""; while (s.length < size) s = "0" + s; return s; } function createMarker2(stn,latpoint,lonpoint,html,url,zIndex,amt,colorScale){ zIndex = zIndex || false; amt = amt || 0.0; colorScale = colorScale || 'none'; //var img = new Image(); //img.onload = function() { id = stn.match(/\([^()]*\)/g).pop().replace(/(\(|\))/g,"").replace(/(^\s+|\s+$)/g,""); if (colorScale == 'none') { url2 = url; } else if (colorScale == 10) { if (amt < 0.01) { url2 = 'cat1'; } else if (amt < 0.1) { url2 = 'cat2'; } else if (amt < 0.25) { url2 = 'cat3'; } else if (amt < 0.5) { url2 = 'cat4'; } else if (amt < 0.75) { url2 = 'cat5'; } else if (amt < 1.0) { url2 = 'cat6'; } else if (amt < 1.25) { url2 = 'cat7'; } else if (amt < 1.5) { url2 = 'cat8'; } else if (amt < 1.75) { url2 = 'cat9'; } else if (amt < 2.00) { url2 = 'cat10'; } else if (amt < 2.5) { url2 = 'cat11'; } else if (amt < 3.0) { url2 = 'cat12'; } else if (amt < 4.0) { url2 = 'cat13'; } else if (amt < 5.0) { url2 = 'cat14'; } else if (amt < 6.0) { url2 = 'cat15'; } else if (amt < 7.0) { url2 = 'cat16'; } else if (amt < 8.0) { url2 = 'cat17'; } else if (amt < 9.0) { url2 = 'cat18'; } else if (amt < 10.0) { url2 = 'cat19'; } else if (amt >= 10.0) { url2 = 'cat20'; } url2 = "/data/icons/dots2/"+url2+".png"; } else if (colorScale == 40) { if (amt < 0.1) { url2 = 'cat1'; } else if (amt < 0.25) { url2 = 'cat2'; } else if (amt < 0.5) { url2 = 'cat3'; } else if (amt < 1.0) { url2 = 'cat4'; } else if (amt < 1.5) { url2 = 'cat5'; } else if (amt < 2.0) { url2 = 'cat6'; } else if (amt < 3.0) { url2 = 'cat7'; } else if (amt < 4.0) { url2 = 'cat8'; } else if (amt < 6.0) { url2 = 'cat9'; } else if (amt < 8.0) { url2 = 'cat10'; } else if (amt < 10.0) { url2 = 'cat11'; } else if (amt < 12.0) { url2 = 'cat12'; } else if (amt < 14.0) { url2 = 'cat13'; } else if (amt < 17.0) { url2 = 'cat14'; } else if (amt < 20.0) { url2 = 'cat15'; } else if (amt < 25.0) { url2 = 'cat16'; } else if (amt < 30.0) { url2 = 'cat17'; } else if (amt < 35.0) { url2 = 'cat18'; } else if (amt < 40.0) { url2 = 'cat19'; } else if (amt >= 40.0) { url2 = 'cat20'; } url2 = "/data/icons/dots2/"+url2+".png"; } var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([lonpoint,latpoint],'EPSG:4326','EPSG:3857')), html: html, //type: 'marker', id: id, stn: stn, amt: amt }); iconFeature.setId(id); var iconStyle = new ol.style.Style({ image: new ol.style.Icon({ anchor: [0.5, 0.5], anchorXUnits: 'fraction', anchorYUnits: 'fraction', opacity: 1.0, src: url2 }), zIndex: Math.abs(amt) * 100 }); var iconStyleText = new ol.style.Style({ text: new ol.style.Text({ text: stn.replace(/\/$/, "").split('(').shift(), offsetY: 5, stroke: new ol.style.Stroke({ color: 'white', width: 2 }), }), zIndex: Math.abs(amt) * 100 }); iconFeatureText = jQuery.extend(true,new ol.Feature(),iconFeature); iconFeatureText.setStyle(iconStyleText); markerSourceText.addFeature(iconFeatureText); iconFeature.setStyle(iconStyle); iconFeature.set('type','marker'); markerSource.addFeature(iconFeature); } function createMarkerRes(stn,latpoint,lonpoint,html,url,zIndex,file,elev,cat,cap,amt,type,altShape){ zIndex = zIndex || false; altShape = altShape || false; id = stn.match(/\([^()]*\)/g).pop().replace(/(\(|\))/g,"").replace(/(^\s+|\s+$)/g,""); amt = amt || 0.0; // alert(latpoint); color = cat; //"/includes/ol/drawDot.php?r=10&fg=ff0000&bg=ffffff&bw=0&bc=000000" //"/includes/ol/drawDot.php?size=1000" if (color=='cat1') { color = "871818"; colorRBGA = [135,24,24,1.0]; } else if (color == 'cat2') { color = "FF0000"; colorRBGA = [255,0,0,1.0]; } else if (color == 'cat3') { color = "FFA400"; colorRBGA = [255,164,0,1.0]; } else if (color == 'cat4') { color = "C0FF2D"; colorRBGA = [192,255,45,1.0]; } else if (color == 'cat5') { color = "00C41E"; colorRBGA = [0,196,30,1.0]; } else if (color == 'cat6') { color = "00FFFF"; colorRBGA = [0,255,255,1.0]; } else if (color == 'cat7') { color = "0000D5"; colorRBGA = [0,0,213,1.0]; } if (type == 'res') { r1 = cap / 200; r2 = Math.log(1*cap) * 1.5; r = (r1*0.45 + r2+0.55) * 0.6; if (r > 18) { r = 18; } if (r < 5) { r = 5; } } else if (type == 'espfcst') { r1 = cap / 200; r2 = Math.log(1*cap) * 1.5; r = (r1*0.2 + r2+0.8) * 0.85; if (r > 18) { r = 18; } if (r < 5) { r = 5; } } else if (type == 'espfcstWY') { r1 = cap / 200; r2 = Math.log(1*cap) * 1.5; r = (r1*0.2 + r2+0.8) * 0.7; if (r > 18) { r = 18; } if (r < 5) { r = 5; } } else if (type.substring(0,file.indexOf("_")) == 'monthlyFlow') { var cap2 = cap * 4; r1 = cap2 / 200; r2 = Math.log(1*cap2) * 1.5; r = (r1*0.2 + r2+0.8) * 0.7; if (r > 18) { r = 18; } if (r < 5) { r = 5; } } else { r1 = cap / 200; r2 = Math.log(1*cap) * 1.5; r = (r1*0.2 + r2+0.8) * 0.7; if (r > 18) { r = 18; } if (r < 5) { r = 5; } } if (altShape) { urlString = "/includes/ol/drawSquare.php?r="+r+"&fg="+color+"&bg=222222&bw=1&bc=000000&pct="+amt; } else { urlString = "/includes/ol/drawDot.php?r="+r+"&fg="+color+"&bg=222222&bw=2&bc=000000&pct="+amt; } if (zIndex) { var zIndexVar = 100-r; } else { var zIndexVar = Math.abs(amt) * 100; } var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([lonpoint,latpoint],'EPSG:4326','EPSG:3857')), html: html, //type: 'marker', id: id, stn: stn, amt: amt }); iconFeature.setId(id); if (altShape) { var iconStyle = new ol.style.Style({ image: new ol.style.RegularShape({ radius: Math.round(r*1.3), points: 4, rotation: 0.7853981634, stroke: new ol.style.Stroke ({ color: [0,0,0,1.0], width: 2 }), fill: new ol.style.Fill ({ color: colorRBGA }) }), zIndex: zIndexVar }); } else { var iconStyle = new ol.style.Style({ image: new ol.style.Circle({ radius: r, stroke: new ol.style.Stroke ({ color: [0,0,0,1.0], width: 2 }), fill: new ol.style.Fill ({ color: colorRBGA }) }), zIndex: zIndexVar }); } /* var iconStyle = new ol.style.Style({ image: new ol.style.Icon({ anchor: [0.5, 0.5], anchorXUnits: 'fraction', anchorYUnits: 'fraction', opacity: 1.0, src: urlString }), zIndex: zIndexVar }); */ var iconStyleText = new ol.style.Style({ text: new ol.style.Text({ text: stn.replace(/\/$/, "").split('(').shift(), offsetY: 5, stroke: new ol.style.Stroke({ color: 'white', width: 2 }), }), zIndex: zIndexVar }); iconFeatureText = jQuery.extend(true,new ol.Feature(),iconFeature); iconFeatureText.setStyle(iconStyleText); markerSourceText.addFeature(iconFeatureText); iconFeature.setStyle(iconStyle); iconFeature.set('type','marker'); markerSource.addFeature(iconFeature); } function createMarker2hover(stn,data,latpoint,lonpoint,html,url,link2,color,river,location,obs,product){ id = stn.match(/\([^()]*\)/g).pop().replace(/(\(|\))/g,"").replace(/(^\s+|\s+$)/g,""); var product = product || ""; amt = color; var obs = obs || false; var contentString = html; if (obs) { if (color == 'green') { var zIndex = 2001; } else if (color == 'orange') { var zIndex = 2002; } else if (color == 'red') { var zIndex = 2003; } else if (color == 'purple') { var zIndex = 2004; } else { var zIndex = 2000; } } else { if (color == 'green') { var zIndex = 1001; } else if (color == 'orange') { var zIndex = 1002; } else if (color == 'red') { var zIndex = 1003; } else if (color == 'purple') { var zIndex = 1004; } else { var zIndex = 1000; } } var color2 = color; var textColor = "#000000"; if (color=='green') { color2 = "#00FF00"; } else if (color == 'orange') { color2 = "#FF9900"; } else if (color == 'purple') { color2 = "#990066"; var textColor = "#FFFFFF"; } if (data) { data = data.replace(" Ft / ",""); data = data.replace(" cfs ",""); data = data.replace(" Ft / ",""); data = data.replace(" Feet / ",""); data = data.replace(" cfs",""); data = data.replace(" acre-feet",""); data = data.replace("NA","-9999"); data = data.replace("NA","-9999"); } if (id == "CLKC1" && (product == "zeroFCST" || product == "oneFCST" || product == "twoFCST" || product == "threeFCST" || product == "zeroFCSTcombo" || product == "oneFCSTcombo" || product == "twoFCSTcombo" || product == "threeFCSTcombo")) { data = data + " acre-ft"; } idTest=id; if (obs && window.id2.substr(window.id2.length-5)=="combo") { idTest = id+"test"; } var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([lonpoint,latpoint],'EPSG:4326','EPSG:3857')), html: html, river: river, location: location, color: color2, textColor: textColor, link2: link2, // type: 'marker', id: idTest, stn: stn, amt: data }); iconFeature.setId(idTest); // iconFeature.setId(id); var iconStyle = new ol.style.Style({ image: new ol.style.Icon({ anchor: [0.5, 0.5], anchorXUnits: 'fraction', anchorYUnits: 'fraction', opacity: 1.0, src: url }), zIndex: zIndex }); var iconStyleText = new ol.style.Style({ text: new ol.style.Text({ text: stn.replace(/\/$/, "").split('(').shift(), offsetY: 12, stroke: new ol.style.Stroke({ color: 'white', width: 2 }), }), zIndex: zIndex }); iconFeatureText = jQuery.extend(true,new ol.Feature(),iconFeature); iconFeatureText.setStyle(iconStyleText); markerSourceText.addFeature(iconFeatureText); iconFeature.setStyle(iconStyle); iconFeature.set('type','marker'); markerSource.addFeature(iconFeature); } function createMarkerWS(stn,latpoint,lonpoint,html,url,url2,num,file,elev,amt,info,zIndex,secondary){ id = stn.match(/\([^()]*\)/g).pop().replace(/(\(|\))/g,"").replace(/(^\s+|\s+$)/g,""); zIndex = zIndex || false; secondary = secondary || false; var briefing = "0"; //alert('hi'); if (briefing == 0) { var maxElev = parseFloat(document.getElementById('ElevMax').value); var minElev = parseFloat(document.getElementById('ElevMin').value); var proceed = 0; if (file == "wsfcst" || file == "flow2dateWY" || file == "espfcst" || file == "espfcstWY") { if (elev >= minElev && elev <= maxElev) { if (document.getElementById('cat1').checked && amt <50) { proceed = 1; } else if (document.getElementById('cat2').checked && amt >=50 && amt < 70) { proceed = 1; } else if (document.getElementById('cat3').checked && amt >=70 && amt < 90) { proceed = 1; } else if (document.getElementById('cat4').checked && amt >=90 && amt < 110) { proceed = 1; } else if (document.getElementById('cat5').checked && amt >=110 && amt < 130) { proceed = 1; } else if (document.getElementById('cat6').checked && amt >=130 && amt < 150) { proceed = 1; } else if (document.getElementById('cat7').checked && amt >=150) { proceed = 1; } } } else { if (elev >= minElev && elev <= maxElev) { if (document.getElementById('cat1').checked && amt <50) { proceed = 1; } else if (document.getElementById('cat2').checked && amt >=50 && amt < 70) { proceed = 1; } else if (document.getElementById('cat3').checked && amt >=70 && amt < 90) { proceed = 1; } else if (document.getElementById('cat4').checked && amt >=90 && amt < 110) { proceed = 1; } else if (document.getElementById('cat5').checked && amt >=110 && amt < 130) { proceed = 1; } else if (document.getElementById('cat6').checked && amt >=130 && amt < 150) { proceed = 1; } else if (document.getElementById('cat7').checked && amt >=150) { proceed = 1; } } } } else { proceed = 1; } if (proceed == 0) { return 51; } if (num == 1) { var anchor = [0.32, 1.0]; } else { var anchor = [0.5, 0.5]; } /* marker.iconLevel1 = url; marker.iconLevel2 = url2; marker.latpoint = latpoint; marker.lonpoint = lonpoint; marker.info = html; */ var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([lonpoint,latpoint],'EPSG:4326','EPSG:3857')), html: html, //type: 'marker', id: id, stn: stn, amt: amt }); iconFeature.setId(id); var iconStyle = new ol.style.Style({ image: new ol.style.Icon({ anchor: anchor, anchorXUnits: 'fraction', anchorYUnits: 'fraction', opacity: 1.0, src: url }), zIndex: Math.abs(amt) * 100 }); var iconStyleText = new ol.style.Style({ text: new ol.style.Text({ text: stn.replace(/\/$/, "").split('(').shift(), offsetY: 5, stroke: new ol.style.Stroke({ color: 'white', width: 2 }), }), zIndex: Math.abs(amt) * 100 }); iconFeatureText = jQuery.extend(true,new ol.Feature(),iconFeature); iconFeatureText.setStyle(iconStyleText); markerSourceText.addFeature(iconFeatureText); iconFeature.setStyle(iconStyle); iconFeature.set('type','marker'); if (!secondary) { markerSource.addFeature(iconFeature); } else { markerSource2.addFeature(iconFeature); } } var gridID = ""; var gridIDarchive = ""; var gridIDarchive2 = ""; function checkNewName(id) { id = id || ""; // alert("caller is " + arguments.callee.caller.toString()); var briefing = "0"; if (briefing == 1) { return; } //alert("Old name: "+oldName+"\nNew name: "+name2+"\nID: "+id); if (id == "RADARPCPN"){ thisID = "radarrefl"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; //document.getElementById(thisID).click(); disablePNG('radar',false, 'refl', thisID); return; } } if (id == "radarrefl"){ thisID = "RADARPCPN"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disableOverlay(false, thisID, 'precip') return; } } if (id == "radarrefl" || id == "RADARPCPN"){ thisID = "QPE6hr"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('QPE',false, '6hr', thisID); document.getElementById('6hrQPEsection').style.display = 'none'; return; } thisID = "QPE24hr"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('QPE',false, '24hr', thisID); document.getElementById('24hrQPEsection').style.display = 'none'; return; } thisID = "QPE48hr"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('QPE',false, '48hr', thisID); document.getElementById('48hrQPEsection').style.display = 'none'; return; } thisID = "QPE72hr"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('QPE',false, '72hr', thisID); document.getElementById('72hrQPEsection').style.display = 'none'; return; } thisID = "QPE7day"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('QPE',false, '7day', thisID); document.getElementById('7dayQPEsection').style.display = 'none'; return; } thisID = "QPEmonthly"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } thisID = "QPEmonthlyPercentNormal"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } thisID = "QPEmonthlyDeparture"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } thisID = "QPEmonthlyNormal"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } thisID = "QPEWY"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } thisID = "QPEWYPercentNormal"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } thisID = "QPEWYDeparture"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } thisID = "QPEWYNormal"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } thisID = "fgroups"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disablePNG('MQC',false, 'custom', thisID); return; } } //alert(id); if (id.substr(0,3) == "QPE") { thisID = "radarrefl"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; //document.getElementById(thisID).click(); //disablePNG('radar',false, 'refl', thisID); map.removeLayer(tileLayer); return; } thisID = "RADARPCPN"; if (document.getElementById(thisID).checked) { document.getElementById(thisID).checked = false; disableOverlay(false, thisID, 'precip') map.removeLayer(tileLayer); return; } } if ((id=='PPS' || id=='PPM' || id=='PNS' || id=='PNM') && ($('#QPEmonthly').prop("checked") || $('#QPEmonthlyPercentNormal').prop("checked") || $('#QPEmonthlyDeparture').prop("checked") || $('#QPEmonthlyNormal').prop("checked") || $('#QPEWY').prop("checked") || $('#QPEWYPercentNormal').prop("checked") || $('#QPEWYDeparture').prop("checked") || $('#QPEWYNormal').prop("checked") || $('#basinPrecip').prop("checked") || $('#basinPrecipSeasonal').prop("checked") || $('#hucPrecip').prop("checked") || $('#hucPrecipSeasonal').prop("checked") || $('#fgroups').prop("checked"))) { return; } if ((name2 == 'precip' && oldName == 'QPE') || (oldName == 'precip' && name2 == 'QPE') || (name2 == 'precip' && oldName == 'radar') || (oldName == 'precip' && name2 == 'radar')) { //oldName = name2; return; } // return; if (name2 != oldName && name2 != "none") { //alert("clearing now name2: "+name2+ " oldName: "+oldName); popup.setPosition(undefined); clearMap(1,id); clearGages(); clearClimate(); oldName = name2; if (window.updateVar != "") { clearTimeout(window.updateVar); } window.updateVar = ""; if (window.updateVar2 != "") { clearTimeout(window.updateVar2); } window.updateVar2 = ""; } } function toggleOverlay(checked,id,name,fromToggle){ popup.setPosition(undefined); if (id == "RADARPCPN" || id == "droughtMon") { if (window.updateVar2 != "") { clearTimeout(window.updateVar2); } window.updateVar2 = ""; } else { if (window.updateVar != "") { clearTimeout(window.updateVar); } window.updateVar = ""; } name = name.substring(name.indexOf('_')+1); if (name != "none") { name2 = name; } checkNewName(id); if (name != "none") { loadFooter(name); } var briefing = "0"; var overlays = ["CNRFC","STATES","COUNTIES","HYDROGRAPHY","MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","WFOS","LAKES"]; var overlays_clickable = ["MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","LAKES"]; if (briefing == 0) { var count = 0; var allPNGtypes = PNGtypes.concat(PNGtypes2); for(var i=0; i -1) { kml[id].kmlLayer = new ol.layer.Vector({source: new ol.source.Vector({format: new ol.format.KML(),projection: 'EPSG:3857',url: kml[id].url + randString}),opacity:1.0,name: 'HUC',zIndex: 1040}); //loadKMZ(id,kml[id].url,'HUC'); startListener('clickKML'); //clickable true } else if (id == "CNRFC") { kml[id].kmlLayer = new ol.layer.Vector({source: new ol.source.Vector({format: new ol.format.KML(),projection: 'EPSG:3857',url: kml[id].url + randString}),opacity:1.0,zIndex: 1051}); } else if ($.inArray(id,overlays) > -1) { kml[id].kmlLayer = new ol.layer.Vector({source: new ol.source.Vector({format: new ol.format.KML(),projection: 'EPSG:3857',url: kml[id].url + randString}),opacity:1.0,zIndex: 1040}); //loadKMZ(id,kml[id].url); //clickable false } else if (id == "snowNOHRSC" || id == "snowNOHRSCCHG" || id == "snowNOHRSCdepth" || PNGimg[PNGtypeName[window.type11+window.time12]]) { kml[id].kmlLayer = new ol.layer.Vector({source: new ol.source.Vector({format: new ol.format.KML(),projection: 'EPSG:3857',url: kml[id].url + randString}),opacity:1.0,zIndex: 1010}); //loadKMZ(id,kml[id].url); //clickable false } else if (id == "DroughtMonitorArchive") { document.getElementById('gridOptions').style.display = 'block'; if (document.getElementById('DManimate').checked) { var url = kml[id].url + "_" + document.getElementById('droughtMonDateBox').value + ".kml" //clickable false } else { var url = kml[id].url + "_" + document.getElementById('droughtMonDateBox').value + ".kml" //clickable true } console.log("LOADING " + url); kml[id].kmlLayer = new ol.layer.Vector({source: new ol.source.Vector({format: new ol.format.KML(),projection: 'EPSG:3857',url: url}),opacity:opacity,zIndex: 1010}); //loadKMZ(id,url); var val = document.getElementById('droughtMonDateBox').value; var date = new Date(Date.parse(val.substr(4,2) + "/" + val.substr(6,2) + "/" + val.substr(0,4)) + 2*86400000); document.getElementById('droughtMonDate').innerHTML = "Selection Valid: " + val.substr(4,2) + "/" + val.substr(6,2) + "/" + val.substr(0,4) + "   Issued: " + date.f("MM/dd/yyyy"); } else { if (id != 'basinTempPlots') { document.getElementById('gridOptions').style.display = 'block'; } kml[id].kmlLayer = new ol.layer.Vector({source: new ol.source.Vector({format: new ol.format.KML(),projection: 'EPSG:3857',url: kml[id].url + randString}),opacity:opacity,name: 'HUC',zIndex: 1010}); //loadKMZ(id,kml[id].url,'HUC'); startListener('clickKML'); } map.addLayer(kml[id].kmlLayer); imgName = kml[id].url; KMLoverlay[name] = kml[id].kmlLayer; var overlays = ["CNRFC","STATES","COUNTIES","HYDROGRAPHY","MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","WFOS","LAKES"]; if (id == "HYDROGRAPHY") { window.overlayTilesToLoad = 0; window.overlayTilesLoaded = 0; tileOverlaySource.on('tileloadstart',function(event) { ++window.overlayTilesToLoad; }); tileOverlaySource.on('tileloadend',function(event) { ++window.overlayTilesLoaded; if (window.overlayTilesLoaded == window.overlayTilesToLoad) { //console.log('all tiles loaded'); tileOverlaySource.removeEventListener('tileloadstart'); tileOverlaySource.removeEventListener('tileloadend'); loadingOff(); } }); } else if (overlays.indexOf(id) == -1) { if (id != "CNRFC") { kml[id].kmlLayer.getSource().once("change",function() { loadingOff(); //var overlays = ["CNRFC","STATES","COUNTIES","HYDROGRAPHY","MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","WFOS","LAKES"]; //for(var j=0; j'; h = '
'; productName = features[i].get('phenomenon') + " " + features[i].get('significance'); //console.log(productName + " | " + encodeURI(productName)); htm = h + '  ' + productName + '
'; ll[l] = htm; l = l + 1; } } if (features.length == 0) { //alert('none'); } $.each(ll, function(i, el){ if($.inArray(el, lll) === -1) lll.push(el); }); $('#WWAlegend').html(lll); } function updateWWA() { var geojsonFormat = new ol.format.GeoJSON(); $.ajax({ type: "GET", crossDomain: true, url: '/allhazard.geojson?random='+Math.random(), //url: '/allhazardHiRes.geojson?random='+Math.random(), //url: 'https://www.wrh.noaa.gov/map/json/WR_All_Hazards.json?random='+Math.random(), cache: false, dataType: "json", success: function(data) { dataStr = JSON.stringify(data) dataStr = dataStr.replace(/, 0.5/g,", 1.0"); data = JSON.parse(dataStr); var features = geojsonFormat.readFeatures(data, {featureProjection:"EPSG:3857", dataProjection:"EPSG:4326"}); //var features = geojsonFormat.readFeatures(data); markerLayer.getSource().clear(); markerLayer.getSource().addFeatures(features); markerLayer.setOpacity($( "#imageslider" ).slider( "value" )*0.01); drawWWALegend(); } }); } var displayFeatureInfo = function(pixel) { coord = ol.proj.transform(map.getCoordinateFromPixel(pixel), 'EPSG:3857', 'EPSG:4326'); url='https://forecast.weather.gov/MapClick.php?lon='+coord[0]+'&lat='+coord[1]; window.open(url, "_self"); }; var getContrastYIQ = function (color){ var hex = '#'; var r,g,b; if(color.indexOf(hex) > -1){ r = parseInt(color.substr(0,2),16); g = parseInt(color.substr(2,2),16); b = parseInt(color.substr(4,2),16); }else{ color = color.match(/\d+/g); r = color[0]; g = color[1]; b = color[2]; } var yiq = ((r*299)+(g*587)+(b*114))/1000; return (yiq >= 128) ? 'black' : 'white'; } var displayFeatureInfo_hover = function(pixel) { var mapTop = $('#map').offset().top; var mapLeft = $('#map').offset().left; var featureCount = 0; var msg = ""; var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) { if (layer.get('name') == 'wwa') { et = feature.get('end'); if (et == 0) { vt = "Until Further Notice"; } else { vt = getTime(et); } // if (featureCount != 0) { // msg = msg + "
" // } hex = feature.get('color'); hex = hex.slice(1); msg = msg + '
' + feature.get('phenomenon') + " " + feature.get('significance') + '
Expires at: ' + vt + '
'; featureCount = featureCount = 1; } }); if (featureCount > 0) { $("#WWAinfo").html(msg); $("#WWAinfo").css("top", pixel[1]+20+mapTop); $("#WWAinfo").css("left", pixel[0]+0+mapLeft); $("#WWAinfo").show(); } else { $('#WWAinfo').html(); $('#WWAinfo').hide(); } }; var displayFeatureInfo_hover_test = function(pixel) { var mapTop = $('#map').offset().top; var mapLeft = $('#map').offset().left; var featureCount = 0; var msg = ""; var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) { console.log(feature); /* if (layer.get('name') == 'wwa') { et = feature.get('end'); if (et == 0) { vt = "Until Further Notice"; } else { vt = getTime(et); } hex = feature.get('color'); hex = hex.slice(1); msg = msg + '
' + feature.get('phenomenon') + " " + feature.get('significance') + '
Expires at: ' + vt + '
'; featureCount = featureCount = 1; } */ }); /* if (featureCount > 0) { $("#WWAinfo").html(msg); $("#WWAinfo").css("top", pixel[1]+20+mapTop); $("#WWAinfo").css("left", pixel[0]+0+mapLeft); $("#WWAinfo").show(); } else { $('#WWAinfo').html(); $('#WWAinfo').hide(); } */ }; function getTime(s) { var d = new Date(0); d.setUTCSeconds(s); var minutes = d.getMinutes(); if (minutes < 10) { minutes = "0" + minutes; } var hrs = d.getHours(); var ap =''; if (hrs < 12) { ap = "am"; if (hrs == 0) { hrs = 12; } } else { ap = "pm"; if (hrs > 12) { hrs = hrs - 12; } } var yr = d.getFullYear(); var dy = d.getDate(); var rd = 'th'; if (dy == 1) { rd = 'st'; } if (dy == 2) { rd = 'nd'; } if (dy == 3) { rd = 'rd'; } if (dy == 21) { rd = 'st'; } if (dy == 31) { rd = 'st'; } if (dy == 22) { rd = 'nd'; } if (dy == 23) { rd = 'rd'; } var dow = d.getDay()+1; var dayofweek = ''; switch (dow) { case 1: dayofweek = "Sun"; break; case 2: dayofweek = "Mon"; break; case 3: dayofweek = "Tue"; break; case 4: dayofweek = "Wed"; break; case 5: dayofweek = "Thu"; break; case 6: dayofweek = "Fri"; break; case 7: dayofweek = "Sat"; break; } var mn = d.getMonth()+1; var month = ''; switch (mn) { case 1: month = "Jan"; break; case 2: month = "Feb"; break; case 3: month = "Mar"; break; case 4: month = "Apr"; break; case 5: month = "May"; break; case 6: month = "Jun"; break; case 7: month = "Jul"; break; case 8: month = "Aug"; break; case 9: month = "Sep"; break; case 10: month = "Oct"; break; case 11: month = "Nov"; break; case 12: month = "Dec"; break; } tz = getTZ(); var tmpTime = hrs +":"+minutes + " " + ap + " " + tz + " on " + dayofweek + ", " + month + " " + dy + ", " + yr; return tmpTime; } function getTZ(dateInput) { var dateObject = dateInput || new Date(), dateString = dateObject + "", tzAbbr = ( dateString.match(/\(([^\)]+)\)$/) || dateString.match(/([A-Z]+) [\d]{4}$/) ); if (tzAbbr) { tzAbbr = tzAbbr[1].match(/[A-Z]/g).join(""); } if (!tzAbbr && /(GMT\W*\d{4})/.test(dateString)) { return RegExp.$1; } return tzAbbr; }; function toggleWWA(checked,id,name){ ////updateText(); //console.log('am i here?'); //map.renderSync(); //map.render(); //map.changed(); //popup.setPosition(undefined); markerTypes = ['mousemoveMarker']; if (window.updateVar != "") { clearTimeout(window.updateVar); } window.updateVar = ""; name = name.substring(name.indexOf('_')+1); if (name != "none") { name2 = name; } var briefing = "0"; if (briefing == "0") { clearGages(); clearClimate() } checkNewName(id); window.id2 = id; manageFilters(checked,id); loadFooter(name); var idShort = id; var combo = false; var lastFive = id.substr(id.length - 5); if (lastFive == 'combo') { var combo = true; idShort = id.substr(0,id.length - 5); } if(checked== true) { if (briefing == "0") { clearBoxes(id); } unloadMarkers(['click']); document.getElementById('loading').style.display='block'; loadMarkers(150,false,true,true); document.getElementById('gridOptions').style.display = 'block'; window.updateVar = setTimeout(function(){toggleWWA(checked,id,name);},dataRefreshInterval); } else { //gmap unloadMarkers(['click']); unloadMarkers(['clickLink']); if (briefing == "0") { for(var j=0; j<3; j++){ if(document.bounds.elements[j].checked == true){ toggleOverlay(true,document.bounds.elements[j].id, 'none'); } } } document["legend1"].src="/data/icons/blank.png"; var count = 0; var allPNGtypes = PNGtypes.concat(PNGtypes2); for(var i=0; i Date.now()) { radarDate = oneHourAgo(); } setTime(); // Pause longer on last frame of the loop. var coeff = 1000*60*5; var checkDate = new Date(Math.floor(Date.now() / coeff) * coeff); if (radarDate.getTime() == checkDate.getTime()) { var pauseTime = 1500; } else { var pauseTime = 500; } window.tilesToLoad = 0; window.tilesLoaded = 0; tileLayerSource.on('tileloadstart',function(event) { ++window.tilesToLoad; }); tileLayerSource.on('tileloadend',function(event) { ++window.tilesLoaded; if (window.tilesLoaded == window.tilesToLoad) { //console.log('all tiles loaded'); tileLayerSource.removeEventListener('tileloadstart'); tileLayerSource.removeEventListener('tileloadend'); window.updateVar = setTimeout(function(){ if (radarAnimation) { animateRadar(true); }; },pauseTime); } }); // window.updateVar = setTimeout(function(){animateRadar();},500); } function toggleTile(checked,id,name){ ////updateText(); //console.log('am i here?'); //map.renderSync(); //map.render(); //map.changed(); //popup.setPosition(undefined); //markerTypes = ['mousemoveMarker']; if (window.updateVar != "") { clearTimeout(window.updateVar); } window.updateVar = ""; name = name.substring(name.indexOf('_')+1); if (name != "none") { name2 = name; } var briefing = "0"; if (briefing == "0") { clearGages(); clearClimate() } checkNewName(id); window.id2 = id; manageFilters(checked,id); loadFooter(name); var idShort = id; var combo = false; var lastFive = id.substr(id.length - 5); if (lastFive == 'combo') { var combo = true; idShort = id.substr(0,id.length - 5); } if (briefing == "0") { var legend = "legend2"; var opacity = $( "#imageslider" ).slider( "value" )*0.01; } else { var legend = "legend1"; var opacity = 0.65; } if(checked== true) { if (typeof tileLayer !== 'undefined') { map.removeLayer(tileLayer); } if (typeof imageLayer !== 'undefined') { map.removeLayer(imageLayer); } if (briefing == "0") { clearBoxes(id); } stopListener(); if (id.substr(0,19)=="debrisFlowBasinProb") { var boxes = document.getElementsByName("boxGrid"); for(var i = 0; i < boxes.length; i++) { if (boxes[i].checked) { boxes[i].checked = false; } } var boxes = document.getElementsByName("boxTile"); for(var i = 0; i < boxes.length; i++) { if (boxes[i].checked) { boxes[i].checked = false; } } document.getElementById(id).checked = true; } //unloadMarkers(['click']); document.getElementById('loading').style.display='block'; //loadMarkers(150,false,true,true); if (id == "radarrefl") { var coeff = 1000*60*5; radarDate = new Date(Math.floor(Date.now() / coeff) * coeff); tileLayerSource = new ol.source.TileWMS(/** @type {olx.source.TileWMSOptions} */ ({ attributions: ['Iowa State University'], crossOrigin: 'anonymous', url: 'https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0q-t.cgi', params: {'LAYERS': 'nexrad-n0q-wmst'} })); setTime(); var extentTile = extentRadar; $('#radarrefltime').show(); document[legend].src="/images/radar/legendHorizontal.png"; } else if (id == "snowNOHRSC" || id == "snowNOHRSCdepth") { var today = new Date(); var day = today.getDate(); var month = today.getMonth()+1; var year = today.getFullYear(); today = year+pad(month,2)+pad(day,2); var dateBox = document.getElementById('NOHRSCDateBox').value; var product3 = id.substr(id.lastIndexOf("snow")+4); window.type11 = "snow"; window.time11 = product3; //if (today != dateBox) { // togglePNG('snow', checked, product3,id); // return; //} togglePNG('snow', checked, product3,id); return; if (id == "snowNOHRSC") { var layerNumber = "1"; if (document.getElementById("snowNOHRSCdepth")) { document.getElementById("snowNOHRSCdepth").checked = false; } document.getElementById("snowNOHRSCCHG").checked = false; document[legend].src="/data/icons/swe_icons/legend_nohrsc.png"; } else if (id == "snowNOHRSCdepth") { var layerNumber = "5"; if (document.getElementById("snowNOHRSC")) { document.getElementById("snowNOHRSC").checked = false; } document.getElementById("snowNOHRSCCHG").checked = false; document[legend].src="/data/icons/swe_icons/legend_nohrsc_depth.png"; } tileLayerSource = new ol.source.TileWMS( ({ attributions: ['NOAA/NOHRSC'], crossOrigin: 'anonymous', url: 'https://idpgis.ncep.noaa.gov/arcgis/services/NWS_Observations/NOHRSC_Snow_Analysis/MapServer/WmsServer', params: {'LAYERS': layerNumber}, // 1 for SWE, 5 for Snow Depth projection: ol.proj.get('EPSG:4326') })); } else if (id == "debrisFlowBasinProb") { tileLayerSource = new ol.source.TileArcGISRest(/** @type {olx.source.TileWMSOptions} */ ({ attributions: ['USGS'], //crossOrigin: 'use-credentials', url: 'https://earthquake.usgs.gov/arcgis/rest/services/ls/pwfdf_2023/MapServer', params: {'LAYERS': '2'} })); document[legend].src="/data/icons/debrisFlowProb.png"; startListener('click'); } else if (id == "debrisFlowBasinProb2") { tileLayerSource = new ol.source.TileArcGISRest(/** @type {olx.source.TileWMSOptions} */ ({ attributions: ['USGS'], //crossOrigin: 'use-credentials', url: 'https://earthquake.usgs.gov/arcgis/rest/services/ls/pwfdf_2022/MapServer', params: {'LAYERS': '2'}, //projection: ol.proj.get('EPSG:3857') })); document[legend].src="/data/icons/debrisFlowProb.png"; startListener('click'); } else if (id == "debrisFlowBasinProb3") { tileLayerSource = new ol.source.TileArcGISRest(/** @type {olx.source.TileWMSOptions} */ ({ attributions: ['USGS'], //crossOrigin: 'anonymous', url: 'https://earthquake.usgs.gov/arcgis/rest/services/ls/pwfdf_2021/MapServer', params: {'LAYERS': '2'} })); document[legend].src="/data/icons/debrisFlowProb.png"; startListener('click'); } else if (id == "LAKES") { console.log("loading lakes"); /* tileLayerSource = new ol.source.XYZ({ attributions: ["nationalmap.gov"], crossOrigin: 'anonymous', url: https+'://hydro.nationalmap.gov/arcgis/rest/services/' + 'nhd/MapServer/12/{z}/{y}/{x}', //params: {'LAYERS': '0'}, projection: ol.proj.get('EPSG:3857') }), */ tileLayerSource = new ol.source.TileWMS( { attributions: ['nationalmap.gov'], //crossOrigin: 'use-credentials', url: 'https://hydro.nationalmap.gov/arcgis/services/NHDPlus_HR/MapServer/WMSServer', //url: 'https://hydro.nationalmap.gov/arcgis/services/nhd/MapServer/WMSServer', params: {'LAYERS': '3'}, //serverType: 'mapserver', //projection: ol.proj.get('EPSG:3857') }); //document[legend].src="/data/icons/debrisFlowProb.png"; startListener('click'); } tileLayer = new ol.layer.Tile({ //extent: extentTile, source: tileLayerSource, opacity: opacity, zIndex: 1000 }); window.tilesToLoad = 0; window.tilesLoaded = 0; tileLayerSource.on('tileloadstart',function(event) { ++window.tilesToLoad; // window.updateVar = setTimeout(function(){animateRadar();},500); }); tileLayerSource.on('tileloadend',function(event) { //console.log(event.tile.getFeatures()); ++window.tilesLoaded; if (window.tilesLoaded == window.tilesToLoad) { //console.log('all tiles loaded'); tileLayerSource.removeEventListener('tileloadstart'); tileLayerSource.removeEventListener('tileloadend'); loadingOff(); } }); map.addLayer(tileLayer); if (document.getElementById('gridOptions')) { document.getElementById('gridOptions').style.display = 'block'; } window.updateVar = setTimeout(function(){toggleTile(checked,id,name);},dataRefreshInterval); } else { //gmap //unloadMarkers(['click']); //unloadMarkers(['clickLink']); map.removeLayer(tileLayer); if (typeof imageLayer !== 'undefined') { map.removeLayer(imageLayer); } stopListener('click'); //for (i = 0; i < types.length; i++) { // stopListener(types[i],false,clearDataTable); //} if (briefing == "0") { for(var j=0; j<3; j++){ if(document.bounds.elements[j].checked == true){ toggleOverlay(true,document.bounds.elements[j].id, 'none'); } } } document[legend].src="/data/icons/blank.png"; var count = 0; var allPNGtypes = PNGtypes.concat(PNGtypes2); for(var i=0; i= newDate) { if (newDate.getTimezoneOffset() == 420) { var timeVar = "5:00 AM PDT"; } else { var timeVar = "4:00 AM PST"; } document.getElementById("briefingValidTime").innerHTML = newDate.f("E NNN d yyyy") + " at " + timeVar; document.getElementById('briefingValidTimeMaster').style.display = 'block'; } else { //$("#briefingValidTime").load("/data/kml/MQC_timestamp.txt"); document.getElementById("briefingValidTime").innerHTML = MQCstamp; document.getElementById('briefingValidTimeMaster').style.display = 'block'; } } } manageFilters(true,id); // document.write(id); window["toggleOverlayArchive"](checked,id,name); } function loadKML1AreaDaily(checked,type,month,day,year,name,previousMonth){ var string = ""; previousMonth = previousMonth || false; //for (var i=0, total = 0, len=arguments.length; i= newDate) { if (newDate.getTimezoneOffset() == 420) { var timeVar = "5:00 AM PDT"; } else { var timeVar = "4:00 AM PST"; } document.getElementById("briefingValidTime").innerHTML = newDate.f("E NNN d yyyy") + " at " + timeVar; document.getElementById('briefingValidTimeMaster').style.display = 'block'; } else { //$("#briefingValidTime").load("/data/kml/MQC_timestamp.txt"); document.getElementById("briefingValidTime").innerHTML = MQCstamp; document.getElementById('briefingValidTimeMaster').style.display = 'block'; } } } manageFilters(true,id); // document.write(id); window["toggleOverlayArchive"](checked,id,name); } //Month is 1 based function daysInMonth(month,year) { if (month == 'Jan') { month = 1; } else if (month == 'Feb') { month = 2; } else if (month == 'Mar') { month = 3; } else if (month == 'Apr') { month = 4; } else if (month == 'May') { month = 5; } else if (month == 'Jun') { month = 6; } else if (month == 'Jul') { month = 7; } else if (month == 'Aug') { month = 8; } else if (month == 'Sep') { month = 9; } else if (month == 'Oct') { month = 10; } else if (month == 'Nov') { month = 11; } else if (month == 'Dec') { month = 12; } return new Date(year, month, 0).getDate(); } function loadKML2(code,month,year,name,textRes){ name = name.substring(name.indexOf('_')+1); window.textRes2 = textRes; unloadMarkers(); if (window.updateVar != "") { clearTimeout(window.updateVar); } window.updateVar = ""; if (name != "none") { name2 = name; } window.id2 = code; checkNewName(code); manageFilters(true,code); loadFooter(name); var min = 0; var id = code + "_" + month + "_" + year; //manageFilters(true,id); var briefing = "0"; if (briefing == 0) { document.getElementById(code).checked=true; } document.getElementById('briefingCreatedTime').innerHTML = ""; document.getElementById('briefingValidTime').innerHTML = ""; document.getElementById('briefingCreatedTimeMaster').style.display = 'none'; document.getElementById('briefingValidTimeMaster').style.display = 'none'; //if (briefing == 1) { var xmlurl = "/data/kml/" + id + ".xml"; $("#briefingCreatedTime").load("/includes/timeStamp2.php?imgFile="+xmlurl+"&fontSize=10"); document.getElementById('briefingCreatedTimeMaster').style.display = 'block'; //} document.getElementById('loading').style.display='block'; if (code == "PNS" || code == "PPS") { var url = "/data/kml/" + id + ".xml?random="+Math.random(); $.get(url) .done(function() { //file exists window["addMarkersFromXML1_"+name](min,id); var mode = ""; var briefing = "0"; var zoomLevel = parseInt(map.getView().getZoom()); loadMarkers(textRes,loadSecondary()); }).fail(function() { //file doesn't exist. go to prev month
if (month == "Jan") { month = "Dec"; year = year-1; } else if (month == "Feb") { month = "Jan"; } else if (month == "Mar") { month = "Feb"; } else if (month == "Apr") { month = "Mar"; } else if (month == "May") { month = "Apr"; } else if (month == "Jun") { month = "May"; } else if (month == "Jul") { month = "Jun"; } else if (month == "Aug") { month = "Jul"; } else if (month == "Sep") { month = "Aug"; } else if (month == "Oct") { month = "Sep"; } else if (month == "Nov") { month = "Oct"; } else if (month == "Dec") { month = "Nov"; } id = code + "_" + month + "_" + year; window["addMarkersFromXML1_"+name](min,id); var mode = ""; var briefing = "0"; var zoomLevel = parseInt(map.getView().getZoom()); loadMarkers(textRes,loadSecondary()); }) } else { window["addMarkersFromXML1_"+name](min,id); loadMarkers(textRes,loadSecondary()); } window.updateVar = setTimeout(function(){loadKML2(code,month,year,name,textRes);},dataRefreshInterval); } var KMZanimateSpeed = {}; KMZanimateSpeed['DroughtMonitorArchive'] = 500; var PNGimgnum = {}; var PNGimg = {}; var PNGimg2 = {}; var PNGanimateSpeed = {}; var PNGtypeName = {}; var PNGmaxImg = {}; PNGimgnum["wpcQpf6hr"] = 1; PNGimgnum["wpcQpf24hr"] = 1; // var PNGmainTypes = ["QPF","QPE","FzLevel","temps"]; var PNGmainTypes = ["riverReservoir","waterResources","QPF","QPE","FzLevel","obsTemps","fcstTemps","FFG","QPFverif"]; for (var x in PNGmainTypes) { var type = PNGmainTypes[x]; PNGimg[type] = ""; PNGimg2[type] = ""; } //var PNGtypes = ["QPF6hr","QPF24hr","QPF5day","QPE6hr","QPE24hr","QPE7day","FzLevel6hrFcst","FzLevel6hrObs","MaxTFcstMaxT","MaxTFcstDeparture","MaxTFcst24Chg","MaxTFcstNormal","MinTFcstMinT","MinTFcstDeparture","MinTFcst24Chg","MinTFcstNormal"]; var PNGtypes = ["riverReservoirFOP","QPF6hr","QPF24hr","QPF72hr","QPF5day","QPF6day","QPFcustom","QPE6hr","QPE24hr","QPE48hr","QPE72hr","QPE7day","QPEcustom","FzLevel6hrFcst","FzLevel6hrObs","MaxTFcstMaxT","MinTFcstMinT","TempObs6hr","MaxTObsMaxT","MinTObsMinT","FFG1hr","FFG3hr","FFG6hr","QPFverif","QPFverifCompare","QPEmonthly","QPEmonthlyDeparture","QPEmonthlyPercentNormal","QPEmonthlyNormal","QPEWY","QPEWYDeparture","QPEWYPercentNormal","QPEWYNormal","MQCcustom","snowNOHRSC","snowNOHRSCCHG","snowNOHRSCdepth"]; var PNGtypes2 = ["MaxTFcstDeparture","MaxTFcst24Chg","MaxTFcstNormal","MinTFcstDeparture","MinTFcst24Chg","MinTFcstNormal","MaxTObsDeparture","MaxTObs24Chg","MaxTObsNormal","MinTObsDeparture","MinTObs24Chg","MinTObsNormal"]; for (x in PNGtypes) { PNGimgnum[PNGtypes[x]] = 1; PNGanimateSpeed[PNGtypes[x]] = 500; } PNGimgnum["radarrefl"] = 10; PNGanimateSpeed["radarrefl"] = 200; PNGtypeName["QPEmonthly"] = "QPE"; PNGtypeName["QPEmonthlyDeparture"] = "QPE"; PNGtypeName["QPEmonthlyPercentNormal"] = "QPE"; PNGtypeName["QPEmonthlyNormal"] = "QPE"; PNGtypeName["QPEWY"] = "QPE"; PNGtypeName["QPEWYDeparture"] = "QPE"; PNGtypeName["QPEWYPercentNormal"] = "QPE"; PNGtypeName["QPEWYNormal"] = "QPE"; PNGtypeName["MQCcustom"] = "QPE"; PNGtypeName["riverReservoirFOP"] = "riverReservoir"; PNGtypeName["QPF6hr"] = "QPF"; PNGtypeName["QPF24hr"] = "QPF"; PNGtypeName["QPF72hr"] = "QPF"; PNGtypeName["QPF5day"] = "QPF"; PNGtypeName["QPF6day"] = "QPF"; PNGtypeName["QPFcustom"] = "QPF"; //PNGtypeName["radarrefl"] = "radar"; //PNGtypeName["RADARPCPN"] = "radar"; PNGtypeName["QPE6hr"] = "QPE"; PNGtypeName["QPE24hr"] = "QPE"; PNGtypeName["QPE48hr"] = "QPE"; PNGtypeName["QPE72hr"] = "QPE"; PNGtypeName["QPE7day"] = "QPE"; PNGtypeName["QPEcustom"] = "QPE"; PNGtypeName["FzLevel6hrFcst"] = "FzLevel"; PNGtypeName["FzLevel6hrObs"] = "FzLevel"; PNGtypeName["MaxTFcstMaxT"] = "fcstTemps"; PNGtypeName["MaxTFcstDeparture"] = "fcstTemps"; PNGtypeName["MaxTFcst24Chg"] = "fcstTemps"; PNGtypeName["MaxTFcstNormal"] = "fcstTemps"; PNGtypeName["MinTFcstMinT"] = "fcstTemps"; PNGtypeName["MinTFcstDeparture"] = "fcstTemps"; PNGtypeName["MinTFcst24Chg"] = "fcstTemps"; PNGtypeName["MinTFcstNormal"] = "fcstTemps"; PNGtypeName["MaxTObsMaxT"] = "obsTemps"; PNGtypeName["MinTObsMinT"] = "obsTemps"; PNGtypeName["MinTObsNormal"] = "obsTemps"; PNGtypeName["MaxTObsDeparture"] = "obsTemps"; PNGtypeName["MaxTObs24Chg"] = "obsTemps"; PNGtypeName["MaxTObsNormal"] = "obsTemps"; PNGtypeName["MinTObsDeparture"] = "obsTemps"; PNGtypeName["MinTObs24Chg"] = "obsTemps"; PNGtypeName["TempObs6hr"] = "obsTemps"; PNGtypeName["FFG1hr"] = "FFG"; PNGtypeName["FFG3hr"] = "FFG"; PNGtypeName["FFG6hr"] = "FFG"; PNGtypeName["Day1QPFverif"] = "QPFverif"; PNGtypeName["Day2QPFverif"] = "QPFverif"; PNGtypeName["Day3QPFverif"] = "QPFverif"; PNGtypeName["Day4QPFverif"] = "QPFverif"; PNGtypeName["Day5QPFverif"] = "QPFverif"; PNGtypeName["QPFverif"] = "QPFverif"; PNGtypeName["QPFverifCompare"] = "QPFverif"; PNGtypeName["snowNOHRSC"] = "snow"; PNGtypeName["snowNOHRSCCHG"] = "snow"; PNGtypeName["snowNOHRSCdepth"] = "snow"; PNGmaxImg["riverReservoirFOP"] = 1; PNGmaxImg["QPF6hr"] = 24; PNGmaxImg["QPF24hr"] = 6; PNGmaxImg["QPF72hr"] = 1; PNGmaxImg["QPF5day"] = 1; PNGmaxImg["QPF6day"] = 1; PNGmaxImg["QPFcustom"] = 1; PNGmaxImg["radarrefl"] = 10; //PNGmaxImg["RADARPCPN"] = 1; PNGmaxImg["QPE6hr"] = 4; PNGmaxImg["QPE24hr"] = 1; PNGmaxImg["QPE48hr"] = 1; PNGmaxImg["QPE72hr"] = 1; PNGmaxImg["QPE7day"] = 1; PNGmaxImg["QPEcustom"] = 1; PNGmaxImg["FzLevel6hrFcst"] = 25; PNGmaxImg["FzLevel6hrObs"] = 4; PNGmaxImg["MaxTFcstMaxT"] = 11; PNGmaxImg["MaxTFcstDeparture"] = 11; PNGmaxImg["MaxTFcst24Chg"] = 11; PNGmaxImg["MaxTFcstNormal"] = 11; PNGmaxImg["MinTFcstMinT"] = 10; PNGmaxImg["MinTFcstDeparture"] = 10; PNGmaxImg["MinTFcst24Chg"] = 10; PNGmaxImg["MinTFcstNormal"] = 10; PNGmaxImg["MaxTObsMaxT"] = 4; PNGmaxImg["MinTObsMinT"] = 4; PNGmaxImg["TempObs6hr"] = 4; PNGmaxImg["MaxTObsDeparture"] = 4; PNGmaxImg["MaxTObs24Chg"] = 4; PNGmaxImg["MaxTObsNormal"] = 4; PNGmaxImg["MinTObsDeparture"] = 4; PNGmaxImg["MinTObs24Chg"] = 4; PNGmaxImg["MinTObsNormal"] = 4; PNGmaxImg["Day1QPFverif"] = 1; PNGmaxImg["Day2QPFverif"] = 1; PNGmaxImg["Day3QPFverif"] = 1; PNGmaxImg["Day4QPFverif"] = 1; PNGmaxImg["Day5QPFverif"] = 1; PNGmaxImg["snowNOHRSC"] = 1; PNGmaxImg["snowNOHRSCCHG"] = 1; PNGmaxImg["snowNOHRSCdepth"] = 1; window.refreshCount = 0; window.reloadingPNG = false; window.imageLoading = false; function AnimatePNG(type,checked,time,id) { if (window.reloadingPNG) { window.setTimeout(function(){AnimatePNG(type,checked,time,id)},100); return; } if (window.updateVar != "") { clearTimeout(window.updateVar); } window.updateVar = ""; time2 = time; var subtypes = ["Departure","24Chg","Normal"]; if (time == 'MaxT' || time == 'MinT') { for(var i = 0; i < subtypes.length; i++) { var subtype = subtypes[i]; var e = document.getElementById(type+subtype); if (e.checked) { time2 = subtype; } } } if (document.getElementById(type+time2).checked == 0) { return; } var imgnum = PNGimgnum[type+time]; var maxImg = PNGmaxImg[type+time]; if (type.substring(0,4) == "MaxT" || type.substring(0,4) == "MinT") { time3 = type.substring(0,4); } else { time3 = time2; } if (document.getElementById(id).checked) { //nextPNGgrid(type,time3,'fromAnimate'); //ol.maps.event.trigger(PNGimg[PNGtypeName[type+time]],'mousemove',{latlon:event.latLng}); //alert(PNGanimateSpeed[type+time3]); window.refreshCount = window.refreshCount + 1; if (window.refreshCount >= 200) { window.reloadingPNG = true; //alert('refreshing now'); //Loop through images to refresh var maxImg = PNGmaxImg[type+time]; //for (var i = 1; i <= maxImg; i++) { PNGimgnum[type+time] = 0; nextPNGgrid(type,time3,'fromAnimate',true,true); //while (window.imageLoading) { //} //} //Refresh timestamps //updateText(); //Reset variables window.refreshCount = 0; window.reloadingPNG = false; //Now restart looping if (imgnum == maxImg-1) { window.setTimeout(function(){AnimatePNG(type,checked,time,id)},2.5*PNGanimateSpeed[type+time3]); } else { window.setTimeout(function(){AnimatePNG(type,checked,time,id)},PNGanimateSpeed[type+time3]); } } else { nextPNGgrid(type,time3,'fromAnimate'); if (imgnum == maxImg-1) { window.setTimeout(function(){AnimatePNG(type,checked,time,id)},2.5*PNGanimateSpeed[type+time3]); } else { window.setTimeout(function(){AnimatePNG(type,checked,time,id)},PNGanimateSpeed[type+time3]); } } } else { //makePNGlisteners(type,time2,time,id); //togglePNG(type,document.getElementById(type+time2).checked,time2,type+time2); reinitializePNG(type,document.getElementById(type+time2).checked,time2,type+time2); } } function loadPNGgrid(type,time,step,fromAnimate){ fromAnimate = fromAnimate || false; var time2 = time; var subtypes = ["Departure","24Chg","Normal"]; if (time == 'MaxT' || time == 'MinT') { for(var i = 0; i < subtypes.length; i++) { var subtype = subtypes[i]; var e = document.getElementById(type+subtype); if (e.checked) { time2 = subtype; } } } window.time11 = time2; window.time12 = time; window.type11 = type; //window.id2 = id; PNGimgnum[type+time] = step; var maxImg = PNGmaxImg[type+time]; var minImg = 1; //if (PNGimgnum[type+time] == minImg) { // document.getElementById('prev'+type+time).disabled = true; //} else { // document.getElementById('prev'+type+time).disabled = false; //} //if (PNGimgnum[type+time] == maxImg) { // document.getElementById('next'+type+time).disabled = true; //} else { // document.getElementById('next'+type+time).disabled = false; //} // var imageBounds = new ol.maps.LatLngBounds( // new ol.maps.LatLng(32.5,-124.48), // new ol.maps.LatLng(43.375,-114.105)); for (var i = 1; i <= maxImg; i++) { var e = document.getElementById(type+time+"time_"+i); if (i == PNGimgnum[type+time]) { e.style.display="block"; } else { e.style.display="none"; } } //alert(step); if (document.getElementById(type+time2).checked) { //document.getElementById('cursorReadoutDiv').style.display = 'block'; //document.getElementById('showElevDiv').style.display = 'block'; loadingOn(); if (fromAnimate) { window.imageLoading = true; } if (time2 == "24Chg" && PNGimgnum[type+time] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { var url = "/data/icons/24Change_NA.png"; } else if (type == "radar") { var url = "/archive/radar/images/"+time2+"_"+type+"_"+step+"_Mercator.png?random="+Math.random(); } else { var url = "/data/png/"+time2+"_"+type+"_"+step+".png?random="+Math.random(); } if (PNGimg[PNGtypeName[type+time]] != "") { map.removeLayer(PNGimg[PNGtypeName[type+time]]); stopListener('image'); PNGimg[PNGtypeName[type+time]] = ""; } var img = new Image(); img.src=url; //$('img').load('load',function () { // loadingOff(); //}); if (type == "radar") { ib = imageBoundsRadar; } else { ib = imageBounds; } PNGimg[PNGtypeName[type+time2]] = loadImageLayer(url,ib); PNGimg[PNGtypeName[type+time2]].setOpacity($( "#imageslider" ).slider( "value" )/100); if (time2 == "24Chg" && PNGimgnum[type+time] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { PNGimg[PNGtypeName[type+time2]].setOpacity(1.0); } if (!fromAnimate) { makePNGlisteners(type,time2,time); } } else { document.getElementById('cursorReadoutDiv').style.display = 'none'; document.getElementById('showElevDiv').style.display = 'none'; } } function prevPNGgrid(type,time,id){ time2 = time; var subtypes = ["Departure","24Chg","Normal"]; if (time == 'MaxT' || time == 'MinT') { for(var i = 0; i < subtypes.length; i++) { var subtype = subtypes[i]; var e = document.getElementById(type+subtype); if (e.checked) { time2 = subtype; } } } window.time11 = time2; window.time12 = time; window.type11 = type; //window.id2 = id; var minImg = 1; var maxImg = PNGmaxImg[type+time]; PNGimgnum[type+time] = PNGimgnum[type+time] - 1; if (PNGimgnum[type+time] < minImg) { PNGimgnum[type+time] = maxImg; } //if (PNGimgnum[type+time] == minImg) { // document.getElementById('prev'+type+time).disabled = true; //} else { // document.getElementById('prev'+type+time).disabled = false; //} //document.getElementById('next'+type+time).disabled = false; $( "#"+type+time+"slider" ).slider( "value", PNGimgnum[type+time]); // var imageBounds = new ol.maps.LatLngBounds( // new ol.maps.LatLng(32.5,-124.48), // new ol.maps.LatLng(43.375,-114.105)); for (var i = 1; i <= PNGmaxImg[type+time]; i++) { var e = document.getElementById(type+time+"time_"+i); if (i == PNGimgnum[type+time]) { e.style.display="block"; } else { e.style.display="none"; } } if (document.getElementById(type+time2).checked) { // document.getElementById('cursorReadoutDiv').style.display = 'block'; // document.getElementById('showElevDiv').style.display = 'block'; loadingOn(); if (time2 == "24Chg" && PNGimgnum[type+time] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { var url = "/data/icons/24Change_NA.png"; } else if (type == "radar") { var url = "/archive/radar/images/"+time2+"_"+type+"_"+PNGimgnum[type+time]+"_Mercator.png?random="+Math.random(); } else { var url = "/data/png/"+time2+"_"+type+"_"+PNGimgnum[type+time]+".png?random="+Math.random(); } if (PNGimg[PNGtypeName[type+time]] != "") { map.removeLayer(PNGimg[PNGtypeName[type+time]]); stopListener('image'); PNGimg[PNGtypeName[type+time]] = ""; } var img = new Image(); img.src=url; //$('img').load('load',function () { // loadingOff(); //}); if (type == "radar") { ib = imageBoundsRadar; } else { ib = imageBounds; } PNGimg[PNGtypeName[type+time2]] = loadImageLayer(url,ib); PNGimg[PNGtypeName[type+time2]].setOpacity($( "#imageslider" ).slider( "value" )/100); if (time2 == "24Chg" && PNGimgnum[type+time] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { PNGimg[PNGtypeName[type+time2]].setOpacity(1.0); } makePNGlisteners(type,time2,time); } else { document.getElementById('cursorReadoutDiv').style.display = 'none'; document.getElementById('showElevDiv').style.display = 'none'; } } function nextPNGgrid(type,time,id,fromAnimate,override){ fromAnimate = fromAnimate || false; override = override || false; time2 = time; var subtypes = ["Departure","24Chg","Normal"]; if (time == 'MaxT' || time == 'MinT') { for(var i = 0; i < subtypes.length; i++) { var subtype = subtypes[i]; var e = document.getElementById(type+subtype); if (e.checked) { time2 = subtype; } } } window.time11 = time2; window.time12 = time; window.type11 = type; //window.id2 = id; var maxImg = PNGmaxImg[type+time]; PNGimgnum[type+time] = PNGimgnum[type+time] + 1; if (fromAnimate) { //alert('Msg from nextPNGimg: ' + PNGimgnum[type+time]); } if (PNGimgnum[type+time] > maxImg) { PNGimgnum[type+time] = 1; } // if (PNGimgnum[type+time] == maxImg) { // document.getElementById('next'+type+time).disabled = true; // } else { // document.getElementById('next'+type+time).disabled = false; // } // document.getElementById('prev'+type+time).disabled = false; // if (PNGimgnum[type+time] == 1) { // document.getElementById('prev'+type+time).disabled = true; // } $( "#"+type+time+"slider" ).slider( "value", PNGimgnum[type+time]); // var imageBounds = new ol.maps.LatLngBounds( // new ol.maps.LatLng(32.5,-124.48), // new ol.maps.LatLng(43.375,-114.105)); for (var i = 1; i <= maxImg; i++) { //alert(type+time+"time_"+i); var e = document.getElementById(type+time+"time_"+i); if (i == PNGimgnum[type+time]) { e.style.display="block"; } else { e.style.display="none"; } } //alert(type+' '+time+' '+time2+' '+PNGimgnum[type+time]); if (document.getElementById(type+time2).checked) { //document.getElementById('cursorReadoutDiv').style.display = 'block'; //document.getElementById('showElevDiv').style.display = 'block'; //if (id!="fromAnimate") { //document.getElementById('loading').innerHTML = PNGimgnum[type+time]; loadingOn(); //} if (fromAnimate) { window.imageLoading = true; } if (document.getElementById(type+time+'Animate')) { if (document.getElementById(type+time+'Animate').checked == false || override) { //alert('refreshing now'); if (time2 == "24Chg" && PNGimgnum[type+time] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { var url = "/data/icons/24Change_NA.png"; } else if (type == "radar") { var url = "/archive/radar/images/"+time2+"_"+type+"_"+PNGimgnum[type+time]+"_Mercator.png?random="+Math.random(); } else { var url = "/data/png/"+time2+"_"+type+"_"+PNGimgnum[type+time]+".png?random="+Math.random(); } //updateText(); } else { if (time2 == "24Chg" && PNGimgnum[type+time] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { var url = "/data/icons/24Change_NA.png"; } else if (type == "radar") { var url = "/archive/radar/images/"+time2+"_"+type+"_"+PNGimgnum[type+time]+"_Mercator.png"; } else { var url = "/data/png/"+time2+"_"+type+"_"+PNGimgnum[type+time]+".png"; } } } //alert(url); if (PNGimg[PNGtypeName[type+time]] != "") { map.removeLayer(PNGimg[PNGtypeName[type+time]]); stopListener('image'); PNGimg[PNGtypeName[type+time]] = ""; } //if (id!="fromAnimate") { var img = new Image(); $('img').load('load',function () { if (window.type11 == "radar") { ib = imageBoundsRadar; } else { ib = imageBounds; } if (window.imageLoading) { if (PNGimg[PNGtypeName[window.type11+window.time12]] != "") { map.removeLayer(PNGimg[PNGtypeName[window.type11+window.time12]]); PNGimg[PNGtypeName[window.type11+window.time12e]] = ""; } PNGimg[PNGtypeName[window.type11+window.time11]] = loadImageLayer(url,ib); PNGimg[PNGtypeName[window.type11+window.time11]].setOpacity($( "#imageslider" ).slider( "value" )/100); if (time2 == "24Chg" && PNGimgnum[window.type11+window.time12] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { PNGimg[PNGtypeName[window.type11+window.time11]].setOpacity(1.0); } } if (window.imageLoading) { makePNGlisteners(type,time2,time); } loadingOff(); //alert(window.imageLoading + ' ' + PNGimgnum[type+time] + ' ' + PNGmaxImg[type+time]); if (window.imageLoading && PNGimgnum[type+time] < PNGmaxImg[type+time]) { nextPNGgrid(window.type11,window.time12,'fromAnimate',true,true); } else { window.imageLoading = false; } }); img.src=url; //} if (type == "radar") { ib = imageBoundsRadar; } else { ib = imageBounds; } if (!fromAnimate) { PNGimg[PNGtypeName[type+time2]] = loadImageLayer(url,ib); PNGimg[PNGtypeName[type+time2]].setOpacity($( "#imageslider" ).slider( "value" )/100); if (time2 == "24Chg" && PNGimgnum[type+time] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { PNGimg[PNGtypeName[type+time2]].setOpacity(1.0); } } if (!fromAnimate) { makePNGlisteners(type,time2,time); } } else { document.getElementById('cursorReadoutDiv').style.display = 'none'; document.getElementById('showElevDiv').style.display = 'none'; } } function togglePNG(type,checked,time,id){ var briefing = "0"; //updateText(); window.refreshCount = 199; //alert(skipCheck); //alert('hi'); //return; if (time == "Departure" || time == "24Chg" || time == "Normal") { var time2 = type.substring(0,4); } else { var time2 = time; } if (window.updateVar2 != "") { clearTimeout(window.updateVar2); } window.updateVar2 = ""; window.time11 = time; window.time12 = time2; window.type11 = type; //window.id2 = id; name2 = PNGtypeName[type+time2]; if (name2 == "QPE") { name2 = "precip"; } name3 = PNGtypeName[type+time2]; if (name3 = "QPE") { name3 = "precip"; } checkNewName(id); if (type == 'QPE') { showHideQPE(time); } document.getElementById('briefingCreatedTime').innerHTML = ""; document.getElementById('briefingValidTime').innerHTML = ""; document.getElementById('briefingCreatedTimeMaster').style.display = 'none'; document.getElementById('briefingValidTimeMaster').style.display = 'none'; //alert(type+" "+checked+" "+time+" "+id+" "+skipCheck); if (window.name2 == 'QPE' || window.name2 == 'radar') { loadFooter('precip'); } else { loadFooter(window.name2); } //alert("'"+type+time2+"' '"+PNGtypeName[type+time2]+"' '"+PNGimg[PNGtypeName[type+time2]]+"' '"+skipCheck); if (checked) { if (typeof tileLayer !== 'undefined') { map.removeLayer(tileLayer); var boxes = document.getElementsByName("boxTile"); for(var i = 0; i < boxes.length; i++) { if (boxes[i].checked) { boxes[i].checked = false; } } } $('#basinPrecip').prop('checked',false); $('#basinPrecipSeasonal').prop('checked',false); $('#hucPrecip').prop('checked',false); $('#hucPrecipSeasonal').prop('checked',false); $('#fgroups').prop('checked',false); if (briefing == 0) { document.getElementById('gridOptions').style.display = 'block'; } if (name2 == 'QPF') { if (gridID != "") { map.removeLayer(kml[gridID].kmlLayer); gridID = ""; } $('#wpcQpf6hr').prop('checked',false); $('#wpcQpf24hr').prop('checked',false); $('#wpcQpf72hr').prop('checked',false); $('#wpcQpf7day').prop('checked',false); } //document.getElementById('cursorReadoutDiv').style.display = 'block'; //document.getElementById('showElevDiv').style.display = 'block'; // alert("id is "+id+" and checked is true"); loadingOn(); if (document.forms["data_waterResources"]) { //var thisType = document.forms["data_waterResources"].elements["typeArea"].value; var thisType = window.imageType; } else { var thisType = ""; } if (time == "24Chg") { document["legend2"].src="/data/icons/24change.png"; } else if (time == "Departure") { document["legend2"].src="/data/icons/departure.png"; } else if (type == "FFG") { document["legend2"].src="/data/icons/QPF_colorTable.png"; } else if (time == "custom" && type == "MQC") { if (window.typeMQC == "QPE" || window.typeMQC == "normal") { document["legend2"].src="/data/icons/QPE_"+window.numYears+"yr_colorTable.png"; } else if (window.typeMQC == "departure") { document["legend2"].src="/data/icons/QPEWYDepartureMulti.png"; } else if (window.typeMQC == "percent") { document["legend2"].src="/data/icons/percentNormalGridded.png"; } } else if (time=="custom") { document["legend2"].src="/data/icons/QPF_6.5_colorTable.png"; } else if (type=="QPF" || type == "QPE") { if (time != "6hr") { window.type2 = type; $.getScript("/data/kml/"+time+"_"+type+".txt", function(){ document["legend2"].src="/data/icons/"+type2+"_"+max+"_colorTable.png"; }); } else { document["legend2"].src="/data/icons/QPF_6.5_colorTable.png"; } } else if (type=="obsTemps" || type == "fcstTemps") { document["legend2"].src="/data/icons/temps_colorTable.png"; } else if (type=="radar") { document["legend2"].src="/data/icons/blank.png"; document["legend3"].src="/data/icons/blank.png"; } else if (type=="QPFverif") { document["legend2"].src="/data/icons/QPFverif_colorTable.png"; } else if (type=="QPFverifCompare") { document["legend2"].src="/data/icons/QPF_6.5_colorTable.png"; } else if (thisType=="QPEmonthly" || thisType=="QPEmonthlyNormal") { document["legend2"].src="/data/icons/QPE_45.5_colorTable.png"; } else if (thisType=="QPEmonthlyDeparture") { document["legend2"].src="/data/icons/QPEmonthlyDeparture.png"; } else if (thisType=="QPEmonthlyPercentNormal") { document["legend2"].src="/data/icons/percentNormalGridded.png"; } else if (thisType=="QPEWY" || thisType=="QPEWYNormal") { document["legend2"].src="/data/icons/QPE_130.0_colorTable.png"; } else if (thisType=="QPEWYDeparture") { document["legend2"].src="/data/icons/QPEWYDeparture.png"; } else if (thisType=="QPEWYPercentNormal") { document["legend2"].src="/data/icons/percentNormalGridded.png"; } else if (id=="snowNOHRSC") { if (briefing == "1") { document["legend1"].src="/data/icons/swe_icons/legend_nohrsc.png"; } else { document["legend2"].src="/data/icons/swe_icons/legend_nohrsc.png"; } } else if (id=="snowNOHRSCCHG") { document["legend2"].src="/data/icons/swe_icons/legend_nohrsc_chg.png"; } else if (id=="snowNOHRSCdepth") { document["legend2"].src="/data/icons/swe_icons/legend_nohrsc_depth.png"; } else { document["legend2"].src="/data/icons/"+PNGtypeName[type+time]+"_colorTable.png"; } var url2 = ""; if (time == "24Chg" && PNGimgnum[type+time2] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { var url = "/data/icons/24Change_NA.png"; } else if (type == "radar") { var url = "/archive/radar/images/"+time2+"_"+type+"_"+PNGimgnum[type+time]+"_Mercator.png?random="+Math.random(); } else if (type == "QPFverif") { var dayNum = document.getElementById('QPFverifSelect').value; var dateString = document.getElementById('datepicker').value; var newDate = new Date((dateString)); var url = "/archive/googlePrecipVerif/Day"+dayNum+"_"+type+"_"+newDate.f("yyyyMMdd")+"_Mercator.png?random="+Math.random(); } else if (type == "QPFverifCompare") { var dayNum = document.getElementById('QPFverifSelect').value; var dateString = document.getElementById('datepicker').value; var newDate = new Date((dateString)); var url = "/archive/googlePrecipVerif/Day"+dayNum+"_QPF_"+newDate.f("yyyyMMdd")+"_Mercator.png?random="+Math.random(); var url2 = "/archive/googlePrecipVerif/QPE_"+newDate.f("yyyyMMdd")+"_Mercator.png?random="+Math.random(); } else if (type.substr(0,10) == "QPEmonthly" || type.substr(0,5) == "QPEWY") { var thisType = id; var year = document.forms["data_"+name3].elements["year"+name3].value; var month = document.forms["data_"+name3].elements["month"+name3].value; var url = "/archive/googlePrecipMonthly/"+thisType+"_"+year+month+"_Mercator.png?random="+Math.random(); } else if (time == "custom" && type == "MQC") { var url = "/archive/googlePrecipMonthly/"+window.dateStamp+".png?random="+Math.random(); } else if (time == "custom") { var url = "/data/kml/6hr_"+type+"_custom.png?random="+Math.random(); } else if (type == "QPF") { var url = "/data/png/"+time+"_"+type+"_"+PNGimgnum[type+time2]+".png?random="+Math.random(); } else if (id == "snowNOHRSC") { if (document.getElementById('NOHRSCDateBox')) { var nohrsc_date = document.getElementById('NOHRSCDateBox').value; var url = "/archive/nohrsc/nohrsc_swe_"+nohrsc_date+"_Mercator.png?random="+Math.random(); } else { var url = "/data/png/nohrsc_swe_Mercator.png?random="+Math.random(); } } else if (id == "snowNOHRSCCHG") { if (document.getElementById('NOHRSCDateBox')) { var nohrsc_date = document.getElementById('NOHRSCDateBox').value; var url = "/archive/nohrsc/nohrsc_swe_change_24hr_"+nohrsc_date+"_Mercator.png?random="+Math.random(); } else { var url = "/data/png/nohrsc_swe_change_24hr_Mercator.png?random="+Math.random(); } } else if (id == "snowNOHRSCdepth") { if (document.getElementById('NOHRSCDateBox')) { var nohrsc_date = document.getElementById('NOHRSCDateBox').value; var url = "/archive/nohrsc/nohrsc_depth_"+nohrsc_date+"_Mercator.png?random="+Math.random(); } else { var url = "/data/png/nohrsc_depth_Mercator.png?random="+Math.random(); } } else { var url = "/data/png/"+time+"_"+type+"_"+PNGimgnum[type+time2]+".png?random="+Math.random(); } //alert(url); proj = "EPSG:3857"; if ((id == "snowNOHRSC" || id == "snowNOHRSCCHG" || id == "snowNOHRSCdepth") && document.getElementById('NOHRSCDateBox')) { if (nohrsc_date >= "20210202" && nohrsc_date <= "20211209") { url = url.replace("_Mercator", ""); proj = "EPSG:4326"; } } if (archiveProds.indexOf(id) > -1) { if (briefing == 0) { var curmo2 = ""; var typeA = "fcstPointsFcst"; var yearA = "2024"; var monthA = "Jul"; var month2A = "7"; //var thisType = document.forms["data_"].elements["typeArea"].value; var year = document.forms["data_"+name3].elements["year"+name3].value; var month = document.forms["data_"+name3].elements["month"+name3].value; if (month == 'Jan') { var month2 = 1; } else if (month == 'Feb') { var month2 = 2; } else if (month == 'Mar') { var month2 = 3; } else if (month == 'Apr') { var month2 = 4; } else if (month == 'May') { var month2 = 5; } else if (month == 'Jun') { var month2 = 6; } else if (month == 'Jul') { var month2 = 7; } else if (month == 'Aug') { var month2 = 8; } else if (month == 'Sep') { var month2 = 9; } else if (month == 'Oct') { var month2 = 10; } else if (month == 'Nov') { var month2 = 11; } else if (month == 'Dec') { var month2 = 12; } //if (curmo2 == "previous2" || curmo2 == "prev") { // var previousMonth = true; //} if (monthA == month && yearA == year) { var previousMonth = false; } else { var previousMonth = true; } MQCstampParse = MQCstamp.split(" "); MQCmonth = MQCstampParse[1]; if (MQCmonth == 'Jan') { MQCmonth = 0; } else if (MQCmonth == 'Feb') { MQCmonth = 1; } else if (MQCmonth == 'Mar') { MQCmonth = 2; } else if (MQCmonth == 'Apr') { MQCmonth = 3; } else if (MQCmonth == 'May') { MQCmonth = 4; } else if (MQCmonth == 'Jun') { MQCmonth = 5; } else if (MQCmonth == 'Jul') { MQCmonth = 6; } else if (MQCmonth == 'Aug') { MQCmonth = 7; } else if (MQCmonth == 'Sep') { MQCmonth = 8; } else if (MQCmonth == 'Oct') { MQCmonth = 9; } else if (MQCmonth == 'Nov') { MQCmonth = 10; } else if (MQCmonth == 'Dec') { MQCmonth = 11; } MQCday = MQCstampParse[2]; MQCyear = MQCstampParse[3]; MQCdate = new Date(MQCyear,MQCmonth,MQCday,23,59,59); var dateString = month2 + "/" + daysInMonth(month2,year) + "/" + year; var newDate = new Date((dateString)); if (MQCdate >= newDate) { if (newDate.getTimezoneOffset() == 420) { var timeVar = "5:00 AM PDT"; } else { var timeVar = "4:00 AM PST"; } document.getElementById("briefingValidTime").innerHTML = newDate.f("E NNN d yyyy") + " at " + timeVar; document.getElementById('briefingValidTimeMaster').style.display = 'block'; } else { //$("#briefingValidTime").load("/data/kml/MQC_timestamp.txt"); document.getElementById("briefingValidTime").innerHTML = MQCstamp; document.getElementById('briefingValidTimeMaster').style.display = 'block'; } //var pngurl = "/archive/googlePrecipMonthly/"+thisType+"_"+year+month+".png"; $("#briefingCreatedTime").load("/includes/timeStamp2.php?imgFile="+url.split('?')[0]+"&fontSize=10"); document.getElementById('briefingCreatedTimeMaster').style.display = 'block'; } } var allPNGtypes = PNGtypes.concat(PNGtypes2); for (x in allPNGtypes) { var PNGtype = allPNGtypes[x]; //console.log(PNGtypeName[type+time2] + " " + PNGtypeName[PNGtype] + " " + PNGtype); if (PNGtypeName[type+time2] == PNGtypeName[PNGtype]) { if (briefing == "0") { if (type+time == PNGtype) { document.getElementById(PNGtype).checked = true; } else { document.getElementById(PNGtype).checked = false; } } } } var img = new Image(); //$('img').on('load',function () { // loadingOff(); //}); $('img').on('error',function () { //loadingOff(); //$( "#dialog-modal" ).dialog( "open" ); }); img.src=url; if (type == "radar") { ib = imageBoundsRadar; } else if (type == "snow") { if (proj == "EPSG:3857") { ib = imageBoundsNOHRSC; } else { ib = imageBoundsNOHRSC4326; } } else if (type == "MQC" && time=="custom") { ib = imageBoundsMQCcustom; } else { ib = imageBounds; } //UNLOAD ANY PREVIOUSLY-LOADED IMAGES if (PNGimg[PNGtypeName[type+time2]] != "" && PNGimg[PNGtypeName[type+time2]] != "undefined" && typeof PNGimg[PNGtypeName[type+time2]] != "undefined") { map.removeLayer(PNGimg[PNGtypeName[type+time2]]); stopListener('image'); PNGimg[PNGtypeName[type+time2]] = ""; } if (PNGimg2[PNGtypeName[type+time2]] != "" && PNGimg2[PNGtypeName[type+time2]] != "undefined" && typeof PNGimg2[PNGtypeName[type+time2]] != "undefined") { map.removeLayer(PNGimg2[PNGtypeName[type+time2]]); stopListener('image'); PNGimg2[PNGtypeName[type+time2]] = ""; } if (gridIDarchive != "") { map.removeLayer(gridIDarchive); gridIDarchive = ""; } if (time=="custom") { PNGimg[PNGtypeName[type+time2]] = loadImageLayer(url,ib,true,proj); } else { PNGimg[PNGtypeName[type+time2]] = loadImageLayer(url,ib,false,proj); } //loadImageLayer(url,ib); if (url2 != "") { var img2 = new Image(); $('img2').on('load',function () { //loadingOff(); }); img2.src=url2; if (type == "radar") { ib = imageBoundsRadar; } else { ib = imageBounds; } PNGimg2[PNGtypeName[type+time2]] = loadImageLayer(url2,ib,false,proj); //PNGimg[PNGtypeName[type+time2]].getPanes().overlayLayer.style['zIndex'] = 1002; //alert(kml['BASINS'].kmlLayer.getMap()); } if (time == "24Chg" && PNGimgnum[type+time2] == 1 && (type == "MaxTFcst" || type == "MinTFcst")) { PNGimg[PNGtypeName[type+time2]].setOpacity(1.0); } else if (type == "QPFverifCompare") { var mainVal = $( "#imageslider" ).slider( "value" )/100; var val2 = $( "#"+PNGtypeName[type+time2]+"sliderCompare" ).slider( "value" )/100; PNGimg['QPFverif'].setOpacity(mainVal * val2); PNGimg2['QPFverif'].setOpacity(mainVal * (1-val2)); } else { PNGimg[PNGtypeName[type+time2]].setOpacity($( "#imageslider" ).slider( "value" )/100); } if (briefing == "1") { PNGimg[PNGtypeName[type+time2]].setOpacity(0.65); } window.type11 = type; makePNGlisteners(type,time,time2,id); if (document.getElementById(type+time2+'Animate')) { if (document.getElementById(type+time2+'Animate').checked) { AnimatePNG(type,document.getElementById(type+time2+'Animate').checked,time,type+time2+'Animate'); } else { //window.updateVar2 = setTimeout(function(){togglePNG(window.type11,true,window.time11,id);},dataRefreshInterval); window.updateVar2 = setTimeout(function(){togglePNG(type,true,time,id);},dataRefreshInterval); } } } else { window.id2 = ''; window.time11 = ''; window.type11 = ''; document.getElementById('gridOptions').style.display = 'none'; // alert("id is "+id+" and checked is false"); document.getElementById('cursorReadoutDiv').style.display = 'none'; document.getElementById('showElevDiv').style.display = 'none'; if (type == 'QPFverifCompare') { type = 'QPFverif'; } if (PNGimg[PNGtypeName[type+time2]] != "") { map.removeLayer(PNGimg[PNGtypeName[type+time2]]); stopListener('image'); PNGimg[PNGtypeName[type+time2]] = ""; } if (PNGimg2[PNGtypeName[type+time2]] != "") { map.removeLayer(PNGimg2[PNGtypeName[type+time2]]); stopListener('image'); PNGimg2[PNGtypeName[type+time2]] = ""; } document["legend2"].src="/data/icons/blank.png"; document["legend3"].src="/data/icons/blank.png"; //This is to fix clickable issues. /* var overlays = ["CNRFC","STATES","COUNTIES","HYDROGRAPHY","MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","WFOS","LAKES"]; for (var i = 0; i < overlays.length; i++) { var overlay = overlays[i]; if (kml[overlay].kmlLayer) { map.removeLayer(kml[overlay].kmlLayer); kml[overlay].kmlLayer = new ol.layer.Vector({source: new ol.source.Vector({format: new ol.format.KML(),projection: 'EPSG:3857',url: kml[overlay].url}),opacity:1.0}); map.addLayer(kml[overlay].kmlLayer); } } */ } //map.addLayer(citiesLayer); } function loadImageLayer(url,extent,custom,proj) { var custom = custom || false; var proj = proj || 'EPSG:3857'; if (url.indexOf("nohrsc") > -1) { if (proj == "EPSG:3857") { var size = [7000,4321]; } else { var size = [7680,3584]; } imageLayer = new ol.layer.Image({ source: new ol.source.ImageStatic({ url: url, imageSize: size, imageExtent: extent, projection: proj }), opacity: 0.65, type: imageLayer, zIndex: 1000 }); } else if (url.indexOf("radar") > -1) { imageLayer = new ol.layer.Image({ source: new ol.source.ImageStatic({ url: url, imageSize: [700,1300], imageExtent: extent }), opacity: 0.65, type: imageLayer, zIndex: 1000 }); } else if (custom) { imageLayer = new ol.layer.Image({ source: new ol.source.ImageStatic({ url: url, imageSize: [1245,1305], projection: 'EPSG:4326', imageExtent: extent }), opacity: 0.65, type: imageLayer, zIndex: 1000 }); } else { imageLayer = new ol.layer.Image({ source: new ol.source.ImageStatic({ url: url, imageSize: [1200,1600], imageExtent: extent }), opacity: 0.65, type: imageLayer, zIndex: 1000 }); } //loadingOn(); imageLayer.getSource().once('imageloadend',function() { /* //UNLOAD ANY PREVIOUSLY-LOADED IMAGES var type = window.type11; var time2 = window.time12; if (PNGimg[PNGtypeName[type+time2]] != "" && PNGimg[PNGtypeName[type+time2]] != "undefined" && typeof PNGimg[PNGtypeName[type+time2]] != "undefined") { map.removeLayer(PNGimg[PNGtypeName[type+time2]]); stopListener('image'); PNGimg[PNGtypeName[type+time2]] = ""; } if (PNGimg2[PNGtypeName[type+time2]] != "" && PNGimg2[PNGtypeName[type+time2]] != "undefined" && typeof PNGimg2[PNGtypeName[type+time2]] != "undefined") { map.removeLayer(PNGimg2[PNGtypeName[type+time2]]); stopListener('image'); PNGimg2[PNGtypeName[type+time2]] = ""; } if (gridIDarchive != "") { map.removeLayer(gridIDarchive); gridIDarchive = ""; } PNGimg[PNGtypeName[type+time2]] = imageLayer; */ loadingOff(); //console.log('done'); }); var key = imageLayer.getSource().on('change', function() { if (imageLayer.getSource().getState() == 'ready') { imageLayer.getSource().unByKey(key); console.log('done2'); } }); //console.log('added listener'); //imageLayer.on('mousemove',function() {//console.log('hey hey');}); map.addLayer(imageLayer); /* // Keep any boundary overlays above image layer: var overlays = ["CNRFC","STATES","COUNTIES","HYDROGRAPHY","MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","WFOS","LAKES"]; for (var i = 0; i < overlays.length; i++) { var overlay = overlays[i]; if (kml[overlay].kmlLayer) { map.removeLayer(kml[overlay].kmlLayer); map.addLayer(kml[overlay].kmlLayer); } } if (checkLayer(citiesLayer)) { map.removeLayer(citiesLayer); map.addLayer(citiesLayer); } if (checkLayer(satBG3)) { map.removeLayer(satBG3); map.addLayer(satBG3); } */ /* // Keep any markers on top of image layer: if (clickVar) { map.removeLayer(markerLayer); map.addLayer(markerLayer); } */ return imageLayer; } function reinitializePNG(type,checked,time,id){ makePNGlisteners(type,time,time2); if (window.updateVar2 != "") { clearTimeout(window.updateVar2); } window.updateVar2 = ""; if (document.getElementById(type+time2+'Animate')) { if (document.getElementById(type+time2+'Animate').checked) { AnimatePNG(type,document.getElementById(type+time2+'Animate').checked,time,type+time2+'Animate'); } else { window.updateVar2 = setTimeout(function(){togglePNG(window.type11,true,window.time11,id);},dataRefreshInterval); } } } function disablePNG(type,checked,time,id){ var time2 = time; if (type=="QPF" || id=="QPEcustom") { var allPNGtypes = PNGtypes.concat(PNGtypes2); for(var i=0; i cols) { col = 1; row++; } if (i == lines.length-1) { if (window.elevBlank) { loadElev(); } } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.point[latLng] = line; //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } }); if (type.substr(0,8) == "QPFverif") { var dayNum = document.getElementById('QPFverifSelect').value; var dateString = document.getElementById('datepicker').value; var newDate = new Date((dateString)); //txtFile2.open("GET", "/archive/googlePrecipVerif/QPE_"+newDate.f("yyyyMMdd")+".data", true); //console.log("/archive/googlePrecipVerif/QPE_"+newDate.f("yyyyMMdd")+".data.zip?random="+Math.random()); JSZipUtils.getBinaryContent("/archive/googlePrecipVerif/QPE_"+newDate.f("yyyyMMdd")+".data.zip?random="+Math.random(),function(err,data2) { if(err) { return; $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.point2[latLng] = parseFloat(line).toFixed(2); //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } }); } if ("" == "true") { avgSnowLevelLoaded = false; if (type == "QPF" && time == "6hr") { var url = "/data/kml/6hrFcst_FzLevel_"+PNGimgnum[type+time2]+".data.zip"; JSZipUtils.getBinaryContent(url + "?random="+Math.random(),function(err,data2) { if(err) { return; $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.point2[latLng] = parseFloat(line); //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } var url = "/data/kml/6hrFcst_FzLevel_"+(PNGimgnum[type+time2]+1)+".data.zip"; console.log(url); JSZipUtils.getBinaryContent(url + "?random="+Math.random(),function(err,data2) { if(err) { return; $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.point2[latLng] = (window.point2[latLng] + parseFloat(line)) * 0.5; //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } avgSnowLevelLoaded = true; }); }); } if (type == "QPF" && time == "24hr") { var url = "/data/kml/6hrFcst_FzLevel_"+(4*(PNGimgnum[type+time2]-1)+1)+".data.zip"; console.log(url); JSZipUtils.getBinaryContent(url + "?random="+Math.random(),function(err,data2) { if(err) { return; $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.point2[latLng] = parseFloat(line); //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } /* var url = "/data/kml/6hrFcst_FzLevel_"+(4*(PNGimgnum[type+time2]-1)+2)+".data.zip"; console.log(url); JSZipUtils.getBinaryContent(url + "?random="+Math.random(),function(err,data2) { if(err) { return; $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.point2[latLng] = window.point2[latLng] + parseFloat(line); //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } */ var url = "/data/kml/6hrFcst_FzLevel_"+(4*(PNGimgnum[type+time2]-1)+3)+".data.zip"; console.log(url); JSZipUtils.getBinaryContent(url + "?random="+Math.random(),function(err,data2) { if(err) { return; $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.point2[latLng] = window.point2[latLng] + parseFloat(line); //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } /* var url = "/data/kml/6hrFcst_FzLevel_"+(4*(PNGimgnum[type+time2]-1)+4)+".data.zip"; console.log(url); JSZipUtils.getBinaryContent(url + "?random="+Math.random(),function(err,data2) { if(err) { return; $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.point2[latLng] = window.point2[latLng] + parseFloat(line); //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } */ var url = "/data/kml/6hrFcst_FzLevel_"+(4*(PNGimgnum[type+time2]-1)+5)+".data.zip"; console.log(url); JSZipUtils.getBinaryContent(url + "?random="+Math.random(),function(err,data2) { if(err) { return; $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); //window.point2[latLng] = (window.point2[latLng] + parseFloat(line)) * 0.2; window.point2[latLng] = (window.point2[latLng] + parseFloat(line)) * 0.333; //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } avgSnowLevelLoaded = true; }); }); }); /* }); }); */ } } } function loadDataOld(type,time,time2,id) { console.log('called old loadData routine'); var type = type || 'nothing'; if (type == 'nothing') { return; } window.point = {}; window.point2 = {}; name3 = PNGtypeName[type+time2]; if (name3 = "QPE") { name3 = "precip"; } //window.point3 = {}; var txtFile = new XMLHttpRequest(); var txtFile2 = new XMLHttpRequest(); var txtFile3 = new XMLHttpRequest(); window.lines = new Array(); //alert('loading file: '+time+"_"+type+"_"+PNGimgnum[type+time2]+".data"); if (type.substr(0,8) == "QPFverif") { var dayNum = document.getElementById('QPFverifSelect').value; var dateString = document.getElementById('datepicker').value; var newDate = new Date((dateString)); txtFile.open("GET", "/archive/googlePrecipVerif/Day"+dayNum+"_QPF_"+newDate.f("yyyyMMdd")+".data", true); } else if (type.substr(0,10) == "QPEmonthly" || type.substr(0,5) == "QPEWY") { var thisType = id; var year = document.forms["data_"+name3].elements["year"+name3].value; var month = document.forms["data_"+name3].elements["month"+name3].value; txtFile.open("GET", "/archive/googlePrecipMonthly/"+thisType+"_"+year+month+".data", true); } else if (time == "custom") { txtFile.open("GET", "/data/kml/6hr_"+type+"_custom.data?random="+Math.random(), true); } else if (type == "QPF") { txtFile.open("GET", "/data/kml/"+time+"_"+type+"_"+PNGimgnum[type+time2]+".data?random="+Math.random(), true); } else { txtFile.open("GET", "/data/kml/"+time+"_"+type+"_"+PNGimgnum[type+time2]+".data?random="+Math.random(), true); } txtFile.onreadystatechange = function() { if (txtFile.readyState === 4) { // Makes sure the document is ready to parse. if (txtFile.status === 200) { // Makes sure it's found the file. allText = txtFile.responseText; window.lines = txtFile.responseText.split("\n"); // Will separate each line into an array //lines=allText; var rows = 218; var cols = 208; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } if (i == lines.length-1) { if (window.elevBlankOld) { loadElevOld(); } } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*20)/20).toFixed(2)+(Math.ceil(lon*20)/20).toFixed(2); //alert(latLng); window.point[latLng] = line; //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } } } } txtFile.send(null); if (type.substr(0,8) == "QPFverif") { var dayNum = document.getElementById('QPFverifSelect').value; var dateString = document.getElementById('datepicker').value; var newDate = new Date((dateString)); txtFile2.open("GET", "/archive/googlePrecipVerif/QPE_"+newDate.f("yyyyMMdd")+".data", true); txtFile2.onreadystatechange = function() { if (txtFile2.readyState === 4) { // Makes sure the document is ready to parse. if (txtFile2.status === 200) { // Makes sure it's found the file. allText = txtFile2.responseText; window.lines = txtFile2.responseText.split("\n"); // Will separate each line into an array //lines=allText; var rows = 218; var cols = 208; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines.length; i++) { line = window.lines[i]; if (col > cols) { col = 1; row++; } var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*20)/20).toFixed(2)+(Math.ceil(lon*20)/20).toFixed(2); //alert(latLng); window.point2[latLng] = parseFloat(line).toFixed(2); //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } } } } txtFile2.send(null); } } function loadElev() { window.lines2 = new Array(); window.elevBlank = false; //alert('loading file: '+time+"_"+type+"_"+PNGimgnum[type+time2]+".data"); JSZipUtils.getBinaryContent("/data/kml/topo.data.zip",function(err,data2) { if(err) { $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var data = new JSZip(data2); $.each(data.files, function(index,thisOne) { data = thisOne.asText(); //console.log(thisOne.name); }); window.lines2 = data.split("\n"); // Will separate each line into an array //lines=allText; var rows = 545; var cols = 520; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines2.length; i++) { line = window.lines2[i]; if (col > cols) { col = 1; row++; } //if (i == lines.length-2) { // alert(col+" x "+row); //} var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*50)/50).toFixed(2)+(Math.ceil(lon*50)/50).toFixed(2); //alert(latLng); window.elev[latLng] = line; //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } }); } function loadElevOld() { var txtFile = new XMLHttpRequest(); window.lines2 = new Array(); window.elevBlankOld = false; //alert('loading file: '+time+"_"+type+"_"+PNGimgnum[type+time2]+".data"); txtFile.open("GET", "/data/kml/topo.data", true); txtFile.onreadystatechange = function() { if (txtFile.readyState === 4) { // Makes sure the document is ready to parse. if (txtFile.status === 200) { // Makes sure it's found the file. allText = txtFile.responseText; window.lines2 = txtFile.responseText.split("\n"); // Will separate each line into an array //lines=allText; var rows = 218; var cols = 208; var row = 1; var col = 1; var lat1 = 32.5; var lat2 = 43.375; var lon1 = -124.48; var lon2 = -114.105; var latSpacing = (lat2-lat1) / (rows-1); var lonSpacing = (lon2-lon1) / (cols-1); j=1; for (var i = 0; i< window.lines2.length; i++) { line = window.lines2[i]; if (col > cols) { col = 1; row++; } //if (i == lines.length-2) { // alert(col+" x "+row); //} var lat = (row-1) * latSpacing + lat1; var lon = (col-1) * lonSpacing + lon1; var latLng = (Math.ceil(lat*20)/20).toFixed(2)+(Math.ceil(lon*20)/20).toFixed(2); //alert(latLng); window.elev[latLng] = line; //marker = createMarkerPNGoverlay(lat,lon,line,4,3,6); col++; j++; } } } } txtFile.send(null); } function makePNGlisteners(type,time,time2,id) { //gmap.setOptions({ draggableCursor: 'crosshair' }); id = id || ""; if (id == "fromAnimate") { return; } //if (document.getElementById('cursorReadout').checked) { // loadData(type,time,time2); //} loadData(type,time,time2,id); //stopListener('click',true); startListener('image'); /* ol.maps.event.addListener(PNGimg[PNGtypeName[type+time2]],'mouseout',function(event) { nd(); }); */ } function zoomToFeature (id) { markerSource.getFeatureById(id).getStyle().getImage().setScale(1.0); coord = markerSource.getFeatureById(id).getGeometry().getCoordinates(); map.setView(new ol.View({center: coord, zoom: 9})); } function selectFeature (id) { markerSource.getFeatureById(id).getStyle().getImage().setScale(1.4); if (markerSource.getFeatureById(id).getStyle().getText()) { window.prevFont = markerSource.getFeatureById(id).getStyle().getText().getFont(); markerSource.getFeatureById(id).getStyle().getText().setFont('900 14px Roboto'); window.prevOffsetY = markerSource.getFeatureById(id).getStyle().getText().getOffsetY(); markerSource.getFeatureById(id).getStyle().getText().setOffsetY(window.prevOffsetY - 6); window.prevOffsetX= markerSource.getFeatureById(id).getStyle().getText().getOffsetX(); markerSource.getFeatureById(id).getStyle().getText().setOffsetX(window.prevOffsetX +2); } markerSource.getFeatureById(id).getStyle().setZIndex(markerSource.getFeatureById(id).getStyle().getZIndex()*100000); markerSource.getFeatureById(id).changed(); } function deselectFeature (id) { markerSource.getFeatureById(id).getStyle().getImage().setScale(1.0); if (markerSource.getFeatureById(id).getStyle().getText()) { markerSource.getFeatureById(id).getStyle().getText().setFont(window.prevFont); markerSource.getFeatureById(id).getStyle().getText().setOffsetY(window.prevOffsetY); markerSource.getFeatureById(id).getStyle().getText().setOffsetX(window.prevOffsetX); } markerSource.getFeatureById(id).getStyle().setZIndex(markerSource.getFeatureById(id).getStyle().getZIndex()/100000); markerSource.getFeatureById(id).changed(); } function arrToObj(keys, vals) { if (typeof(keys) === 'undefined') { return; } var map = {}; keys.forEach(function (key, index) { map[key] = vals[index]; }); return map; } function markerCount (force) { //idMap, idMapDesc, idMapHead var archiveProdsWaterResources = ["monthlyFlow","resNormal","resNormalMajor","resCap","resCapMajor"]; var archiveProdsPrecip = ["PPS","PPM","PNS","PNM","QPEmonthly","QPEmonthlyPercentNormal","QPEmonthlyDeparture","QPEmonthlyNormal","QPEWY","QPEWYPercentNormal","QPEWYDeparture","QPEWYNormal","basinPrecip","basinPrecipSeasonal","hucPrecip","hucPrecipSeasonal","fgroups"]; var archiveProdsSnow = ["SWM","SNM","SWEbasins","SWEbasinslower","SWEbasinsAll","SWEbasinsapr1","SWEbasinsapr1lower","SWEbasinsapr1All","SWEbasinsVal","SWEbasinsVallower","SWEbasinsValAll"]; var unitsArray = arrToObj(idMap,idMapUnits); var force = force || false var featuresinBox = []; if (markerLayer && checkLayer(markerLayer)) { if (0) { document.getElementById('dataMode').style.display = 'block'; } var product = ""; var boxes = document.getElementsByName("box"); for(var i = 0; i < boxes.length; i++) { if (boxes[i].checked) { product = boxes[i].id; } } if (product != '' && document.getElementById(product)) { var tryThis = $('#'+product).attr('description'); } if (archiveProdsWaterResources.indexOf(product) > -1) { banner = tryThis; var month = $('#monthwaterResources option:selected').text(); var year = $('#yearwaterResources option:selected').text(); banner = banner + " - " + month + " " + year; } else if (archiveProdsPrecip.indexOf(product) > -1) { banner = tryThis; var month = $('#monthprecip option:selected').text(); var year = $('#yearprecip option:selected').text(); banner = banner + " - " + month + " " + year; } else if (archiveProdsSnow.indexOf(product) > -1) { banner = tryThis; var month = $('#monthsnow option:selected').text(); var year = $('#yearsnow option:selected').text(); banner = banner + " - " + month + " " + year; } else if (tryThis != undefined) { banner = tryThis; } else { banner = ''; } var table = "
"+banner+"
"; if (unitsArray) { if (unitsArray[product] == '') { var unitString = ""; } else { var unitString = "
("+unitsArray[product]+")"; } } else { var unitString = ""; } // Table with fcst/obs stage/flow if (product == 'fcstPointsFcst' || product == 'otherPointsFcst' || product == 'zeroFCSTcombo' || product == 'oneFCSTcombo' || product == 'twoFCSTcombo' || product == 'threeFCSTcombo') { table=table+"\n"; var sortCol = 2; // Table with only obs stage/flow } else if (product == 'zeroFCST' || product == 'oneFCST' || product == 'twoFCST' || product == 'threeFCST' || product == 'zeroOTHER' || product == 'oneOTHER' || product == 'twoOTHER' || product == 'threeOTHER' || product == 'zeroRESERVOIR' || product == 'oneRESERVOIR' || product == 'twoRESERVOIR' || product == 'threeRESERVOIR') { if (product == 'zeroRESERVOIR' || product == 'oneRESERVOIR' || product == 'twoRESERVOIR' || product == 'threeRESERVOIR') { table=table+"
LocationMax Fcst Stage
(Feet)
Max Fcst Flow
(CFS)
Latest Obs Stage
(Feet)
Latest Obs Flow
(CFS)
\n"; } else { table=table+"
LocationObs Lake Elev
(Feet)
Obs Storage
(acre-ft)
\n"; } var sortCol = 2; // Table for ensPoints (no values) } else if (product == 'ensPoints') { table=table+"
LocationObs Stage
(Feet)
Obs Flow
(CFS)
\n"; var sortCol = 2; // All other tables } else { table=table+"
Location
\n"; var sortCol = 1; } markerLayer.getSource().forEachFeature(function(e) { if (ol.extent.containsCoordinate(map.getView().calculateExtent(map.getSize()), e.getGeometry().getCoordinates())) { featuresinBox.push(e); if (e.get('id').slice(-4) != 'test') { if (inIframe()) { if (product == 'ensPoints') { table=table+"\n"; } else { table=table+"\n"; } } else { if (product == 'ensPoints') { table=table+"\n"; } else { table=table+"\n"; } } } } }); count = featuresinBox.length; document.getElementById('gageCount').innerHTML = 'Markers: ' + numberWithCommas(count); table = table+"
LocationValue"+unitString+"
"+e.get('stn')+"
"+e.get('stn')+""+e.get('amt')+"
"+e.get('stn')+"
"+e.get('stn')+""+e.get('amt')+"
\n"; var arrays_same = (featuresinBox.length == oldMarkers.length) && featuresinBox.every(function(element, index) { return element === oldMarkers[index];}); //console.log('step 1'); if (!arrays_same || force) { //console.log('step 2'); //if ($("#dataTable", window.parent.document).hasClass("tablesorter")) { if ($("#markerTable", window.parent.document).dialog("isOpen")) { $('#markerTableInside', window.parent.document).html(table); if (sortList == '') { sortList2 = [[sortCol,1],[0,0]]; } else { sortList2 = sortList; } $("#dataTable", window.parent.document) .tablesorter({ sortList: sortList2 }) .tablesorterPager({container: $("#pager", window.parent.document), size: window.parent.document.getElementById('numPages').value, fixedHeight: true, page: window.pageNumber}) window.parent.document.getElementById('pagerWrapper').style.display = 'block'; ; $("#dataTable", window.parent.document).on("sortEnd", function(event) { sortList = event.target.config.sortList; }); positionPager(); } //} } oldMarkers = featuresinBox; //console.log("Hey, I found "+featuresinBox.length+" points on the map!!"); //console.log(featuresinBox); } } function prevMonth(name){ name = name.substring(name.indexOf('_')+1); var fromHome = "1"; var year = document.forms["data_"+name].elements["year"+name].value; var month = document.forms["data_"+name].elements["month"+name].value; var year2 = year; if (month == "Jan"){ var month2 = "Dec"; year2 = year-1; } else if (month == "Feb") { var month2 = "Jan"; } else if (month == "Mar") { var month2 = "Feb"; } else if (month == "Apr") { var month2 = "Mar"; } else if (month == "May") { var month2 = "Apr"; } else if (month == "Jun") { var month2 = "May"; } else if (month == "Jul") { var month2 = "Jun"; } else if (month == "Aug") { var month2 = "Jul"; } else if (month == "Sep") { var month2 = "Aug"; } else if (month == "Oct") { var month2 = "Sep"; } else if (month == "Nov") { var month2 = "Oct"; } else if (month == "Dec") { var month2 = "Nov"; } document.forms["data_"+name].elements["year"+name].value = year2; document.forms["data_"+name].elements["month"+name].value = month2; if (name == "snow") { document.forms["data_"+name].elements["year"+name+"2"].value = year2; document.forms["data_"+name].elements["month"+name+"2"].value = month2; } var day = "01"; if (document.getElementById("day"+name)) { day = document.getElementById("day"+name).value; } if (document.getElementById(window.id2)&&document.getElementById(window.id2).checked&&archiveProds.indexOf(window.id2)>-1) { toggleKML2(document.getElementById(window.id2).checked, window.id2, 0, name); //whichPlottingFunction(document.getElementById(type).checked, window.id2, 0, month2,year2,name) } if (document.getElementById(window.imageType)&&document.getElementById(window.imageType).checked) { //toggleKML2(document.getElementById(type).checked, type, 0, name); whichPlottingFunction(document.getElementById(window.imageType).checked, window.imageType, 0, month2,year2,name,false,day) } if (fromHome != 1) { document.getElementById('monthText').value = month2; document.getElementById('yearText').value = year2; // document.getElementById('monthTextArea').value = month2; // document.getElementById('yearTextArea').value = year2; } document.getElementById('monthKML').value = month2; document.getElementById('yearKML').value = year2; //document.getElementById('monthKMLArea').value = month2; //document.getElementById('yearKMLArea').value = year2; } function nextMonth(name){ name = name.substring(name.indexOf('_')+1); var year = parseInt(document.forms["data_"+name].elements["year"+name].value); var month = document.forms["data_"+name].elements["month"+name].value; var type = window.id2; var year2 = year; if (month == "Jan"){ var month2 = "Feb"; } else if (month == "Feb") { var month2 = "Mar"; } else if (month == "Mar") { var month2 = "Apr"; } else if (month == "Apr") { var month2 = "May"; } else if (month == "May") { var month2 = "Jun"; } else if (month == "Jun") { var month2 = "Jul"; } else if (month == "Jul") { var month2 = "Aug"; } else if (month == "Aug") { var month2 = "Sep"; } else if (month == "Sep") { var month2 = "Oct"; } else if (month == "Oct") { var month2 = "Nov"; } else if (month == "Nov") { var month2 = "Dec"; } else if (month == "Dec") { var month2 = "Jan"; year2 = year+1; } document.forms["data_"+name].elements["year"+name].value = year2; document.forms["data_"+name].elements["month"+name].value = month2; if (name == "snow") { document.forms["data_"+name].elements["year"+name+"2"].value = year2; document.forms["data_"+name].elements["month"+name+"2"].value = month2; } var day = "01"; if (document.getElementById("day"+name)) { day = document.getElementById("day"+name).value; } if (document.getElementById(window.id2)&&document.getElementById(window.id2).checked&&archiveProds.indexOf(window.id2)>-1) { toggleKML2(document.getElementById(window.id2).checked, window.id2, 0, name); //whichPlottingFunction(document.getElementById(type).checked, window.id2, 0, month2,year2,name) } if (document.getElementById(window.imageType)&&document.getElementById(window.imageType).checked) { //toggleKML2(document.getElementById(type).checked, type, 0, name); whichPlottingFunction(document.getElementById(window.imageType).checked, window.imageType, 0, month2,year2,name,false,day) } if (fromHome != 1) { document.getElementById('monthText').value = month2; document.getElementById('yearText').value = year2; // document.getElementById('monthTextArea').value = month2; // document.getElementById('yearTextArea').value = year2; } document.getElementById('monthKML').value = month2; document.getElementById('yearKML').value = year2; //document.getElementById('monthKMLArea').value = month2; //document.getElementById('yearKMLArea').value = year2; } function newMonth(name){ name = name.substring(name.indexOf('_')+1); var fromHome = "1"; var year2 = document.forms["data_"+name].elements["year"+name].value; var month2 = document.forms["data_"+name].elements["month"+name].value; document.forms["data_"+name].elements["year"+name].value = year2; document.forms["data_"+name].elements["month"+name].value = month2; if (name == "snow") { document.forms["data_"+name].elements["year"+name+"2"].value = year2; document.forms["data_"+name].elements["month"+name+"2"].value = month2; } var day = "01"; if (document.getElementById("day"+name)) { day = document.getElementById("day"+name).value; } if (document.getElementById(window.id2)&&document.getElementById(window.id2).checked&&archiveProds.indexOf(window.id2)>-1) { toggleKML2(document.getElementById(window.id2).checked, window.id2, 0, name); //whichPlottingFunction(document.getElementById(type).checked, window.id2, 0, month2,year2,name) } if (document.getElementById(window.imageType)&&document.getElementById(window.imageType).checked) { //toggleKML2(document.getElementById(type).checked, type, 0, name); whichPlottingFunction(document.getElementById(window.imageType).checked, window.imageType, 0, month2,year2,name,false,day) } if (fromHome != 1) { document.getElementById('monthText').value = month2; document.getElementById('yearText').value = year2; // document.getElementById('monthTextArea').value = month2; // document.getElementById('yearTextArea').value = year2; } document.getElementById('monthKML').value = month2; document.getElementById('yearKML').value = year2; //document.getElementById('monthKMLArea').value = month2; //document.getElementById('yearKMLArea').value = year2; } function prevDay(name){ name = name.substring(name.indexOf('_')+1); var fromHome = "1"; var oldYear = document.forms["data_"+name].elements["year"+name].value; var oldDay = document.forms["data_"+name].elements["day"+name].value; var oldMonth = document.forms["data_"+name].elements["month"+name].value var oldDate = new Date(oldMonth+' '+oldDay+', '+oldYear); var newDate = new Date(oldDate.getTime() - 86400000); var newMonth = newDate.f('NNN'); var newDay = newDate.f('dd'); var newYear = newDate.f('yyyy'); document.forms["data_"+name].elements["year"+name].value = newYear; document.forms["data_"+name].elements["day"+name].value = newDay; document.forms["data_"+name].elements["month"+name].value = newMonth; if (name == "snow") { document.forms["data_"+name].elements["year"+name+"2"].value = newYear; document.forms["data_"+name].elements["month"+name+"2"].value = newMonth; } var day = "01"; if (document.getElementById("day"+name)) { day = document.getElementById("day"+name).value; } if (document.getElementById(window.id2)&&document.getElementById(window.id2).checked&&archiveProds.indexOf(window.id2)>-1) { toggleKML2(document.getElementById(window.id2).checked, window.id2, 0, name); //whichPlottingFunction(document.getElementById(type).checked, window.id2, 0, month2,year2,name) } if (document.getElementById(window.imageType)&&document.getElementById(window.imageType).checked) { //toggleKML2(document.getElementById(type).checked, type, 0, name); whichPlottingFunction(document.getElementById(window.imageType).checked, window.imageType, 0, newMonth,newYear,name,false,day) } if (fromHome != 1) { document.getElementById('monthText').value = newMonth; document.getElementById('yearText').value = newYear; // document.getElementById('monthTextArea').value = month2; // document.getElementById('yearTextArea').value = year2; } document.getElementById('monthKML').value = newMonth; document.getElementById('yearKML').value = newYear; //document.getElementById('monthKMLArea').value = month2; //document.getElementById('yearKMLArea').value = year2; } function nextDay(name){ name = name.substring(name.indexOf('_')+1); var fromHome = "1"; var oldYear = document.forms["data_"+name].elements["year"+name].value; var oldDay = document.forms["data_"+name].elements["day"+name].value; var oldMonth = document.forms["data_"+name].elements["month"+name].value; var oldDate = new Date(oldMonth+' '+oldDay+', '+oldYear); var newDate = new Date(oldDate.getTime() + 86400000); var newMonth = newDate.f('NNN'); var newDay = newDate.f('dd'); var newYear = newDate.f('yyyy'); document.forms["data_"+name].elements["year"+name].value = newYear; document.forms["data_"+name].elements["day"+name].value = newDay; document.forms["data_"+name].elements["month"+name].value = newMonth; if (name == "snow") { document.forms["data_"+name].elements["year"+name+"2"].value = newYear; document.forms["data_"+name].elements["month"+name+"2"].value = newMonth; } var day = "01"; if (document.getElementById("day"+name)) { day = document.getElementById("day"+name).value; } if (document.getElementById(window.id2)&&document.getElementById(window.id2).checked&&archiveProds.indexOf(window.id2)>-1) { toggleKML2(document.getElementById(window.id2).checked, window.id2, 0, name); //whichPlottingFunction(document.getElementById(type).checked, window.id2, 0, month2,year2,name) } if (document.getElementById(window.imageType)&&document.getElementById(window.imageType).checked) { //toggleKML2(document.getElementById(type).checked, type, 0, name); whichPlottingFunction(document.getElementById(window.imageType).checked, window.imageType, 0, newMonth,newYear,name,false,day) } if (fromHome != 1) { document.getElementById('monthText').value = newMonth; document.getElementById('yearText').value = newYear; // document.getElementById('monthTextArea').value = month2; // document.getElementById('yearTextArea').value = year2; } document.getElementById('monthKML').value = newMonth; document.getElementById('yearKML').value = newYear; //document.getElementById('monthKMLArea').value = month2; //document.getElementById('yearKMLArea').value = year2; } function prevMonthArea(){ var year = document.forms["data_waterResources"].elements["yearArea"].value; var month = document.forms["data_waterResources"].elements["monthArea"].value; var type = document.forms["data_waterResources"].elements["typeArea"].value; var year2 = year; if (month == "Jan"){ var month2 = "Dec"; year2 = year-1; } else if (month == "Feb") { var month2 = "Jan"; } else if (month == "Mar") { var month2 = "Feb"; } else if (month == "Apr") { var month2 = "Mar"; } else if (month == "May") { var month2 = "Apr"; } else if (month == "Jun") { var month2 = "May"; } else if (month == "Jul") { var month2 = "Jun"; } else if (month == "Aug") { var month2 = "Jul"; } else if (month == "Sep") { var month2 = "Aug"; } else if (month == "Oct") { var month2 = "Sep"; } else if (month == "Nov") { var month2 = "Oct"; } else if (month == "Dec") { var month2 = "Nov"; } document.forms["data_waterResources"].elements["yearArea"].value = year2; document.forms["data_waterResources"].elements["monthArea"].value = month2; if (document.data_waterResources.archiveArea.checked) { whichPlottingFunction(document.data_waterResources.archiveArea.checked, document.data_waterResources.archiveArea.id, 0, document.data_waterResources.month.value,document.data_waterResources.year.value, "waterResources"); } if (fromHome != 1) { // document.getElementById('monthText').value = month2; // document.getElementById('yearText').value = year2; document.getElementById('monthTextArea').value = month2; document.getElementById('yearTextArea').value = year2; } //document.getElementById('monthKML').value = month2; //document.getElementById('yearKML').value = year2; document.getElementById('monthKMLArea').value = month2; document.getElementById('yearKMLArea').value = year2; } function nextMonthArea(){ var year = parseInt(document.forms["data_waterResources"].elements["yearArea"].value); var month = document.forms["data_waterResources"].elements["monthArea"].value; var type = document.forms["data_waterResources"].elements["typeArea"].value; var year2 = year; if (month == "Jan"){ var month2 = "Feb"; } else if (month == "Feb") { var month2 = "Mar"; } else if (month == "Mar") { var month2 = "Apr"; } else if (month == "Apr") { var month2 = "May"; } else if (month == "May") { var month2 = "Jun"; } else if (month == "Jun") { var month2 = "Jul"; } else if (month == "Jul") { var month2 = "Aug"; } else if (month == "Aug") { var month2 = "Sep"; } else if (month == "Sep") { var month2 = "Oct"; } else if (month == "Oct") { var month2 = "Nov"; } else if (month == "Nov") { var month2 = "Dec"; } else if (month == "Dec") { var month2 = "Jan"; year2 = year+1; } document.forms["data_waterResources"].elements["yearArea"].value = year2; document.forms["data_waterResources"].elements["monthArea"].value = month2; if (document.data_waterResources.archiveArea.checked) { whichPlottingFunction(document.data_waterResources.archiveArea.checked, document.data_waterResources.archiveArea.id, 0, document.data_waterResources.month.value,document.data_waterResources.year.value, "waterResources"); } if (fromHome != 1) { // document.getElementById('monthText').value = month2; // document.getElementById('yearText').value = year2; document.getElementById('monthTextArea').value = month2; document.getElementById('yearTextArea').value = year2; } //document.getElementById('monthKML').value = month2; //document.getElementById('yearKML').value = year2; document.getElementById('monthKMLArea').value = month2; document.getElementById('yearKMLArea').value = year2; } function inIframe () { try { return window.self !== window.top; } catch (e) { return true; } } function scriptEnd (file,allowCtrlClick) { if (typeof allowCtrlClick === "undefined") { allowCtrlClick = true; } var briefing = 0; //document.getElementById('gageCount').innerHTML = 'Total gages: ' + numberWithCommas(count); document.getElementById('gageCount').style.display = 'block'; if (!briefing) { if (allowCtrlClick ) { document.getElementById('ctrlClick').style.display = 'block'; } else { document.getElementById('ctrlClick').style.display = 'none'; } } loadingOff(); //$("#markerTable").load('/xmlTablePHP.php?file='+file); layerLoaded = true; //console.log('layer loaded'); } function loadingOff (products=1) { //console.log('OFF'); productCount += 1; if (productCount >= products) { document.getElementById('loading').style.display='none'; productCount = 0; } //console.log('render'); } function loadingOn () { //console.log('ON'); document.getElementById('loading').style.display='block'; } var getClosestValues = function(a, x,before) { before = before || false; var index = x.indexOf('/'); if (index > -1 ) { var first = pad(x.substring(0,index),2); var second = pad(x.substring(index+1),2); x = first+second; if (before) { return x; } } if (x 1) { var mid = Math.round((lo + hi)/2); if (a[mid] <= x) { lo = mid; } else { hi = mid; } } if (a[lo] == x) hi = lo; //return [a[lo], a[hi]]; return lo; } function pad(num, size) { var s = num+""; while (s.length < size) s = "0" + s; return s; } function geoCode(){ popupGEO.setPosition(undefined); var location=document.getElementById("geolocate"); address=location.value; id = address.toUpperCase(); window.idGEO = id; if (typeof window.stnLat[id] != 'undefined') { map.setView(new ol.View({center: ol.proj.transform([parseFloat(window.stnLon[id]),parseFloat(window.stnLat[id])], 'EPSG:4326', 'EPSG:3857'), zoom: 11})); mapSearchLabel(parseFloat(window.stnLat[id]),parseFloat(window.stnLon[id]),id); document.getElementById("geolocate").value = id; } else if (id.substr(0,1) == 'K' && id.length == 4 && typeof window.stnLat[id.substr(1,4)] != 'undefined') { id = id.substr(1,4); map.setView(new ol.View({center: ol.proj.transform([parseFloat(window.stnLon[id]),parseFloat(window.stnLat[id])], 'EPSG:4326', 'EPSG:3857'), zoom: 11})); mapSearchLabel(parseFloat(window.stnLat[id]),parseFloat(window.stnLon[id]),id); document.getElementById("geolocate").value = id; } /* else { geocoder = new ol.maps.Geocoder(); var gcReq={address:address}; geocoder.geocode(gcReq,function(point,status){ if (status == ol.maps.GeocoderStatus.OK){ latinput=point[0].geometry.location.lat(); loninput=point[0].geometry.location.lng(); gmap.setCenter(new ol.maps.LatLng(latinput,loninput)); gmap.setZoom(10); document.getElementById("geolocate").value = address.toTitleCase(); mapSearchLabel(latinput,loninput,address.toTitleCase()); } }); } */ } window.mapSearchLbl = ""; function mapSearchLabel(lat,lon,loc) { var coord = ol.proj.transform([lon,lat], 'EPSG:4326', 'EPSG:3857') popupGEO.setPosition(coord); popupDIVcontentGEO.innerHTML = window.idGEO; //popupGEODIV.style.display='block'; /* if (window.mapSearchLbl != "") { window.mapSearchLbl.setMap(null); window.mapSearchLbl = ""; } var latLng = new ol.maps.LatLng(lat, lon); var image = {url: '/images/misc/arrow.png', size: new ol.maps.Size(9,11), origin: new ol.maps.Point(0,0), anchor: new ol.maps.Point(4.5,0) }; window.mapSearchLbl = new MarkerWithLabel({ position: latLng, draggable: false, map: gmap, labelContent: loc, labelAnchor: new ol.maps.Point(0, -8), labelClass: "mapSearchLabel", // the CSS class for the label labelStyle: {opacity: 1.0}, icon: image, zIndex: 2, labelZIndex: 1 }); var iw1 = new ol.maps.InfoWindow({ // content: "Home For Sale" }); ol.maps.event.addListener(window.mapSearchLbl, "click", function (e) { window.mapSearchLbl.setMap(null); }); */ } String.prototype.toTitleCase = function() { var i, str, lowers, uppers; str = this.replace(/([^\W_]+[^\s-]*) */g, function(txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }); // Certain minor words should be left lowercase unless // they are the first or last words in the string lowers = ['A', 'An', 'The', 'And', 'But', 'Or', 'For', 'Nor', 'As', 'At', 'By', 'For', 'From', 'In', 'Into', 'Near', 'Of', 'On', 'Onto', 'To', 'With']; for (i = 0; i < lowers.length; i++) str = str.replace(new RegExp('\\s' + lowers[i] + '\\s', 'g'), function(txt) { return txt.toLowerCase(); }); // Certain words such as initialisms or acronyms should be left uppercase uppers = ['Id', 'Tv', 'Ca', 'Or', 'Nv']; for (i = 0; i < uppers.length; i++) str = str.replace(new RegExp('\\b' + uppers[i] + '\\b', 'g'), uppers[i].toUpperCase()); return str; } //alert("Location \""+address+"\" not found."); function manageFilters(checked,id) { if (id=="PW") { return; } //return; //console.log(checked+" | " + id); var briefing = "0"; if (briefing == 0) { if ((document.getElementById('flow2dateWY').checked || document.getElementById('flow2dateWYprev').checked || document.getElementById('espfcst').checked || document.getElementById('espfcstWY').checked || document.getElementById('wsfcst').checked || document.getElementById('resNormal').checked || document.getElementById('resNormalMajor').checked || document.getElementById('resCap').checked || document.getElementById('resCapMajor').checked || document.getElementById('monthlyFlow').checked) && id != 'fcstpeaks' && id != 'archive' && id != 'flow2dateWY' && id != 'flow2dateWYprev' && id != 'espfcst' && id != 'espfcstWY' && id != 'wsfcst') { } else { } document.getElementById('capacityfilter').style.display = 'none'; document.getElementById('QPEfilter').style.display = 'none'; document.getElementById('obsTempsfilter').style.display = 'none'; document.getElementById('SWEfilter').style.display = 'none'; document.getElementById('SDfilter').style.display = 'none'; document.getElementById('obsTempsChgfilter').style.display = 'none'; document.getElementById('SWEChgfilter').style.display = 'none'; document.getElementById('SDChgfilter').style.display = 'none'; document.getElementById('waterTempsfilter').style.display = 'none'; document.getElementById('categoryfilter').style.display = 'none'; document.getElementById('peakDatesfilter').style.display = 'none'; document.getElementById('estFilter').style.display = 'none'; document.getElementById('filters').style.display = 'none'; //if (document.getElementById('type')) { // var typeVar = document.getElementById('type').value; //} //console.log('window.id2 '+window.id2); //console.log('typeVar '+typeVar); if (checked) { if (window.id2 == 'ta18' || window.id2 == 'ta00' || window.id2 == 'ta06' || window.id2 == 'ta12' || window.id2 == 'taX' || window.id2 == 'taN' || window.id2 == 'pp18' || window.id2 == 'pp00' || window.id2 == 'pp06' || window.id2 == 'pp12' || window.id2 == 'pp24') { document.getElementById('estFilter').style.display = 'block'; } //console.log('window.id2 is '+window.id2); if (window.id2 == 'onehourP' || window.id2 == 'twohourP' || window.id2 == 'threehourP' ||window.id2 == 'sixhourP' || window.id2 == 'twelvehourP' || window.id2 == 'twentyfourhourP' || window.id2 == 'fourtyeighthourP' || window.id2 == 'seventytwohourP' || window.id2 == 'ninetysixhourP' || window.id2 == 'onetwentyhourP' || window.id2 == 'onefortyfourhourP' || window.id2 == 'onesixtyeighthourP' || window.id2 == 'sixhour18z' || window.id2 == 'sixhour00z' || window.id2 == 'sixhour06z' || window.id2 == 'sixhour12z' || window.id2 == 'twentyfourhour12z' || window.id2 == 'pp18' || window.id2 == 'pp00' || window.id2 == 'pp06' || window.id2 == 'pp12' || window.id2 == 'pp24' || window.id2=='PPS' || window.id2 == "PPM") { //console.log('turn filters on!!!'); document.getElementById('filters').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; document.getElementById('QPEfilter').style.display = 'block'; } else if (window.id2 == 'zerohourT' || window.id2 == 'onehourT' || window.id2 == 'twohourT' || window.id2 == 'threehourT' ||window.id2 == 'fourhourT' || window.id2 == 'fivehourT' || window.id2 == 'ta18' || window.id2 == 'ta00' || window.id2 == 'ta06' || window.id2 == 'ta12' || window.id2 == 'MxT' || window.id2 == 'MnT' || window.id2 == 'taX' || window.id2 == 'taN' || window.id2 == 'maxTday' || window.id2 == 'minTday') { document.getElementById('filters').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; document.getElementById('obsTempsfilter').style.display = 'block'; } else if (window.id2 == 'zeroSWE' || window.id2 == 'oneSWE' || window.id2 == 'twoSWE' || window.id2 == 'threeSWE' || window.id2 == 'fourSWE' || window.id2 == 'fiveSWE' || window.id2 == 'sixSWE' || window.id2 == 'sevenSWE' || window.id2=="PPS" || window.id2=="PPM" || window.id2=="SWM") { document.getElementById('filters').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; document.getElementById('SWEfilter').style.display = 'block'; } else if (window.id2 == 'zeroSD' || window.id2 == 'oneSD' || window.id2 == 'twoSD' || window.id2 == 'threeSD' || window.id2 == 'fourSD' || window.id2 == 'fiveSD' || window.id2 == 'sixSD' || window.id2 == 'sevenSD') { document.getElementById('filters').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; document.getElementById('SDfilter').style.display = 'block'; } else if (window.id2 == 'onehourTC' || window.id2 == 'twentyfourhourTC') { document.getElementById('filters').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; document.getElementById('obsTempsChgfilter').style.display = 'block'; } else if (window.id2 == 'oneDiffSWE' || window.id2 == 'threeDiffSWE' || window.id2 == 'fiveDiffSWE' || window.id2 == 'sevenDiffSWE' || window.id2 == 'fourteenDiffSWE' || window.id2 == 'thirtyDiffSWE') { document.getElementById('filters').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; document.getElementById('SWEChgfilter').style.display = 'block'; } else if (window.id2 == 'oneDiffSD' || window.id2 == 'threeDiffSD' || window.id2 == 'fiveDiffSD' || window.id2 == 'sevenDiffSD' || window.id2 == 'fourteenDiffSD' || window.id2 == 'thirtyDiffSD') { document.getElementById('filters').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; document.getElementById('SDChgfilter').style.display = 'block'; } else if (window.id2 == 'zerohourWT' || window.id2 == 'onehourWT' || window.id2 == 'twohourWT' || window.id2 == 'threehourWT' ||window.id2 == 'fourhourWT' || window.id2 == 'fivehourWT') { document.getElementById('filters').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; document.getElementById('waterTempsfilter').style.display = 'block'; } else if (window.id2 == 'wsfcst' || window.id2 == 'flow2dateWY' || window.id2 == 'flow2dateWYprev' || window.id2 == 'espfcst' || window.id2 == 'espfcstWY' || window.id2 == "resNormal" || window.id2 == "resNormalMajor" || window.id2 == "monthlyFlow") { //document.getElementById('gradCell').style.background = "#6666CC"; //document.getElementById('gradCell2').style.background = "#6699CC"; document.getElementById('filters').style.display = 'block'; document.getElementById('categoryfilter').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; } else if (window.id2 == "resCap" || window.id2 == "resCapMajor") { document.getElementById('filters').style.display = 'block'; document.getElementById('capacityfilter').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; } else if (window.id2 == 'zeroSWEavg' || window.id2 == 'aprSWEavg' || window.id2=="PNS" || window.id2 == "PNM" || window.id2 == "SNM") { //document.getElementById('gradCell').style.background = "no-repeat url('/images/misc/gradBack.png')"; //document.getElementById('gradCell2').style.background = "#00CCFF"; document.getElementById('filters').style.display = 'block'; document.getElementById('categoryfilter').style.display = 'block'; document.getElementById('gageCount').style.display = 'block'; document.getElementById('ctrlClick').style.display = 'block'; } else if (window.id2 == 'obspeaks' || window.id2 == 'fcstpeaks') { document.getElementById('filters').style.display = 'block'; document.getElementById('peakDatesfilter').style.display = 'block'; } else { if (document.getElementById('flow2dateWY').checked || document.getElementById('flow2dateWYprev').checked || document.getElementById('espfcst').checked || document.getElementById('espfcstWY').checked || document.getElementById('wsfcst').checked || document.getElementById('resNormal').checked || document.getElementById('resNormalMajor').checked || document.getElementById('resCap').checked || document.getElementById('resCapMajor').checked ) { } else { document.getElementById('gageCount').style.display = 'none'; document.getElementById('ctrlClick').style.display = 'none'; document.getElementById('filters').style.display = 'none'; } } } else { if (document.getElementById('flow2dateWY').checked || document.getElementById('flow2dateWYprev').checked || document.getElementById('espfcst').checked || document.getElementById('espfcstWY').checked || document.getElementById('wsfcst').checked || document.getElementById('resNormal').checked || document.getElementById('resNormalMajor').checked || document.getElementById('resCap').checked || document.getElementById('resCapMajor').checked ) { } else { document.getElementById('gageCount').style.display = 'none'; document.getElementById('ctrlClick').style.display = 'none'; document.getElementById('filters').style.display = 'none'; } } } } function LaunchCGIprogram(type) { loadingOn(); var result = jQuery.get("/gfe/scripts/make_PNG_web.cgi?imageA="+document.getElementById(type+'customMin').value+"&imageB="+(document.getElementById(type+'customMax').value-1)+"&type="+type); result.done(function() { loadingOff(); togglePNG(type,true,'custom', type+'custom'); }); result.fail(function() { loadingOff(); $( "#dialog-modal" ).dialog( "open" ); }); } window.dateStamp = ''; function LaunchCGIprogramMQC(type) { //alert('here we go!'); //document.getElementById('waterResourcesCustomButton').disabled = true; //document.getElementById('waterResourcesCustomButton').value = 'Please wait.......'; loadingOn(); // var result = jQuery.get("/gfe/scripts/make_PNG_mqc.cgi?startYear="+document.getElementById(type+'customMin').value+"&imageB="+(document.getElementById(type+'customMax').value-1)+"&type="+type); window.typeMQC = document.getElementById('MQCtype').value; window.MQCtype = $('#MQCtype option:selected').text(); var startYear = document.getElementById('startYear').value; var endYear = document.getElementById('endYear').value; window.startYear = startYear; window.endYear = endYear; window.numYears = endYear-startYear+1; if (startYear > endYear) { alert('Start year cannot be greater than end year.'); loadingOff(); exit; } //window.dateStamp = Date.now(); window.dateStamp = startYear+"."+endYear+"."+window.typeMQC; var result = jQuery.get("/gfe/scripts/make_PNG_mqc.cgi", {startYear: startYear, endYear: endYear, type: window.typeMQC, dateStamp: window.dateStamp}); result.done(function(data) { //console.log(data); //var data = data.replace(/<\/?[^>]+(>|$)/g, "").replace(/\r?\n|]r/g,"").split('.'); //var dateString = data[0]; //window.dateStamp = dateString; //var type2 = data[1]; togglePNG(type,true,'custom', type+'custom'); document.getElementById('MQCcustom').checked=true; loadingOff(); //document.getElementById('waterResourcesCustomButton').disabled = false; //document.getElementById('waterResourcesCustomButton').value = 'Generate Image'; }); result.fail(function() { loadingOff(); $( "#dialog-modal" ).dialog( "open" ); }); } function numberWithCommas(x) { var parts = x.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); } function checkPostRender() { link = getLink(); if (window.location.href != link && !window.location.href.includes("water_resources_update")) { //window.history.pushState('what', 'Title', link); window.history.replaceState('CNRFC', 'CNRFC - California Nevada River Forecast Center', link); } } function loadTabs(){ ident = arguments[0]; stn = arguments[1]; river = arguments[2]; info = arguments[3]; info = info.replace(/\"/gi, ''); var content1 = []; var html = ''+river+'
'+stn+'

Rollover links for more:  '; var j = 0; for (var i = 4; i < arguments.length; i = i + 3) { var content = "Click image below for more details:
"; if (i == 4) { content1[j] = content; } html = html + ''+arguments[i]+'  '; j+=1; } html = html + 'Station info
'; var j = 0; for (var i = 4; i < arguments.length; i = i + 3) { if (j == 0) { html = html + '
'+content1[j]+'
'; } else { html = html + ''; } j+=1; } html = html + ''; //alert(html); //html = html +'
'; //html = html +content1; //html = html + '
'; //console.log(html); // var html = "
"; return html; } var typeNum = parseInt("0"); $(function() { window.mapBG2 = "topo3"; $( "#accordion" ).accordion({ collapsible: true, heightStyle: "content", active:typeNum }); $( "#dialog-modal" ).dialog({ height: 140, modal: true, autoOpen: false }); $( "#noKML" ).dialog({ height: 140, modal: true, autoOpen: false }); $( "#mapBGdialog" ).dialog({ autoOpen: false, //width: 550, width: 685, open: function (event, ui) { var mapBGs = ["topo3","topo2","esriTopo","shadedRelief","satBG","natGeoMap","oceans","hucs","lightGray","federalLands"]; for (i=0; i -1) { var topFeature = 0; var topZIndex = -1; for (i = 0; i topZIndex && feature.get('type') == 'marker') { topZIndex = thisZIndex; topFeature = i; } } var feature = features[topFeature]; if (feature.get('type') == 'marker') { overlib(feature.get('html'), CAPTION,'
'+feature.get('river')+'
'+feature.get('location')+'
', FGCOLOR, feature.get('color'), BGCOLOR, '#000000', TEXTCOLOR, feature.get('textColor')); } if ($( "#markerTable", window.parent.document ).dialog( "isOpen" )) { $('#dataTable > tbody > tr', window.parent.document).each(function(){ $(this).removeClass('hoverClass'); }); $('#tr'+id[0], window.parent.document).addClass('hoverClass'); } map.getTarget().style.cursor = 'pointer'; } else { nd(); if ($( "#markerTable" , window.parent.document).dialog( "isOpen" )) { $('#dataTable > tbody > tr', window.parent.document).each(function(){ $(this).removeClass('hoverClass'); }); } map.getTarget().style.cursor = ''; } } }); } if (type == 'clickLink') { $(map.getViewport()).on('click', function(e) { var pixel = map.getEventPixel(e.originalEvent); var output = map.forEachFeatureAtPixel(pixel, function(feature, layer) { return {hit: true, feature: feature,layer:layer}; }); if (typeof output != 'undefined') { var hit = output.hit; var feature = output.feature; } else { var hit = false; } if (hit) { if (feature.get('link2') != "") { nd(); if (typeof feature.get('link2') != 'undefined') { window.open(feature.get('link2'),"_self") } } } }); } if (type == 'click') { $(map.getViewport()).on('mousedown', function(evt) { prevView = map.getView().getCenter(); }); map.on('click', function(evt) { var newView = map.getView().getCenter(); if (prevView != newView) { return; } if ((document.getElementById('debrisFlowBasinProb') && document.getElementById('debrisFlowBasinProb').checked) || (document.getElementById('debrisFlowBasinProb2') && document.getElementById('debrisFlowBasinProb2').checked) || (document.getElementById('debrisFlowBasinProb3') && document.getElementById('debrisFlowBasinProb3').checked)) { var viewResolution = /** @type {number} */ (map.getView().getResolution()); console.log(evt); return; var url = tileLayerSource.getFeatureInfoUrl( evt.coordinate, viewResolution, 'EPSG:3857',{'INFO_FORMAT': 'text/xml'}); if (url) { downloadUrl(url, function(data) { markers = data.documentElement.getElementsByTagName('FIELDS'); if (markers.length > 0) { P = markers[0].getAttribute("P"); P = P * 100.0; popupDIVcontent.innerHTML = 'Probability:
' + P.toFixed(0) + '%'; popup.setPosition(evt.coordinate); popup.setOffset([3,0]); } else { popup.setPosition(undefined); } }); } return; } // Check if control Key is pressed. If so, remove the top // marker under the cursor. Then exit without trying // to load the info popup. if (evt.originalEvent.ctrlKey) { var pixel = map.getEventPixel(evt.originalEvent); var features = []; var id = []; var featureTypes = []; var output = map.forEachFeatureAtPixel(pixel, function(feature) { features.push(feature); featureTypes.push(feature.get('type')); if (feature.get('type') == 'marker') { id.push(feature.get('id')); } }); if ($.inArray('marker',featureTypes) > -1) { for (i = 0; i -1) { //console.log(feature); //console.log(layer); var geometry = feature.getGeometry(); var coord = geometry.getCoordinates(); popupDIVcontent.innerHTML = feature.get('html'); //map.addOverlay(popup); popup.setPosition(coord); //popupDIV.style.display = 'block'; if (feature.get('name') != 'peaks') { popup.setOffset([4,-25]); } else { popup.setOffset([0,-6]); } window.thisLayer = layer; //shiftMap(coord,popup,popupDIV); } else { //popupDIV.style.display = 'none'; popup.setPosition(undefined); } }); $(map.getViewport()).on('mousemove', function(e) { var pixel = map.getEventPixel(e.originalEvent); //var features = []; var featureTypes = []; var id = []; var output = map.forEachFeatureAtPixel(pixel, function(feature) { //features.push(feature); featureTypes.push(feature.get('type')); if (feature.get('type') == 'marker') { id.push(feature.get('id')); } }); if ($.inArray('marker',featureTypes) > -1) { if ($( "#markerTable" , window.parent.document).dialog( "isOpen" )) { $('#dataTable > tbody > tr', window.parent.document).each(function(){ $(this).removeClass('hoverClass'); }); $('#tr'+id[0], window.parent.document).addClass('hoverClass'); } map.getTarget().style.cursor = 'pointer'; //console.log('this is when the table highlight should occur for id '+id[0]); } else { if ($( "#markerTable" , window.parent.document).dialog( "isOpen" )) { $('#dataTable > tbody > tr', window.parent.document).each(function(){ $(this).removeClass('hoverClass'); }); } if (imageVar) { map.getTarget().style.cursor = 'crosshair'; } else { map.getTarget().style.cursor = ''; } } }); } if (type == 'clickKML') { $(map.getViewport()).on('mousedown', function(evt) { prevView = map.getView().getCenter(); }); map.on('click', function(evt) { var newView = map.getView().getCenter(); if (prevView != newView) { return; } var pixel = map.getEventPixel(evt.originalEvent); var featureTypes = []; var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) { // console.log(feature.get('name')+" | " + feature.get('description')); // console.log(layer.get('name')); featureTypes.push(layer.get('name')); if (layer.get('name') == 'HUC' || layer.get('name') == 'rivers' || layer.get('name') == 'majorRivers' || layer.get('name') == 'burnareas' || layer.get('name') == 'debrisFlow' || layer.get('name') == 'wpcQpf') { return feature; } }); if ($.inArray('HUC',featureTypes) > -1 || $.inArray('rivers',featureTypes) > -1 || $.inArray('majorRivers',featureTypes) > -1 || $.inArray('burnareas',featureTypes) > -1 || $.inArray('debrisFlow',featureTypes) > -1 || $.inArray('wpcQpf',featureTypes) > -1) { var geometry = feature.getGeometry(); var coord = geometry.getCoordinates(); var coord = String(coord).split(','); var coord2 = [coord[0],coord[1]]; // popup.setPosition(coord2); var newCoord = map.getCoordinateFromPixel(pixel); if ($.inArray('rivers',featureTypes) > -1) { popupDIVcontent.innerHTML = '' + '' + feature.get('description') + '
'; } else if ($.inArray('majorRivers',featureTypes) > -1) { popupDIVcontent.innerHTML = '' + '' + feature.get('name') + '
'; } else if ($.inArray('burnareas',featureTypes) > -1) { popupDIVcontent.innerHTML = '' + '' + feature.get('name') + '
' + feature.get('description') + '
'; } else if ($.inArray('debrisFlow',featureTypes) > -1) { popupDIVcontent.innerHTML = '' + '' + feature.get('name') + '
' + Math.round(feature.get('description')*100) + '%
'; } else if ($.inArray('wpcQpf',featureTypes) > -1) { popupDIVcontent.innerHTML = '' + '' + feature.get('name') + '
'; } else { if (feature.get('description') === undefined) { popupDIVcontent.innerHTML = '' + '' + feature.get('name') + '' + '
'; } else { popupDIVcontent.innerHTML = '' + '' + feature.get('name') + '
' + feature.get('description') + '
'; } } //map.addOverlay(popup); popup.setPosition(newCoord); bubblePixel = pixel; //popupDIV.style.display = 'block'; popup.setOffset([0,0]); //shiftMap(newCoord,popup,popupDIV); } else { //popupDIV.style.display = 'none'; popup.setPosition(undefined); } }); } //console.log('time: '+window.time11+' type: '+window.type11); if (type == 'image') { $(map.getViewport()).on('mousemove', function(e) { var pixel = map.getEventPixel(e.originalEvent); var coord = map.getCoordinateFromPixel(pixel); var latlon = ol.proj.transform(coord, 'EPSG:3857', 'EPSG:4326') var lat = latlon[1]; var lon = latlon[0]; var time = window.time11; var time2 = window.time12; var type = window.type11; map.getTarget().style.cursor = 'crosshair'; if (window.whichData == 'old') { lat = (Math.ceil(lat*20)/20).toFixed(2); lon = (Math.ceil(lon*20)/20).toFixed(2); } else { lat = (Math.ceil(lat*50)/50).toFixed(2); lon = (Math.ceil(lon*50)/50).toFixed(2); } if (type.substr(0,8) == "QPFverif") { val = parseFloat(window.point[lat+lon]); val2 = parseFloat(window.point2[lat+lon]); } else { val = parseFloat(window.point[lat+lon]); } if ("" == "true") { val2 = parseFloat(window.point2[lat+lon]); } elev2 = parseFloat(window.elev[lat+lon]); if (elev2 == -300.) { elev2 = 0.; } if (!briefing) { //var thisType = document.forms["data_waterResources"].elements["typeArea"].value; var thisType = window.imageType; } else { var thisType = ""; } if (val == -9999. || (time == "24Chg" && PNGimgnum[type+time2] == 1 && (type == "MaxTFcst" || type == "MinTFcst"))) { nd(); //overlib(numberWithCommas(val.toFixed(decimals))+suffix+"
Elev: "+numberWithCommas(elev2.toFixed(0))+" ft.", FGCOLOR, '#AFDEF7', TEXTSIZE,2,TEXTCOLOR, 'black', WIDTH, 110, OFFSETX, 35, OFFSETY,20,BACKGROUND,'/data/icons/1px65opac.png'); } else { if (type.substr(0,4) == "MaxT" || type.substr(0,4) == "MinT" || type.substr(0,4) == "Temp" || type == "FzLevel" || thisType == "QPEmonthlyPercentNormal" || thisType == "QPEWYPercentNormal" || (time == "custom" && type == "MQC" && window.typeMQC == "percent")) { var decimals = 0; } else { var decimals = 2; } if (type.substr(0,4) == "MaxT" || type.substr(0,4) == "MinT" || type.substr(0,4) == "Temp") { var suffix = "°F"; var width = 50; } else if (type == "FzLevel") { var suffix = " ft."; var width=70; } else if (thisType == "QPEmonthlyPercentNormal" || thisType == "QPEWYPercentNormal" || (time == "custom" && type == "MQC" && window.typeMQC == "percent")) { var suffix = "%"; var width=50; } else { var suffix = " in."; var width=55; } if (type.substr(0,8) == "QPFverif") { var diff = (val-val2); } if ((time == "Departure" || time == "24Chg" || ((thisType == "QPEmonthlyDeparture" || thisType == "QPEWYDeparture") && document.getElementById(thisType).checked) || (time == "custom" && type == "MQC" && window.typeMQC == "departure") ) && val > 0) { var leadChar = "+"; } else if (type.substr(0,8) == "QPFverif" && diff > 0) { var leadChar = "+"; } else { var leadChar = ""; } if (type.substr(0,8) == "QPFverif") { var string = "Verification: " + leadChar + diff.toFixed(2)+" in.
QPF: "+val.toFixed(2)+" in.
QPE: "+val2.toFixed(2)+" in."; var width2=155; } else if ((thisType == "QPEmonthlyPercentNormal" || thisType == "QPEWYPercentNormal") && val < 0.0 && document.getElementById(thisType).checked) { var string = leadChar + "N/A" + suffix + " (Normal = 0.00 in.)"; var width2 = 175; } else { var string = leadChar + numberWithCommas(val.toFixed(decimals))+suffix; var width2 = 110; } if (typeof window.point[lat+lon] == 'undefined') { nd(); } else { var textSize = 2; if ("" == "true") { var textSize = 4; width = width + 35; if (window.type11 == "QPF" && (window.time11 == "6hr" || window.time11 == "24hr") && avgSnowLevelLoaded) { string = string + "
" + nearest100(parseFloat(window.point2[lat+lon])) + " ft."; } else { string = string; } } if (document.getElementById('showElev').checked) { overlib(string+"
Elev: "+numberWithCommas(elev2.toFixed(0))+" ft.", FGCOLOR, '#AFDEF7', TEXTSIZE,textSize,TEXTCOLOR, 'black', WIDTH, width2, OFFSETX, 35, OFFSETY,20,BACKGROUND,'/data/icons/1px65opac.png'); } else { overlib(string, FGCOLOR, '#AFDEF7', TEXTSIZE,textSize,TEXTCOLOR, 'black', WIDTH, width, OFFSETX, 35, OFFSETY,20,BACKGROUND,'/data/icons/1px65opac.png'); } } //gmap.setOptions({ draggableCursor: 'crosshair' }); } }); $(map.getViewport()).on('mouseout', function(e) { nd(); $("#WWAinfo").hide(); map.getTarget().style.cursor = ''; }); } } function stopListener(type,preserve,clearDataTable) { type = type || 'all'; preserve = preserve || false; var listenerTypes = ["image","mousemoveMarker","clickKML","click","clickLink"]; /* if (type == 'mousemoveMarker' || type == 'click' || type == 'image' || type == 'all') { $(map.getViewport()).off('mousemove'); } */ if (type == 'click' || type == 'clickLink' || type == 'all') { //$(map.getViewport()).off('click'); //popupDIV.style.display = 'none'; //popup.setPosition(undefined); //map.removeOverlay(popup); } $(map.getViewport()).off('mousemove'); $(map.getViewport()).off('mousedown'); $(map.getViewport()).off('click'); if (!preserve) { if (type == 'all') { for(var i=0; i mapwidth) { rightOffset = DIVright - mapwidth; } ////console.log("leftOffset: "+leftOffset+" topOffset: "+topOffset+" rightOffset:"+rightOffset); if (leftOffset > 0 || topOffset > 0 || rightOffset > 0) { var newPixel = [mapCenterX-leftOffset+rightOffset,mapCenterY-topOffset]; var newCoord = map.getCoordinateFromPixel(newPixel); map.setView(new ol.View({center: newCoord,zoom: parseInt(map.getView().getZoom())})); } } function loadKMZ(id,url,name,archive,opacity) { var name = name || ""; var archive = archive || false; var opacity = opacity || 1.0; var overlays = Array; JSZipUtils.getBinaryContent(url+"?random="+Math.random(),function(err,kmz) { if(err) { $( "#noKML" ).dialog( "open" ); throw err; // or handle err } var kml2 = new JSZip(kmz); $.each(kml2.files, function(index,thisOne) { kml2 = thisOne.asText(); //console.log(thisOne.name); }); var vector = new ol.layer.Vector({ source: new ol.source.Vector({format: new ol.format.KML(), //format: new ol.format.KML(), projection: 'EPSG:3857', text: kml2 }), opacity:opacity, name: name, zIndex:1040 }); if (name != "") { startListener('clickKML'); //console.log("fired up a listener for "+name); } if (archive) { if (gridIDarchive != "") { map.removeLayer(gridIDarchive); } if (gridIDarchive2 != "") { map.removeLayer(gridIDarchive2); } gridIDarchive = vector; gridIDarchive2 = ""; } else { if (kml[id].kmlLayer != "") { map.removeLayer(kml[id].kmlLayer); } kml[id].kmlLayer = vector; } map.addLayer(vector); var overlays = ["CNRFC","STATES","COUNTIES","HYDROGRAPHY","MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","WFOS","LAKES"]; if (overlays.indexOf(id) == -1) { vector.once("postcompose",function() { loadingOff(); var overlays = ["CNRFC","STATES","COUNTIES","HYDROGRAPHY","MAJORRIVERS","BASINS","BURNAREAS1","NATIONALPARKS","WFOS","LAKES"]; for(var j=0; j
National Weather Service California Nevada River Forecast Center Department of Commerce National Oceanic and Atmospheric Administration National Weather Service

NOAA / NWS News and Local CNRFC Information

Late December 2022-January 2023 and Late February-March 2023 Storm Summaries - The CNRFC has published two in-depth storm summaries documenting the historic period of storms affecting the region during the 2023 Water Year. The studies include a summary of winter conditions between December 2022 and March 2023, an analysis of observed precipitation data, a discussion of weather conditions and resulting hydrologic impacts, and a deep dive into precipitation verification. To view "Section 1: Late December 2022 and January 2023", visit the link here, and to view "Section 2: Late February and March 2023", visit the link here.

CNRFC ArcGIS StoryMap: 2023 Water Year Summary - The CNRFC has published an ArcGIS StoryMap reviewing the historic 2023 Water Year. This document provides a summary of the antecedent conditions, the series of winter storms to affect the region, the resulting impacts of these storms, and the prolonged spring and summer snowmelt period. To access this ArcGIS StoryMap, please visit the link here.

CNRFC Daily Briefing - View a graphical summary of current & forecast weather & hydrologic conditions. Updated by 10 AM PT.

Alert MessageAt Least One River Guidance (Flood Forecast) Point Is Currently or Forecast to Exceed Monitor StageAlert Message

 
Recently-Issued CNRFC Text Products:  
 

 Home Page Version:   Interactive Map  |  LegacyDownload map as PNG image.  Toggle data table on/off.  Expand or shrink map.    Permalink      
Geographic
Overlays
    2023    2022    2021
 

Topography

Topography/USGS

ESRI Topography

Shaded Relief

Imagery

Nat'l Geographic

Topo/Rivers

Topo/Hydro

Light Gray

Federal Lands
Legend for federal lands background layer.
 
The number inside each circle above represents the number of gages with observed conditions inside that category.
The number inside each circle above represents the number of gages with forecast conditions inside that category.
The number inside each circle above/below represents the number of gages with conditions inside that category.
Forecast
(large dots)
The number inside each circle above represents the number of gages with observed conditions inside that category.
The number inside each circle above represents the number of gages with forecast conditions inside that category.
The number inside each circle above/below represents the number of gages with conditions inside that category.
Observed
(small dots)



KML logoDownload Overlay Files Download Overlay Shapefiles


Rivers/Reservoirs

Deterministic 5-Day Forecasts 

Data updated:

Ensemble Forecasts
Data updated:


Peak Exceedance Probabilities*
Data updated:
10%25%50%75%90%
5-Day Peak
10-Day Peak
*Exceedance probabilities are only available for selected forecast points.

Observed Data
Data updated:

Latest Hour 1 Hr Ago 2 Hrs Ago 3 Hrs Ago
Forecast Points
Other Points
Reservoirs

Deterministic Forecast + Observed Data
Fcst data updated:
Obs data updated:
Forecast Points 
Link to





Significant River Flood Outlook
Data updated:
Valid:

      National Significant River Flood Outlook

Water Resources

Data updated (unless otherwise noted):


 

 








Monthly Archive
Month/Year:     

Reservoir Storage
(Data to 1925 for all reservoirs/1951 for "major")
% Normal % Capacity

Snow Data

National Gridded Data



Select date:     To:

Point Data
Data updated:
SWE
SWE Change



Data updated:
Snow Depth
Snow Depth Change

Daily Archive (Data back to Apr 2014)
M/D/Y:     
  Basin Elevation Zones % Avg % Apr 1
Avg
Value
Simulated
Basin
Avg
Middle/Upper
Lower/Only
All Zones

Monthly Archive (Data back to Jan 1998)
Month/Year:     
  % Avg Value
Point*
* Jan-Jun only prior to 2019.

Observed Precipitation (QPE)

Radar Data
 
 


Select radar time:  


Short-Range Point Data

Raw data updated:
QC data updated:   
Most Recent Hours (Raw):












6-Hour Totals (QC'd = Quality-Controlled)
Ending 18Z (11 AM PDT) Ending 00Z (5 PM PDT) Ending 06Z (11 PM PDT) Ending 12Z (5 AM PDT)
 
 
 
 
24-Hour Totals (QC'd = Quality-Controlled)



Short-Range Gridded Data
Images created:






     

Monthly/Water Year Archive (starts Oct 1996)
Month/Year:     
What is a Water Year?
    % Avg Value Departure Avg
Point Month
   
WY
   
Grid Month
WY
Basin
Avg
Month
     
WY
     
HUC8
Avg
Month
     
WY
     
Forecast
Group
WY
     


 From Water Year:   to: 

Forecast Precipitation (QPF)

CNRFC Forecast Data
Forecast issued:
 
 

Select forecast time:  


 

Select forecast time:  









     

WPC Forecast Data
Day 1 issued:
Day 2 issued:
Day 3 issued:
Days 1-3 issued:
Days 1-7 issued:
WPC 6-Hourly QPF
Select forecast time:  


WPC 24-Hourly QPF
Select forecast time:  


WPC 72-Hourly QPF

WPC 7-Day QPF

Observed Temperatures

Point Data
Data updated:
QC data updated:
Instantaneous Temperatures
Temp Change:
Max/Min Temperatures
24-Hour Max
Ending 12Z
(5 AM PDT)
24-Hour Min
Ending 12Z
(5 AM PDT)
Daytime
Max *
Overnight
Min **
* Updated: 10 PM   **Updated: 10 AM  

Gridded Data
Images created:
 
 

Select obs time:  











Forecast Temperatures

Basin Temperature Plots
Images created:


Forecast Temperature Grids
Images created:




  








  




Freezing Levels

Observed Freezing Levels
Images created:
  

Select forecast time:  


Forecast Freezing Levels
Forecast issued:
  

Select forecast time:  


Flash Flood Guidance/Debris Flow

Flash Flood Guidance Grids
Images created:



Note: Recent burn areas are typically more vulnerable to flash flooding and debris flows. Check with your local NWS Forecast Office for fire specific guidance.

Post-Wildfire Debris-Flow Basin Probability
Debris Flow Probability (peak 15-min rainfall intensity of 24 mm/hr)

More info: USGS post-wildfire debris-flow hazards

Water Temperatures

Data updated:






Climate/Drought

U.S. Drought Monitor

Select issuance date range:

From:     To:

Climate Prediction Center Outlooks
Drought Outlooks
Extended Range Outlooks
Precipitation
Temperatures
Long Lead Outlook
Precipitation
Temperatures

QPF Verification

24-Hour QPF Verification Grids
Images created:
Date: (ending 4am PST / 5am PDT) Select forecast to verify:
Day 1 forecast created Mon Jul 1, 2024


    QPE    
QPF

Watches/Warnings/Advisories

Last updated:
 

Map showing all 13 RFCs Northwest RFC Missouri Basin RFC North-Central RFC Ohio RFC Northeast RFC Mid-Atlantic RFC Southeast RFC Lower Mississippi RFC Arkansas-Red Basin RFC West Gulf RFC Colorado Basin RFC California Nevada RFC Alaska-Pacific RFC
Disclaimer

This image is currently not available. Please try again later.

The selected data is currently not available. Please check again later.

The "Download PNG" feature is not available in this browser. Please try a different browser.

Load a point data set to view data.


River Guidance Points Forecast Above Specified Stage Definitions  (Select NWS ID for Specified Graphical RVF)
NWS IDRiver / CreekGage / StationMonitor
Stage
Flood
Stage
Danger
Stage
Latest Observed
Stage / Flow
Latest Observed
Date / Time
Max Forecast
Stage / Flow
Forecast
Status
RVBC1SACRAMENTO RIO VISTA 7.411.912.97.6  /  NA07/02 12:45 AM PDT7.70  /  NAAbove Monitor

** NOTE **  Stage is presented in "Feet" while Flow (Storage at CLKC1) is presented in "cfs" ("Acre-Feet").

River Guidance Forecast Group Issuance and Next Update Times  (Select Forecast Group for Specified Text RVF)
FG IDForecast GroupIssuance TimeNext Update Time
SENorth Coast[ Alternate Link ]CSVJul 01 2024 at 7:29 AM PDTJul 02 2024 at 9:00 AM PDT
RNRussian Napa[ Alternate Link ]CSVJul 01 2024 at 7:27 AM PDTJul 02 2024 at 9:00 AM PDT
USAUpper Sacramento[ Alternate Link ]CSVJul 01 2024 at 7:17 AM PDTJul 02 2024 at 9:00 AM PDT
LSCLower Sacramento[ Alternate Link ]CSVJul 01 2024 at 7:24 AM PDTJul 02 2024 at 9:00 AM PDT
SJSan Joaquin[ Alternate Link ]CSVJul 01 2024 at 7:42 AM PDTJul 02 2024 at 9:00 AM PDT
CCCentral Coast[ Alternate Link ]CSVJul 01 2024 at 7:22 AM PDTJul 02 2024 at 9:00 AM PDT
SCASouthern California[ Alternate Link ]CSVJul 01 2024 at 7:18 AM PDTJul 02 2024 at 9:00 AM PDT
ESEastern Sierra[ Alternate Link ]CSVJul 01 2024 at 7:18 AM PDTJul 02 2024 at 9:00 AM PDT
HBTHumboldt[ Alternate Link ]CSVJul 01 2024 at 7:15 AM PDTJul 02 2024 at 9:00 AM PDT
SAC Sacramento Delta (Tides) [ Alternate Link ] Jul 01 2024 at 6:26 AM PDTJul 02 2024 at 9:00 AM PDT
 
** NOTE 1 **  The Klamath and North Coast river guidance points are included in the North Coast Forecast Group.
** NOTE 2 **  The Feather Yuba, American, and Cache Putah river guidance points are included in the Lower Sacramento River Forecast Group.
** NOTE 3 **  The Delta Region, Upper and Lower San Joaquin, and Tulare river guidance points are combined in the San Joaquin River Forecast Group.
** NOTE 4 **  The Salinas Pajaro and South Bay river guidance points are included in the Central Coast Forecast Group.
** NOTE 5 **  The Southern California and San Diego/Inland river guidance points are included in the Southern California Forecast Group.

CNRFC Daily Briefing
Observed Precipitation Graphical Discussion Forecast Precipitation
** Note ** Click on Indvidual Images to Expand.
OSZAR »