Skip to content
Snippets Groups Projects
Commit 7a72d260 authored by Антон Кудряшов's avatar Антон Кудряшов
Browse files

- fixed noninterpolated values

- fixed cell checking
parent 93302d6b
Branches
No related tags found
No related merge requests found
...@@ -121,7 +121,7 @@ namespace WindStressPRM ...@@ -121,7 +121,7 @@ namespace WindStressPRM
return false; return false;
} }
// пустые данные // пустые данные
if (res1) { if (res1 == res2 == true) {
return true; return true;
} }
///Скорость ветра на высоте 10м от поверхности на Земле не может превышать 70м/c ///Скорость ветра на высоте 10м от поверхности на Земле не может превышать 70м/c
...@@ -178,17 +178,23 @@ namespace WindStressPRM ...@@ -178,17 +178,23 @@ namespace WindStressPRM
/// <returns></returns> /// <returns></returns>
public bool CheckValue() public bool CheckValue()
{ {
bool c5 = Double.IsNaN(Wind5); double w5 = Wind5;
bool c10 = Double.IsNaN(Wind10); double w10 = Wind10;
bool c15 = Double.IsNaN(Wind15); double w15 = Wind15;
if (c5 != c10 || c5 != c15 || c5 != c10) { if (Double.IsNaN(w5)) // if is Nan - zerofied it.
return false; {
w5 = 0;
} }
if (c5) { if (Double.IsNaN(w10))
return true; {
w10 = 0;
}
if (Double.IsNaN(w15))
{
w15 = 0;
} }
// ветер по модулю не должен превышать 70м/с // ветер по модулю не должен превышать 70м/с
return Math.Abs(Wind5) < 70 && Math.Abs(Wind10) < 70 && Math.Abs(Wind15) < 70; return Math.Abs(w5) < 70 && Math.Abs(w10) < 70 && Math.Abs(w15) < 70;
} }
} }
/// <summary> /// <summary>
...@@ -523,14 +529,7 @@ namespace WindStressPRM ...@@ -523,14 +529,7 @@ namespace WindStressPRM
//fill output //fill output
Output output = new Output(); Output output = new Output();
output.DisabledStations = new List<PowerStation>(); output.DisabledStations = new List<PowerStation>();
output.DisabledLines = new List<Powerline>(); output.DisabledLines = prmBrokenLines;
foreach (Powerline line in input.PowerLines)
{
if (line.IsBroken)
{
output.DisabledLines.Add(line);
}
}
foreach (PowerStation powerStation in input.PowerStations) foreach (PowerStation powerStation in input.PowerStations)
{ {
//stations of type pole can be disabled if the line is broken //stations of type pole can be disabled if the line is broken
...@@ -720,6 +719,13 @@ namespace WindStressPRM ...@@ -720,6 +719,13 @@ namespace WindStressPRM
double uwind = interpol(coords, FunctionType.FunctionVelocityX); double uwind = interpol(coords, FunctionType.FunctionVelocityX);
double vwind = interpol(coords, FunctionType.FunctionVelocityY); double vwind = interpol(coords, FunctionType.FunctionVelocityY);
double climwind = interpol(coords, climateType); double climwind = interpol(coords, climateType);
if (Double.IsNaN(uwind) || Double.IsNaN(vwind) || Double.IsNaN(climwind))
{
// interpolation fail. we can't say everything about here
// discussion: also we can save these points for detail analysis
res = false;
continue;
}
double umod = Math.Sqrt(uwind * uwind + vwind * vwind); ; double umod = Math.Sqrt(uwind * uwind + vwind * vwind); ;
double angleline = Math.Atan2((coord2.Y - coord1.Y), (coord2.X - coord1.X)); double angleline = Math.Atan2((coord2.Y - coord1.Y), (coord2.X - coord1.X));
double anglewind = Math.Atan2(vwind, uwind) - angleline; double anglewind = Math.Atan2(vwind, uwind) - angleline;
...@@ -954,7 +960,8 @@ namespace WindStressPRM ...@@ -954,7 +960,8 @@ namespace WindStressPRM
// tests indicates that value at test-cell is missed. // tests indicates that value at test-cell is missed.
if (testTopRight && testTopLeft && testBotLeft && testBotRight) if (testTopRight && testTopLeft && testBotLeft && testBotRight)
{ {
throw new Exception("Current value in such a bad place, you need to fill these place with raster values"); // Current value in such a bad place, you need to fill these place with raster values
return Double.NaN;
} }
int count = 0; int count = 0;
if (testBotLeft) if (testBotLeft)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment