|
@@ -26,12 +26,12 @@ public class Current
|
|
|
|
|
|
public class NCread
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
public float[] longitudeArray = new float[10];
|
|
|
public float[] latitudeArray = new float[7];
|
|
|
- public float[][][] u10Array ;
|
|
|
+ public float[][][] u10Array;
|
|
|
public float[][][] v10Array;
|
|
|
public float[][][] p140208Array;
|
|
|
public float[][][] mwdArray;
|
|
@@ -52,15 +52,15 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static List<double[]> GetDrift(NCread nCread,double[] initialPosition, double dt, double totalTime)
|
|
|
+ public static List<double[]> GetDrift(NCread nCread, double[] initialPosition, double dt, double totalTime, int times, int latitudes, int longitudes, int days, int hour, double initlatitudes, double initlongitudes)
|
|
|
{
|
|
|
|
|
|
|
|
|
- List<double[]> trajectory = CalculateDriftTrajectory(nCread,initialPosition, dt, totalTime);
|
|
|
+ List<double[]> trajectory = CalculateDriftTrajectory(nCread, initialPosition, dt, totalTime, times, latitudes, longitudes, days, hour, initlatitudes, initlongitudes);
|
|
|
return trajectory;
|
|
|
}
|
|
|
|
|
|
- public static List<double[]> CalculateDriftTrajectory(NCread nCread,double[] initialPosition, double dt, double totalTime)
|
|
|
+ public static List<double[]> CalculateDriftTrajectory(NCread nCread, double[] initialPosition, double dt, double totalTime, int times, int latitudes, int longitudes, int days, int hour, double initlatitudes, double initlongitudes)
|
|
|
{
|
|
|
int timeSteps = (int)(totalTime / dt);
|
|
|
List<double[]> trajectory = new List<double[]>();
|
|
@@ -72,8 +72,8 @@ public class SeaSJ
|
|
|
|
|
|
int outputTime = 3600 * t;
|
|
|
|
|
|
- double[] windVelocity = GetWindVelocityFromAPI(nCread,currentPos[0], currentPos[1], outputTime);
|
|
|
- double[] currentVelocity = GetCurrentVelocityFromAPI(nCread,currentPos[0], currentPos[1], outputTime);
|
|
|
+ double[] windVelocity = GetWindVelocityFromAPI(nCread, currentPos[0], currentPos[1], outputTime, times, latitudes, longitudes, days, hour);
|
|
|
+ double[] currentVelocity = GetCurrentVelocityFromAPI(nCread, currentPos[0], currentPos[1], outputTime, times, latitudes, longitudes, days, hour);
|
|
|
|
|
|
|
|
|
double[] driftVelocity = {
|
|
@@ -93,7 +93,7 @@ public class SeaSJ
|
|
|
return trajectory;
|
|
|
}
|
|
|
|
|
|
- public static double[] GetWindVelocityFromAPI(NCread windNCread,double latitude, double longitude, double temptime)
|
|
|
+ public static double[] GetWindVelocityFromAPI(NCread windNCread, double latitude, double longitude, double temptime, int times, int latitudes, int longitudes, int days, int hour)
|
|
|
{
|
|
|
float[] longitudeArray = windNCread.longitudeArray;
|
|
|
float[] latitudeArray = windNCread.latitudeArray;
|
|
@@ -105,7 +105,7 @@ public class SeaSJ
|
|
|
int temptimeNum = 0;
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < 9; i++)
|
|
|
+ for (int i = 0; i < longitudes - 1; i++)
|
|
|
{
|
|
|
if (longitude >= longitudeArray[i] && longitude < longitudeArray[i + 1])
|
|
|
{
|
|
@@ -115,7 +115,7 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < 6; i++)
|
|
|
+ for (int i = 0; i < latitudes - 1; i++)
|
|
|
{
|
|
|
if (latitude >= latitudeArray[i] && latitude < latitudeArray[i + 1])
|
|
|
{
|
|
@@ -123,9 +123,9 @@ public class SeaSJ
|
|
|
latitudeNum = i;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
- for (int i = 0; i < 23 ; i ++)
|
|
|
+ for (int i = 0; i < times - 1; i++)
|
|
|
{
|
|
|
if (temptime >= 3600 * i && temptime < (3600 * (i + 1)))
|
|
|
{
|
|
@@ -133,13 +133,15 @@ public class SeaSJ
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ temptimeNum += (days - 1) * 24 + hour;
|
|
|
+
|
|
|
double windX = (double)u10Array[temptimeNum][latitudeNum][longitudeNum];
|
|
|
- double windY = (double)v10Array[temptimeNum][latitudeNum][ longitudeNum];
|
|
|
+ double windY = (double)v10Array[temptimeNum][latitudeNum][longitudeNum];
|
|
|
|
|
|
return new double[] { windX, windY };
|
|
|
}
|
|
|
|
|
|
- public static double[] GetCurrentVelocityFromAPI(NCread CurrentNCread,double latitude, double longitude, double temptime)
|
|
|
+ public static double[] GetCurrentVelocityFromAPI(NCread CurrentNCread, double latitude, double longitude, double temptime, int times, int latitudes, int longitudes, int days, int hour)
|
|
|
{
|
|
|
float[] longitudeArray = CurrentNCread.longitudeArray;
|
|
|
float[] latitudeArray = CurrentNCread.latitudeArray;
|
|
@@ -153,7 +155,7 @@ public class SeaSJ
|
|
|
int temptimeNum = 0;
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < 9; i++)
|
|
|
+ for (int i = 0; i < longitudes - 1; i++)
|
|
|
{
|
|
|
if (longitude >= longitudeArray[i] && longitude < longitudeArray[i + 1])
|
|
|
{
|
|
@@ -163,7 +165,7 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < 6; i++)
|
|
|
+ for (int i = 0; i < latitudes - 1; i++)
|
|
|
{
|
|
|
if (latitude >= latitudeArray[i] && latitude < latitudeArray[i + 1])
|
|
|
{
|
|
@@ -171,27 +173,28 @@ public class SeaSJ
|
|
|
latitudeNum = i;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
- for (int i = 0; i < 23; i++)
|
|
|
+ for (int i = 0; i < times - 1; i++)
|
|
|
{
|
|
|
if (temptime >= 3600 * 1 && temptime < 3600 * (i + 1))
|
|
|
{
|
|
|
temptimeNum = i;
|
|
|
}
|
|
|
}
|
|
|
- double currentSpeed = (double)p140208Array[temptimeNum][latitudeNum][ longitudeNum];
|
|
|
- double currentDirection = (double)mwdArray[temptimeNum][latitudeNum][ longitudeNum];
|
|
|
+ temptimeNum += (days - 1) * 24 + hour;
|
|
|
+ double currentSpeed = (double)p140208Array[temptimeNum][latitudeNum][longitudeNum];
|
|
|
+ double currentDirection = (double)mwdArray[temptimeNum][latitudeNum][longitudeNum];
|
|
|
|
|
|
double currentDirectionInRadians = currentDirection * (Math.PI / 180);
|
|
|
double currentX = currentSpeed * Math.Cos(currentDirectionInRadians);
|
|
|
double currentY = currentSpeed * Math.Sin(currentDirectionInRadians);
|
|
|
|
|
|
return new double[] { currentX, currentY };
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- public static double GetWaveHeightFromAPI(NCread WaveNCread,double latitude, double longitude, double temptime)
|
|
|
+ public static double GetWaveHeightFromAPI(NCread WaveNCread, double latitude, double longitude, double temptime, int times, int latitudes, int longitudes, int days, int hour)
|
|
|
{
|
|
|
float[] longitudeArray = WaveNCread.longitudeArray;
|
|
|
float[] latitudeArray = WaveNCread.latitudeArray;
|
|
@@ -203,7 +206,7 @@ public class SeaSJ
|
|
|
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < 9; i++)
|
|
|
+ for (int i = 0; i < longitudes - 1; i++)
|
|
|
{
|
|
|
if (longitude >= longitudeArray[i] && longitude < longitudeArray[i + 1])
|
|
|
{
|
|
@@ -213,7 +216,7 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < 6; i++)
|
|
|
+ for (int i = 0; i < latitudes - 1; i++)
|
|
|
{
|
|
|
if (latitude >= latitudeArray[i] && latitude < latitudeArray[i + 1])
|
|
|
{
|
|
@@ -223,19 +226,19 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < 23 ; i ++)
|
|
|
+ for (int i = 0; i < times - 1; i++)
|
|
|
{
|
|
|
if (temptime >= 3600 * i && temptime < (3600 * (i + 1)))
|
|
|
{
|
|
|
temptimeNum = i;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- double WaveHeight = (double)hmaxArray[temptimeNum][ latitudeNum][ longitudeNum];
|
|
|
+ temptimeNum += (days - 1) * 24 + hour;
|
|
|
+ double WaveHeight = (double)hmaxArray[temptimeNum][latitudeNum][longitudeNum];
|
|
|
|
|
|
return WaveHeight;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
public static List<double[]> getminEnclosingRect(List<double[]> latLonList)
|
|
|
{
|
|
@@ -250,7 +253,7 @@ public class SeaSJ
|
|
|
|
|
|
|
|
|
Point2f[] convexHull = Rectangular_Area_Search_Function.GetConvexHull(pointList);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
List<double[]> hullPoint = new List<double[]>();
|
|
|
for (int num = 0; num < convexHull.Length - 1; num++)
|
|
@@ -265,7 +268,7 @@ public class SeaSJ
|
|
|
double pointLon = Rectangular_Area_Search_Function.RMokatuoLon(point[0]);
|
|
|
hullPointLatLon.Add(new double[] { pointLat, pointLon });
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
List<double[]> minEnclosingRect = Rectangular_Area_Search_Function.MinEnclosingRectangle(convexHull);
|
|
|
|