Skip to content
Snippets Groups Projects
Commit be1acdd0 authored by Debolskiy Andrey's avatar Debolskiy Andrey :bicyclist_tone5:
Browse files

added some value checkers to prmWindstress classes. Check for main algorithm...

added some value checkers to prmWindstress classes. Check for main algorithm to work on all lines (one need to set prognostic wind values over 90m/s)
parent 46441915
Branches
No related tags found
No related merge requests found
<ColoringScheme SchemeType="Grid" GridName="u_test" GroupName="Data Layers"> <ColoringScheme SchemeType="Grid" GridName="u_test" GroupName="Data Layers">
<GridColoringScheme AmbientIntensity="0,7" Key="" LightSourceAzimuth="90" LightSourceElevation="45" LightSourceIntensity="0,7" NoDataColor="-16777216" ImageLayerFillTransparency="1" ImageUpsamplingMethod="None" ImageDownsamplingMethod="None"> <GridColoringScheme AmbientIntensity="0,7" Key="" LightSourceAzimuth="90" LightSourceElevation="45" LightSourceIntensity="0,7" NoDataColor="-16777216" ImageLayerFillTransparency="1" ImageUpsamplingMethod="Bilinear" ImageDownsamplingMethod="None">
<Break Caption="" LowValue="-16,646" HighValue="11,677" LowColor="-16096246" HighColor="-6718183" ColoringType="0" GradientModel="1" /> <Break Caption="" LowValue="-16,646" HighValue="11,677" LowColor="-16096246" HighColor="-6718183" ColoringType="0" GradientModel="1" />
<Break Caption="" LowValue="11,677" HighValue="40" LowColor="-6718183" HighColor="-1" ColoringType="0" GradientModel="1" /> <Break Caption="" LowValue="11,677" HighValue="40" LowColor="-6718183" HighColor="-1" ColoringType="0" GradientModel="1" />
</GridColoringScheme> </GridColoringScheme>
......
<ColoringScheme SchemeType="Grid" GridName="v_test" GroupName="Data Layers"> <ColoringScheme SchemeType="Grid" GridName="v_test" GroupName="Data Layers">
<GridColoringScheme AmbientIntensity="0,7" Key="" LightSourceAzimuth="90" LightSourceElevation="45" LightSourceIntensity="0,7" NoDataColor="-16777216" ImageLayerFillTransparency="1" ImageUpsamplingMethod="None" ImageDownsamplingMethod="None"> <GridColoringScheme AmbientIntensity="0,7" Key="" LightSourceAzimuth="90" LightSourceElevation="45" LightSourceIntensity="0,7" NoDataColor="-16777216" ImageLayerFillTransparency="1" ImageUpsamplingMethod="Bilinear" ImageDownsamplingMethod="None">
<Break Caption="" LowValue="0" HighValue="9,9995" LowColor="-13399600" HighColor="-1907802" ColoringType="0" GradientModel="1" /> <Break Caption="" LowValue="0" HighValue="9,9995" LowColor="-13399600" HighColor="-1907802" ColoringType="0" GradientModel="1" />
<Break Caption="" LowValue="9,9995" HighValue="19,999" LowColor="-1907802" HighColor="-6843787" ColoringType="0" GradientModel="1" /> <Break Caption="" LowValue="9,9995" HighValue="19,999" LowColor="-1907802" HighColor="-6843787" ColoringType="0" GradientModel="1" />
</GridColoringScheme> </GridColoringScheme>
......
...@@ -143,6 +143,7 @@ namespace MES_Wind ...@@ -143,6 +143,7 @@ namespace MES_Wind
Coordinate dummyRCoords = uRasterLayer.Bounds.CellCenter_ToProj(i,j); Coordinate dummyRCoords = uRasterLayer.Bounds.CellCenter_ToProj(i,j);
WindStressPRM.Coordinate cellCoords =new WindStressPRM.Coordinate(dummyRCoords.X,dummyRCoords.Y); WindStressPRM.Coordinate cellCoords =new WindStressPRM.Coordinate(dummyRCoords.X,dummyRCoords.Y);
WindStressPRM.PrognosticCell dummyPrognosticCell = new WindStressPRM.PrognosticCell(cellCoords, uRasterLayer.DataSet.Value[j, i], vRasterLayer.DataSet.Value[j, i]); WindStressPRM.PrognosticCell dummyPrognosticCell = new WindStressPRM.PrognosticCell(cellCoords, uRasterLayer.DataSet.Value[j, i], vRasterLayer.DataSet.Value[j, i]);
//WindStressPRM.PrognosticCell dummyPrognosticCell = new WindStressPRM.PrognosticCell(cellCoords, 100, 100);
progWindRow.Add(dummyPrognosticCell); progWindRow.Add(dummyPrognosticCell);
} }
prognosticWind.Add(progWindRow); prognosticWind.Add(progWindRow);
...@@ -162,7 +163,9 @@ namespace MES_Wind ...@@ -162,7 +163,9 @@ namespace MES_Wind
{ {
Coordinate dummyCellCoords = clim15RasterLayer.Bounds.CellCenter_ToProj(i,j); Coordinate dummyCellCoords = clim15RasterLayer.Bounds.CellCenter_ToProj(i,j);
WindStressPRM.Coordinate dummyClimCoords = new WindStressPRM.Coordinate(dummyCellCoords.X,dummyCellCoords.Y); WindStressPRM.Coordinate dummyClimCoords = new WindStressPRM.Coordinate(dummyCellCoords.X,dummyCellCoords.Y);
WindStressPRM.ClimateCell dummyClim = new WindStressPRM.ClimateCell(dummyClimCoords, clim5RasterLayer.DataSet.Value[j, i], clim10RasterLayer.DataSet.Value[j, i]-5, clim15RasterLayer.DataSet.Value[j, i]); //add or substruct in range 0 - 27 to change what lines will be broken
WindStressPRM.ClimateCell dummyClim = new WindStressPRM.ClimateCell(dummyClimCoords, clim5RasterLayer.DataSet.Value[j, i], clim10RasterLayer.DataSet.Value[j, i] - 10, clim15RasterLayer.DataSet.Value[j, i]);
//WindStressPRM.ClimateCell dummyClim = new WindStressPRM.ClimateCell(dummyClimCoords, 0, 0, 0);
climWindRow.Add(dummyClim); climWindRow.Add(dummyClim);
} }
climWind.Add(climWindRow); climWind.Add(climWindRow);
...@@ -240,12 +243,12 @@ namespace MES_Wind ...@@ -240,12 +243,12 @@ namespace MES_Wind
Coordinate coords = new Coordinate(disabledStation.coords.X, disabledStation.coords.Y); Coordinate coords = new Coordinate(disabledStation.coords.X, disabledStation.coords.Y);
DotSpatial.Topology.Point disabledPoint = new DotSpatial.Topology.Point(coords); DotSpatial.Topology.Point disabledPoint = new DotSpatial.Topology.Point(coords);
Feature disabledPointFeature = new Feature(disabledPoint); Feature disabledPointFeature = new Feature(disabledPoint);
disabledPointFeature.DataRow["ID"] = disabledStation.identifier; //disabledPointFeature.DataRow["ID"] = disabledStation.identifier;
disabledPointSet.AddFeature(disabledPointFeature); disabledPointSet.AddFeature(disabledPointFeature);
} }
//add result layer to the map //add result layer to the map
IMapPointLayer resultPointLayer = (MapPointLayer)map1.Layers.Add(disabledPointSet); IMapPointLayer resultPointLayer = (MapPointLayer)map1.Layers.Add(disabledPointSet);
PointSymbolizer symbol = new PointSymbolizer('a', "serif", Color.Blue, 4); PointSymbolizer symbol = new PointSymbolizer('a', "serif", Color.Blue, 14);
resultPointLayer.Symbolizer = symbol; resultPointLayer.Symbolizer = symbol;
resultPointLayer.LegendText = "Disabled TransStations"; resultPointLayer.LegendText = "Disabled TransStations";
......
...@@ -49,11 +49,27 @@ namespace WindStressPRM ...@@ -49,11 +49,27 @@ namespace WindStressPRM
/// <param name="X"></param> /// <param name="X"></param>
/// <param name="Y"></param> /// <param name="Y"></param>
public Coordinate(double X, double Y) public Coordinate(double X, double Y)
{
if (!(this.CheckValue()))
{
throw new System.ArgumentException("Passed coordinates are not valid!");
}
else
{ {
this.X = X; this.X = X;
this.Y = Y; this.Y = Y;
} }
} }
public bool CheckValue()
{
bool checker = true;
if (X != null) { checker = true; }
else { checker = false; }
if (Y != null) { checker = true; }
else { checker = false; }
return checker;
}
}
/// <summary> /// <summary>
/// Cell obj for regular prognostic wind field /// Cell obj for regular prognostic wind field
/// </summary> /// </summary>
...@@ -78,12 +94,28 @@ namespace WindStressPRM ...@@ -78,12 +94,28 @@ namespace WindStressPRM
/// <param name="vX"> U component</param> /// <param name="vX"> U component</param>
/// <param name="vY"> V component</param> /// <param name="vY"> V component</param>
public PrognosticCell(Coordinate coord, double vX, double vY) public PrognosticCell(Coordinate coord, double vX, double vY)
{
if (!(this.CheckValue()))
{
throw new System.ArgumentException("Prognostic wind velocities are incorrect");
}
else
{ {
this.coords = coord; this.coords = coord;
this.velocityX = vX; this.velocityX = vX;
this.velocityY = vY; this.velocityY = vY;
} }
} }
public bool CheckValue()
{
bool checker = false;
if (Math.Abs(velocityX) < 70) { checker = true; }
else { checker = false; }
if (Math.Abs(velocityY) < 70) { checker = true; }
else { checker = false; }
return checker;
}
}
/// <summary> /// <summary>
/// Cell obj for climate wind regular data /// Cell obj for climate wind regular data
/// </summary> /// </summary>
...@@ -113,6 +145,12 @@ namespace WindStressPRM ...@@ -113,6 +145,12 @@ namespace WindStressPRM
/// <param name="w10"></param> /// <param name="w10"></param>
/// <param name="w15"></param> /// <param name="w15"></param>
public ClimateCell(Coordinate coord, double w5, double w10, double w15) public ClimateCell(Coordinate coord, double w5, double w10, double w15)
{
if (!(this.CheckValue()))
{
throw new System.ArgumentException("Climate wind value is not correct");
}
else
{ {
this.coords = coord; this.coords = coord;
this.wind5 = w5; this.wind5 = w5;
...@@ -120,6 +158,14 @@ namespace WindStressPRM ...@@ -120,6 +158,14 @@ namespace WindStressPRM
this.wind15 = w15; this.wind15 = w15;
} }
} }
public bool CheckValue()
{
bool checker = true;
if (Math.Abs(wind5) < 70 && Math.Abs(wind10) < 70 && Math.Abs(wind15) < 70) { checker = true; }
else { checker = false; }
return checker;
}
}
/// <summary> /// <summary>
/// Cell Size parameters /// Cell Size parameters
/// </summary> /// </summary>
...@@ -132,6 +178,17 @@ namespace WindStressPRM ...@@ -132,6 +178,17 @@ namespace WindStressPRM
{ {
this.width = wdh; this.width = wdh;
this.height = hgh; this.height = hgh;
if (!(this.CheckValue()))
{
throw new System.ArgumentException("Cell width or height values are incorrect!");
}
}
public bool CheckValue()
{
bool checker = true;
if (width > 0 && height > 0) { checker = true; }
else { checker = false; }
return checker;
} }
} }
/// <summary> /// <summary>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment