var layerLoadErrorMessages=[];showMessage('Loading',staticTemplates.loadingModal[mode]);
function runGeeViz(){
try{
	Map2.addSerializedLayer({"result": "0", "values": {"1": {"constantValue": [-124.85720095425737, 24.959288058753405]}, "0": {"functionInvocationValue": {"functionName": "Feature", "arguments": {"geometry": {"functionInvocationValue": {"functionName": "GeometryConstructors.Polygon", "arguments": {"coordinates": {"arrayValue": {"values": [{"arrayValue": {"values": [{"valueReference": "1"}, {"constantValue": [-66.97879243191109, 24.959288058753405]}, {"constantValue": [-66.97879243191109, 49.632344931561455]}, {"constantValue": [-124.85720095425737, 49.632344931561455]}, {"valueReference": "1"}]}}]}}, "geodesic": {"constantValue": false}}}}}}}}},{"layerType": "geeVector"},'Conterminous United States for PDSI Time Lapse (double click to zoom to)',false);
}catch(err){
	layerLoadErrorMessages.push("Error loading: Conterminous United States for PDSI Time Lapse (double click to zoom to)<br>GEE "+err);}
try{
	Map2.addSerializedLayer({"result": "0", "values": {"0": {"functionInvocationValue": {"functionName": "Feature", "arguments": {"geometry": {"functionInvocationValue": {"functionName": "GeometryConstructors.Polygon", "arguments": {"coordinates": {"constantValue": [[[-113.2053895191826, 41.82208938845069], [-113.2053895191826, 40.5655604972739], [-111.7002625660576, 40.5655604972739], [-111.7002625660576, 41.82208938845069]]]}, "geodesic": {"constantValue": false}}}}}}}}},{"layerType": "geeVector"},'Great Salt Lake Example Area for JRC Water Time Lapse (double click to zoom to)',false);
}catch(err){
	layerLoadErrorMessages.push("Error loading: Great Salt Lake Example Area for JRC Water Time Lapse (double click to zoom to)<br>GEE "+err);}
try{
	Map2.addSerializedLayer({"result": "0", "values": {"0": {"functionInvocationValue": {"functionName": "Feature", "arguments": {"geometry": {"functionInvocationValue": {"functionName": "GeometryConstructors.Polygon", "arguments": {"coordinates": {"constantValue": [[[104.48008284838329, 13.365070792606891], [104.48008284838329, 12.218730827637675], [106.08683333666454, 12.218730827637675], [106.08683333666454, 13.365070792606891]]]}, "geodesic": {"constantValue": false}}}}}}}}},{"layerType": "geeVector"},'Cambodia Example Area for Hansen Loss Time Lapse (double click to zoom to)',false);
}catch(err){
	layerLoadErrorMessages.push("Error loading: Cambodia Example Area for Hansen Loss Time Lapse (double click to zoom to)<br>GEE "+err);}
try{
	Map2.addSerializedLayer({"result": "0", "values": {"0": {"functionInvocationValue": {"functionName": "Feature", "arguments": {"geometry": {"functionInvocationValue": {"functionName": "GeometryConstructors.Polygon", "arguments": {"coordinates": {"constantValue": [[[-107.5198171213165, 38.080864394376015], [-107.5198171213165, 37.40759534811328], [-106.6189382150665, 37.40759534811328], [-106.6189382150665, 38.080864394376015]]]}, "geodesic": {"constantValue": false}}}}}}}}},{"layerType": "geeVector"},'Rio Grande National Forest Example Area for LCMS Loss Time Lapse (double click to zoom to)',true);
}catch(err){
	layerLoadErrorMessages.push("Error loading: Rio Grande National Forest Example Area for LCMS Loss Time Lapse (double click to zoom to)<br>GEE "+err);}
try{
	Map2.addSerializedTimeLapse({"result": "0", "values": {"0": {"functionInvocationValue": {"functionName": "ImageCollection.load", "arguments": {"id": {"constantValue": "JRC/GSW1_0/YearlyHistory"}}}}}},{"min": 1, "max": 3, "palette": ["ffffff", "99d9ea", "0000ff"], "addToClassLegend": true, "classLegendDict": {"1 Not Water": "ffffff", "2 Seasonal Water": "99d9ea", "3 Permanent Water": "0000ff"}, "queryDict": {"1": "1 Not Water", "2": "2 Seasonal Water", "3": "3 Permanent Water"}},'JRC Surface Water Time Lapse',false);
}catch(err){
	layerLoadErrorMessages.push("Error loading: JRC Surface Water Time Lapse<br>GEE "+err);}
try{
	Map2.addSerializedTimeLapse({"result": "0", "values": {"2": {"functionInvocationValue": {"functionName": "Image.constant", "arguments": {"value": {"argumentReference": "_MAPPING_VAR_0_0"}}}}, "1": {"functionInvocationValue": {"functionName": "Image.int16", "arguments": {"value": {"functionInvocationValue": {"functionName": "Element.set", "arguments": {"key": {"constantValue": "system:time_start"}, "object": {"functionInvocationValue": {"functionName": "Image.updateMask", "arguments": {"image": {"valueReference": "2"}, "mask": {"functionInvocationValue": {"functionName": "Image.eq", "arguments": {"image1": {"functionInvocationValue": {"functionName": "Image.int16", "arguments": {"value": {"functionInvocationValue": {"functionName": "Image.add", "arguments": {"image1": {"functionInvocationValue": {"functionName": "Image.select", "arguments": {"bandSelectors": {"constantValue": ["lossyear"]}, "input": {"functionInvocationValue": {"functionName": "Image.load", "arguments": {"id": {"constantValue": "UMD/hansen/global_forest_change_2022_v1_10"}}}}}}}, "image2": {"functionInvocationValue": {"functionName": "Image.constant", "arguments": {"value": {"constantValue": 2000}}}}}}}}}}, "image2": {"valueReference": "2"}}}}}}}, "value": {"functionInvocationValue": {"functionName": "Date.millis", "arguments": {"date": {"functionInvocationValue": {"functionName": "Date.fromYMD", "arguments": {"day": {"constantValue": 1}, "month": {"constantValue": 6}, "year": {"argumentReference": "_MAPPING_VAR_0_0"}}}}}}}}}}}}}, "0": {"functionInvocationValue": {"functionName": "ImageCollection.fromImages", "arguments": {"images": {"functionInvocationValue": {"functionName": "List.map", "arguments": {"baseAlgorithm": {"functionDefinitionValue": {"argumentNames": ["_MAPPING_VAR_0_0"], "body": "1"}}, "list": {"functionInvocationValue": {"functionName": "List.sequence", "arguments": {"end": {"constantValue": 2022}, "start": {"constantValue": 2001}}}}}}}}}}}},{"min": 2001, "max": 2022, "palette": "ffffe5,fff7bc,fee391,fec44f,fe9929,ec7014,cc4c02", "years": [2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022]},'Hansen Loss Time Lapse',true);
}catch(err){
	layerLoadErrorMessages.push("Error loading: Hansen Loss Time Lapse<br>GEE "+err);}
try{
	Map2.addSerializedTimeLapse({"result": "0", "values": {"2": {"functionInvocationValue": {"functionName": "Number.int16", "arguments": {"input": {"argumentReference": "_MAPPING_VAR_1_0"}}}}, "4": {"functionInvocationValue": {"functionName": "Image.select", "arguments": {"bandSelectors": {"constantValue": ["Change"]}, "input": {"argumentReference": "_MAPPING_VAR_0_0"}}}}, "3": {"functionInvocationValue": {"functionName": "ImageCollection.mosaic", "arguments": {"collection": {"functionInvocationValue": {"functionName": "Collection.filter", "arguments": {"collection": {"functionInvocationValue": {"functionName": "Collection.map", "arguments": {"baseAlgorithm": {"functionDefinitionValue": {"argumentNames": ["_MAPPING_VAR_0_0"], "body": "4"}}, "collection": {"functionInvocationValue": {"functionName": "ImageCollection.load", "arguments": {"id": {"constantValue": "USFS/GTAC/LCMS/v2022-8"}}}}}}}, "filter": {"functionInvocationValue": {"functionName": "Filter.calendarRange", "arguments": {"end": {"valueReference": "2"}, "field": {"constantValue": "year"}, "start": {"valueReference": "2"}}}}}}}}}}, "1": {"functionInvocationValue": {"functionName": "Element.set", "arguments": {"key": {"constantValue": "system:time_start"}, "object": {"functionInvocationValue": {"functionName": "Image.int16", "arguments": {"value": {"functionInvocationValue": {"functionName": "Image.updateMask", "arguments": {"image": {"functionInvocationValue": {"functionName": "Image.constant", "arguments": {"value": {"valueReference": "2"}}}}, "mask": {"functionInvocationValue": {"functionName": "Image.or", "arguments": {"image1": {"functionInvocationValue": {"functionName": "Image.eq", "arguments": {"image1": {"valueReference": "3"}, "image2": {"functionInvocationValue": {"functionName": "Image.constant", "arguments": {"value": {"constantValue": 2}}}}}}}, "image2": {"functionInvocationValue": {"functionName": "Image.eq", "arguments": {"image1": {"valueReference": "3"}, "image2": {"functionInvocationValue": {"functionName": "Image.constant", "arguments": {"value": {"constantValue": 3}}}}}}}}}}}}}}}}, "value": {"functionInvocationValue": {"functionName": "Date.millis", "arguments": {"date": {"functionInvocationValue": {"functionName": "Date.fromYMD", "arguments": {"day": {"constantValue": 1}, "month": {"constantValue": 6}, "year": {"valueReference": "2"}}}}}}}}}}, "0": {"functionInvocationValue": {"functionName": "ImageCollection.fromImages", "arguments": {"images": {"functionInvocationValue": {"functionName": "List.map", "arguments": {"baseAlgorithm": {"functionDefinitionValue": {"argumentNames": ["_MAPPING_VAR_1_0"], "body": "1"}}, "list": {"functionInvocationValue": {"functionName": "List.sequence", "arguments": {"end": {"constantValue": 2022}, "start": {"constantValue": 1985}}}}}}}}}}}},{"min": 1985, "max": 2022, "palette": "ffffe5,fff7bc,fee391,fec44f,fe9929,ec7014,cc4c02", "years": [1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022]},'LCMS Loss Time Lapse',true);
}catch(err){
	layerLoadErrorMessages.push("Error loading: LCMS Loss Time Lapse<br>GEE "+err);}
try{
	Map2.addSerializedTimeLapse({"result": "0", "values": {"6": {"functionInvocationValue": {"functionName": "Image.select", "arguments": {"bandSelectors": {"constantValue": ["pdsi"]}, "input": {"argumentReference": "_MAPPING_VAR_0_0"}}}}, "7": {"constantValue": "year"}, "5": {"functionInvocationValue": {"functionName": "Collection.map", "arguments": {"baseAlgorithm": {"functionDefinitionValue": {"argumentNames": ["_MAPPING_VAR_0_0"], "body": "6"}}, "collection": {"functionInvocationValue": {"functionName": "Collection.filter", "arguments": {"collection": {"functionInvocationValue": {"functionName": "ImageCollection.load", "arguments": {"id": {"constantValue": "GRIDMET/DROUGHT"}}}}, "filter": {"functionInvocationValue": {"functionName": "Filter.calendarRange", "arguments": {"end": {"constantValue": 2020}, "field": {"valueReference": "7"}, "start": {"constantValue": 2016}}}}}}}}}}, "8": {"functionInvocationValue": {"functionName": "Number.int16", "arguments": {"input": {"argumentReference": "_MAPPING_VAR_2_0"}}}}, "4": {"functionInvocationValue": {"functionName": "Collection.filter", "arguments": {"collection": {"valueReference": "5"}, "filter": {"functionInvocationValue": {"functionName": "Filter.calendarRange", "arguments": {"end": {"valueReference": "8"}, "field": {"valueReference": "7"}, "start": {"valueReference": "8"}}}}}}}, "9": {"functionInvocationValue": {"functionName": "ImageCollection.fromImages", "arguments": {"images": {"arrayValue": {"values": [{"functionInvocationValue": {"functionName": "Image.mask", "arguments": {"image": {"functionInvocationValue": {"functionName": "Collection.first", "arguments": {"collection": {"valueReference": "5"}}}}, "mask": {"functionInvocationValue": {"functionName": "Image.constant", "arguments": {"value": {"constantValue": 0}}}}}}}]}}}}}, "10": {"functionInvocationValue": {"functionName": "Number.int16", "arguments": {"input": {"argumentReference": "_MAPPING_VAR_1_0"}}}}, "3": {"functionInvocationValue": {"functionName": "Collection.filter", "arguments": {"collection": {"functionInvocationValue": {"functionName": "If", "arguments": {"condition": {"functionInvocationValue": {"functionName": "Number.gt", "arguments": {"left": {"functionInvocationValue": {"functionName": "List.length", "arguments": {"list": {"functionInvocationValue": {"functionName": "Collection.toList", "arguments": {"collection": {"valueReference": "4"}, "count": {"constantValue": 1}}}}}}}, "right": {"constantValue": 0}}}}, "falseCase": {"valueReference": "9"}, "trueCase": {"valueReference": "4"}}}}, "filter": {"functionInvocationValue": {"functionName": "Filter.calendarRange", "arguments": {"end": {"functionInvocationValue": {"functionName": "Number.int16", "arguments": {"input": {"functionInvocationValue": {"functionName": "Number.add", "arguments": {"left": {"valueReference": "10"}, "right": {"constantValue": 55}}}}}}}, "start": {"valueReference": "10"}}}}}}}, "11": {"functionInvocationValue": {"functionName": "Date.advance", "arguments": {"date": {"functionInvocationValue": {"functionName": "Date.fromYMD", "arguments": {"day": {"constantValue": 1}, "month": {"constantValue": 1}, "year": {"valueReference": "8"}}}}, "delta": {"functionInvocationValue": {"functionName": "Number.subtract", "arguments": {"left": {"valueReference": "10"}, "right": {"constantValue": 1}}}}, "unit": {"constantValue": "day"}}}}, "2": {"functionInvocationValue": {"functionName": "Element.set", "arguments": {"key": {"constantValue": "system:time_start"}, "object": {"functionInvocationValue": {"functionName": "Element.set", "arguments": {"key": {"constantValue": "system:index"}, "object": {"functionInvocationValue": {"functionName": "reduce.median", "arguments": {"collection": {"functionInvocationValue": {"functionName": "If", "arguments": {"condition": {"functionInvocationValue": {"functionName": "Number.gt", "arguments": {"left": {"functionInvocationValue": {"functionName": "List.length", "arguments": {"list": {"functionInvocationValue": {"functionName": "Collection.toList", "arguments": {"collection": {"valueReference": "3"}, "count": {"constantValue": 1}}}}}}}, "right": {"constantValue": 0}}}}, "falseCase": {"valueReference": "9"}, "trueCase": {"valueReference": "3"}}}}}}}, "value": {"functionInvocationValue": {"functionName": "Date.format", "arguments": {"date": {"valueReference": "11"}, "format": {"constantValue": "yyyy-MM-dd"}}}}}}}, "value": {"functionInvocationValue": {"functionName": "Date.millis", "arguments": {"date": {"valueReference": "11"}}}}}}}, "1": {"functionInvocationValue": {"functionName": "Collection", "arguments": {"features": {"functionInvocationValue": {"functionName": "List.map", "arguments": {"baseAlgorithm": {"functionDefinitionValue": {"argumentNames": ["_MAPPING_VAR_1_0"], "body": "2"}}, "list": {"functionInvocationValue": {"functionName": "List.sequence", "arguments": {"end": {"constantValue": 365}, "start": {"constantValue": 1}, "step": {"constantValue": 56}}}}}}}}}}, "0": {"functionInvocationValue": {"functionName": "Collection.flatten", "arguments": {"collection": {"functionInvocationValue": {"functionName": "Collection", "arguments": {"features": {"functionInvocationValue": {"functionName": "List.map", "arguments": {"baseAlgorithm": {"functionDefinitionValue": {"argumentNames": ["_MAPPING_VAR_2_0"], "body": "1"}}, "list": {"functionInvocationValue": {"functionName": "List.sequence", "arguments": {"end": {"constantValue": 2020}, "start": {"constantValue": 2016}}}}}}}}}}}}}}},{"min": -5, "max": 5, "palette": "F00,888,00F", "dateFormat": "YYYYMMdd", "advanceInterval": "day"},'PDSI Time Lapse',true);
}catch(err){
	layerLoadErrorMessages.push("Error loading: PDSI Time Lapse<br>GEE "+err);}
if(layerLoadErrorMessages.length>0){showMessage("Map.addLayer Error List",layerLoadErrorMessages.join("<br>"));}
setTimeout(function(){if(layerLoadErrorMessages.length===0){$('#close-modal-button').click();}}, 2500);
synchronousCenterObject({"geodesic": false, "type": "Polygon", "coordinates": [[[-107.5198171213165, 37.40759534811328], [-106.6189382150665, 37.40759534811328], [-106.6189382150665, 38.080864394376015], [-107.5198171213165, 38.080864394376015], [-107.5198171213165, 37.40759534811328]]]})
queryWindowMode = "sidePane"
}