internal static float GetInitTemperature(PlanetData PD, int AltLayer, Cell cell) { float Altitude = WeatherFunctions.GetCellAltitude(PD.index, AltLayer, cell); //get the proper f*****g temperature because the obvious answer f***s you over for 3 weeks float sunAxialDot = (float)(WeatherFunctions.GetSunriseFactor(PD.index, cell)); float latitude = Mathf.Abs(WeatherFunctions.GetCellLatitude(cell)); float diurnalRange = PD.body.latitudeTemperatureSunMultCurve.Evaluate(latitude); float latTempMod = PD.body.latitudeTemperatureBiasCurve.Evaluate(latitude); float axialTempMod = PD.body.axialTemperatureSunMultCurve.Evaluate(sunAxialDot); float atmoTempOffset = latTempMod + diurnalRange * sunAxialDot + axialTempMod; float altTempMult = PD.body.atmosphereTemperatureSunMultCurve.Evaluate(Altitude); float finalTempMod = atmoTempOffset * altTempMult; return((float)FlightGlobals.getExternalTemperature(Altitude, PD.body) + finalTempMod); }
public void mainWindow(int windowid) { GUILayout.BeginVertical(); if (GUILayout.Button("Overlay")) { showOverlayWindow = !showOverlayWindow; } GUILayout.Space(1); GUILayout.Space(1); if (MapOverlay.getHoverCell().HasValue) { Cell cell = MapOverlay.getHoverCell().Value; GUILayout.Label("Temperature: " + WeatherFunctions.GetCellTemperature(PD.index, currentLayer, cell) + " °K"); GUILayout.Label("Pressure: " + WeatherFunctions.GetCellPressure(PD.index, currentLayer, cell) + " Pa"); GUILayout.Label("Rel Humidity: " + WeatherFunctions.GetCellRH(PD.index, currentLayer, cell) * 100 + " %"); GUILayout.Label("Air Density: " + String.Format("{0:0.000000}", WeatherFunctions.D_Wet(PD.index, cell, WeatherFunctions.GetCellAltitude(PD.index, currentLayer, cell))) + " Kg/m³"); GUILayout.Label("wind horz: " + String.Format("{0:0.0000}", WeatherFunctions.GetCellwindH(PD.index, currentLayer, cell)) + " m/s"); GUILayout.Label("wind Dir : " + String.Format("{0:000.0}", WeatherFunctions.GetCellwindDir(PD.index, currentLayer, cell)) + " °"); GUILayout.Label("wind vert : " + String.Format("{0:+0.00000;-0.00000}", WeatherFunctions.GetCellwindV(PD.index, currentLayer, cell)) + " m/s"); GUILayout.Label("CCN : " + WeatherFunctions.GetCellCCN(PD.index, currentLayer, cell) * 100 + " %"); GUILayout.Label("Cloud water : " + WeatherFunctions.GetCellWaterContent(PD.index, currentLayer, cell) + " Kg/m³"); int Iced = Math.Sign(WeatherFunctions.GetCelldropletSize(PD.index, currentLayer, cell)); GUILayout.Label("droplet Size: " + Math.Abs(WeatherFunctions.GetCelldropletSize(PD.index, currentLayer, cell) * 1000.0f) + " mm"); GUILayout.Label("cloud thickness: " + WeatherFunctions.GetCellthickness(PD.index, currentLayer, cell) + " m " + (Iced < 0 ? "Iced" : Iced > 0 ? "Liqd" : "None")); GUILayout.Label("rain duration: " + WeatherFunctions.GetCellrainDuration(PD.index, currentLayer, cell) + " cycles"); GUILayout.Label("rain decay: " + WeatherFunctions.GetCellrainDecay(PD.index, currentLayer, cell) / 256.0f); } GUILayout.EndVertical(); GUI.DragWindow(); }
private static Color32 getCellColor(int layer, Cell cell) { double?deposit = 0; double deposit2 = 0; switch (resource.Resource) { case "Temperature": deposit = PD.LiveMap[layer][cell].temperature; break; case "Delta Temp": deposit = (WeatherSimulator.GetInitTemperature(PD, currentLayer, cell) - WeatherFunctions.GetCellTemperature(PD.index, currentLayer, cell)); break; case "Temp. Change": deposit = PD.LiveMap[layer][cell].TempChange; break; case "Pressure": deposit = PD.LiveMap[layer][cell].pressure; break; case "Pressure Delta": deposit = ((PD.LiveMap[0][cell].pressure - FlightGlobals.getStaticPressure(0, PD.body) * 1000) * PD.LiveMap[layer][cell].pressure / PD.LiveMap[0][cell].pressure + PD.LiveMap[layer][cell].flowPChange); break; case "Wind H Speed": deposit = WeatherFunctions.GetCellwindH(PD.index, layer, cell); break; case "Wind H Vector": //deposit = WeatherFunctions.GetCellwindDir(PD.index, layer, cell); deposit = PD.LiveMap[layer][cell].windVector.x; deposit2 = PD.LiveMap[layer][cell].windVector.z; break; case "Wind Vertical": deposit = PD.LiveMap[layer][cell].windVector.y; break; case "Rel. Humidity": deposit = PD.LiveMap[layer][cell].relativeHumidity; break; case "Cloud water": deposit = PD.LiveMap[layer][cell].cloud.getwaterContent(); deposit2 = WeatherFunctions.GetSunriseFactor(PD.index, cell); break; case "Geodesy": // deposit = Math.Sqrt(cell.Position.x * cell.Position.x + cell.Position.y * cell.Position.y + cell.Position.z * cell.Position.z); deposit = (cell.Position - PD.LiveSoilMap[cell].centroid).magnitude; break; case "DeltaDistanceDiff": double DDD = 0.0; double DDD2 = 0.0; int n = 0; foreach (Cell neighbor in cell.GetNeighbors(PD.gridLevel)) { double DeltaDistance = WeatherFunctions.GetDistanceBetweenCells(PD.index, cell.Position, neighbor.Position, WeatherFunctions.GetCellAltitude(PD.index, layer, cell)); DDD += DeltaDistance; DDD2 += DeltaDistance * DeltaDistance; n++; } DDD /= n; DDD2 /= n; deposit = Math.Sqrt(Math.Abs(DDD2 - DDD * DDD)) / DDD; break; } var scanned = true; var color = (revealAll ? deposit != null : scanned) ? getDepositColor(resource, deposit, deposit2) : colorUnknown; return(color); }
public void mouseWindow(int windowID) { Cell cell = hoverCell.Value; float lat = WeatherFunctions.GetCellLatitude(cell); float lon = WeatherFunctions.GetCellLongitude(cell); GUILayout.BeginVertical(); GUILayout.Label(String.Format("Cell: {0:D5} cycle: {1:D}", cell.Index, CellUpdater.run)); GUILayout.Label("Lat: " + lat + " °"); GUILayout.Label("Lon: " + lon + " °"); GUILayout.Label(String.Format("Geodesic: {0:G}", Math.Sqrt(cell.Position.x * cell.Position.x + cell.Position.y * cell.Position.y + cell.Position.z * cell.Position.z))); GUILayout.Label(String.Format("ΔT(KSP-KWS): {0:+0.000;-0.000}°", (WeatherSimulator.GetInitTemperature(PD, currentLayer, cell) - WeatherFunctions.GetCellTemperature(PD.index, currentLayer, cell)))); GUILayout.Label(String.Format("δ Temp: {0:+0.000000;-0.000000}°/s", currentLayer < PD.LiveMap.Count ? PD.LiveMap[currentLayer][cell].TempChange : PD.LiveStratoMap[currentLayer - PD.LiveMap.Count][cell].TempChange)); double DDD = 0.0; double DDD2 = 0.0; int n = 0; foreach (Cell neighbor in cell.GetNeighbors(PD.gridLevel)) { double DeltaDistance = WeatherFunctions.GetDistanceBetweenCells(PD.index, cell.Position, neighbor.Position, WeatherFunctions.GetCellAltitude(PD.index, currentLayer, cell)); DDD += DeltaDistance; DDD2 += DeltaDistance * DeltaDistance; n++; } DDD /= n; DDD2 /= n; GUILayout.Label(String.Format("ΔDistanceδ: {0:0.000000}", Math.Sqrt(Math.Abs(DDD2 - DDD * DDD)) / DDD)); GUILayout.Label(String.Format("CentroidΔ: {0:0.000000}", (cell.Position - PD.LiveSoilMap[cell].centroid).magnitude)); GUILayout.Label(String.Format("flowPChange: {0:+00.000;-00.000}", currentLayer < PD.LiveMap.Count ? PD.LiveMap[currentLayer][cell].flowPChange : PD.LiveStratoMap[currentLayer - PD.LiveMap.Count][cell].flowPChange)); GUILayout.Label(String.Format("Pressure Δ: {0:+000.00;-000.00}", currentLayer < PD.LiveMap.Count ? ((PD.LiveMap[0][cell].pressure - FlightGlobals.getStaticPressure(0, PD.body) * 1000) * PD.LiveMap[currentLayer][cell].pressure / PD.LiveMap[0][cell].pressure + PD.LiveMap[currentLayer][cell].flowPChange) : ((PD.LiveMap[0][cell].pressure - FlightGlobals.getStaticPressure(0, PD.body) * 1000) * PD.LiveStratoMap[currentLayer - PD.LiveMap.Count][cell].pressure / PD.LiveMap[0][cell].pressure + PD.LiveStratoMap[currentLayer - PD.LiveMap.Count][cell].flowPChange))); GUILayout.EndVertical(); }
public void mouseWindow(int windowID) { Cell cell = hoverCell.Value; float lat = WeatherFunctions.GetCellLatitude(cell); float lon = WeatherFunctions.GetCellLongitude(cell); GUILayout.BeginVertical(); GUILayout.Label(String.Format("Cell: {0:D5} cycle: {1:D}", cell.Index, CellUpdater.run)); GUILayout.Label("Lat: " + lat + " °"); GUILayout.Label("Lon: " + lon + " °"); GUILayout.Label(String.Format("Geodesic: {0:G}", Math.Sqrt(cell.Position.x * cell.Position.x + cell.Position.y * cell.Position.y + cell.Position.z * cell.Position.z))); GUILayout.Label(String.Format("ΔT(KSP-KWS): {0:+0.000;-0.000}°", (WeatherSimulator.GetInitTemperature(PD, currentLayer, cell) - WeatherFunctions.GetCellTemperature(PD.index, currentLayer, cell)))); double DDD = 0.0; double DDD2 = 0.0; int n = 0; foreach (Cell neighbor in cell.GetNeighbors(PD.gridLevel)) { double DeltaDistance = WeatherFunctions.GetDistanceBetweenCells(PD.index, cell, neighbor, WeatherFunctions.GetCellAltitude(PD.index, currentLayer, cell)); DDD += DeltaDistance; DDD2 += DeltaDistance * DeltaDistance; n++; } DDD /= n; DDD2 /= n; GUILayout.Label(String.Format("ΔDistanceδ: {0:0.000000}", Math.Sqrt(Math.Abs(DDD2 - DDD * DDD)) / DDD)); GUILayout.Label(String.Format("flowPChange: {0:+00.000;-00.000}", PD.LiveMap[currentLayer][cell].flowPChange)); GUILayout.EndVertical(); }