private IExtractResult StateUHPI(int NormalLevel, string[] files, Dictionary <string, StatInfo> result) { float sum = 0; List <string[]> valueItems = new List <string[]>(); string DateStr = GetStringArgument("DateStr"); foreach (string key in result.Keys) { foreach (UInt16 level in result[key].UHPI.Keys) { sum += level * ((float)result[key].UHPI[level] / result[key].totalCount); } valueItems.Add(new string[] { DataIdentifyMatcher.GetOrbitDateTime(key).AddHours(8).ToString(DateStr), Math.Round((1f / NormalLevel) * sum, 2).ToString() }); sum = 0; } string title = "统计日期:" + DateTime.Now.ToShortDateString(); string[] columns = new string[] { "日期", "比例指数" }; IStatResult statResult = new StatResult(title, columns, valueItems.ToArray()); string filename = StatResultToFile(files, statResult, "UHE", "UHPI", "比例指数", string.Empty, 1, false); FileExtractResult fileResult = new FileExtractResult("UHPI", filename); fileResult.Add2Workspace = true; fileResult.SetDispaly(false); return(fileResult); }
private IExtractResult StateAreaCol(int NormalLevel, string[] files, Dictionary <string, StatInfo> result, int HILevel) { string[] normalDesc = GetStringArray("NormalDesc"); List <string[]> valueItems = new List <string[]>(); List <string> temp = null; List <string> columnList = new List <string>(); columnList.Add("日期"); string DateStr = GetStringArgument("DateStr"); for (UInt16 col = 0; col < HILevel; col++) { columnList.Add(normalDesc == null || col >= normalDesc.Length ? (NormalLevel - col).ToString() : normalDesc[col]); } IRasterDataProvider rdp = GeoDataDriver.Open(files[0]) as IRasterDataProvider; double areaBase = 0f; areaBase = GetAreaBase(rdp, areaBase); foreach (string key in result.Keys) { temp = new List <string>(); temp.Add(DataIdentifyMatcher.GetOrbitDateTime(key).AddHours(8).ToString(DateStr)); for (UInt16 level = 0; level < HILevel; level++) { if (!result[key].UHPI.ContainsKey((UInt16)(NormalLevel - level))) { temp.Add("0"); } else { temp.Add(Math.Round(result[key].UHPI[(UInt16)(NormalLevel - level)] * areaBase / Math.Pow(10, 6), 2).ToString()); } } valueItems.Add(temp.ToArray()); } string title = "统计日期:" + DateTime.Now.ToShortDateString() + " 面积单位:平方公里"; string[] columns = columnList.ToArray(); IStatResult statResult = new StatResult(title, columns, valueItems.ToArray()); string filename = StatResultToFile(files, statResult, "UHE", "UHAR", "热岛面积", string.Empty, 1, false, 1); FileExtractResult fileResult = new FileExtractResult("UHAR", filename); fileResult.Add2Workspace = true; fileResult.SetDispaly(false); return(fileResult); }
private IExtractResult StateAreaRow(int NormalLevel, string[] files, Dictionary <string, StatInfo> result, int HILevel) { string[] normalDesc = GetStringArray("NormalDesc"); string DateStr = GetStringArgument("DateStr"); List <string[]> valueItems = new List <string[]>(); IRasterDataProvider rdp = GeoDataDriver.Open(files[0]) as IRasterDataProvider; double areaBase = 0f; areaBase = GetAreaBase(rdp, areaBase); int col = 0; List <string> columnList = new List <string>(); columnList.Add("日期"); for (int row = 0; row < HILevel; row++) { valueItems.Add(new string[result.Count + 1]); valueItems[row][0] = normalDesc == null || row >= normalDesc.Length ? (NormalLevel - row).ToString() : normalDesc[row]; } foreach (string key in result.Keys) { col++; columnList.Add(DataIdentifyMatcher.GetOrbitDateTime(key).AddHours(8).ToString(DateStr)); for (int row = 0; row < HILevel; row++) { for (UInt16 level = (UInt16)(NormalLevel - row), num = 0; num < HILevel; num++) { valueItems[row][col] = Math.Round(result[key].UHPI[level] * areaBase / Math.Pow(10, 6), 2).ToString(); } } } string title = "统计日期:" + DateTime.Now.ToShortDateString() + " 面积单位:平方公里"; string[] columns = columnList.ToArray(); IStatResult statResult = new StatResult(title, columns, valueItems.ToArray()); string filename = StatResultToFile(files, statResult, "UHE", "UHAR", "热岛面积", string.Empty, 1, false, 1); FileExtractResult fileResult = new FileExtractResult("UHAR", filename); fileResult.Add2Workspace = true; fileResult.SetDispaly(false); return(fileResult); }