|
@@ -52,15 +52,15 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- 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)
|
|
|
+ public static List<double[]> GetDrift(NCread nCread, double[] initialPosition, double dt, double totalTime, int times, int latitudes, int longitudes, int times1, int latitudes1, int longitudes1, int times2, int latitudes2, int longitudes2, int times3, int latitudes3, int longitudes3, int days, int hour, double initlatitudes, double initlongitudes)
|
|
|
{
|
|
|
|
|
|
|
|
|
- List<double[]> trajectory = CalculateDriftTrajectory(nCread, initialPosition, dt, totalTime, times, latitudes, longitudes, days, hour, initlatitudes, initlongitudes);
|
|
|
+ List<double[]> trajectory = CalculateDriftTrajectory(nCread, initialPosition, dt, totalTime, times, latitudes, longitudes, times1, latitudes1, longitudes1, times2, latitudes2, longitudes2, times3, latitudes3, longitudes3, days, hour, initlatitudes, initlongitudes);
|
|
|
return trajectory;
|
|
|
}
|
|
|
|
|
|
- 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)
|
|
|
+ public static List<double[]> CalculateDriftTrajectory(NCread nCread, double[] initialPosition, double dt, double totalTime, int times, int latitudes, int longitudes, int times1, int latitudes1, int longitudes1, int times2, int latitudes2, int longitudes2, int times3, int latitudes3, int longitudes3, int days, int hour, double initlatitudes, double initlongitudes)
|
|
|
{
|
|
|
int timeSteps = (int)(totalTime / dt);
|
|
|
List<double[]> trajectory = new List<double[]>();
|
|
@@ -72,20 +72,36 @@ public class SeaSJ
|
|
|
|
|
|
int outputTime = 3600 * t;
|
|
|
|
|
|
- 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[] windVelocity = GetWindVelocityFromAPI(nCread, currentPos[0], currentPos[1], outputTime, times, latitudes, longitudes, times1, latitudes1, longitudes1, days, hour);
|
|
|
+ double[] currentVelocity = GetCurrentVelocityFromAPI(nCread, currentPos[0], currentPos[1], outputTime, times2, latitudes2, longitudes2, times3, latitudes3, longitudes3, days, hour);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
double[] driftVelocity = {
|
|
|
currentVelocity[0] + windVelocity[0],
|
|
|
currentVelocity[1] + windVelocity[1]
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
double[] newPosition = {
|
|
|
currentPos[0] + (driftVelocity[0] * dt * 3600) / ((6371000 * Math.Cos(currentPos[0] * Math.PI / 180)) * 180 / Math.PI),
|
|
|
currentPos[1] + (driftVelocity[1] * dt * 3600) / ((6371000 * Math.Cos(currentPos[1] * Math.PI / 180)) * 180 / Math.PI)
|
|
|
};
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
trajectory.Add(newPosition);
|
|
|
}
|
|
@@ -93,7 +109,7 @@ public class SeaSJ
|
|
|
return trajectory;
|
|
|
}
|
|
|
|
|
|
- public static double[] GetWindVelocityFromAPI(NCread windNCread, double latitude, double longitude, double temptime, int times, int latitudes, int longitudes, int days, int hour)
|
|
|
+ public static double[] GetWindVelocityFromAPI(NCread windNCread, double latitude, double longitude, double temptime, int times, int latitudes, int longitudes, int times1, int latitudes1, int longitudes1, int days, int hour)
|
|
|
{
|
|
|
float[] longitudeArray = windNCread.longitudeArray;
|
|
|
float[] latitudeArray = windNCread.latitudeArray;
|
|
@@ -141,13 +157,23 @@ public class SeaSJ
|
|
|
return new double[] { windX, windY };
|
|
|
}
|
|
|
|
|
|
- public static double[] GetCurrentVelocityFromAPI(NCread CurrentNCread, double latitude, double longitude, double temptime, int times, int latitudes, int longitudes, int days, int hour)
|
|
|
+ public static double[] GetCurrentVelocityFromAPI(NCread CurrentNCread, double latitude, double longitude, double temptime, int times2, int latitudes2, int longitudes2, int times3, int latitudes3, int longitudes3, int days, int hour)
|
|
|
{
|
|
|
float[] longitudeArray = CurrentNCread.longitudeArray;
|
|
|
float[] latitudeArray = CurrentNCread.latitudeArray;
|
|
|
float[][][] u10Array = CurrentNCread.u10Array;
|
|
|
float[][][] v10Array = CurrentNCread.v10Array;
|
|
|
float[][][] p140208Array = CurrentNCread.p140208Array;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
float[][][] mwdArray = CurrentNCread.mwdArray;
|
|
|
|
|
|
int longitudeNum = 0;
|
|
@@ -155,7 +181,7 @@ public class SeaSJ
|
|
|
int temptimeNum = 0;
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < longitudes - 1; i++)
|
|
|
+ for (int i = 0; i < longitudes2 - 1; i++)
|
|
|
{
|
|
|
if (longitude >= longitudeArray[i] && longitude < longitudeArray[i + 1])
|
|
|
{
|
|
@@ -165,7 +191,7 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < latitudes - 1; i++)
|
|
|
+ for (int i = 0; i < latitudes2 - 1; i++)
|
|
|
{
|
|
|
if (latitude >= latitudeArray[i] && latitude < latitudeArray[i + 1])
|
|
|
{
|
|
@@ -175,7 +201,7 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < times - 1; i++)
|
|
|
+ for (int i = 0; i < times2 - 1; i++)
|
|
|
{
|
|
|
if (temptime >= 3600 * i && temptime < 3600 * (i + 1))
|
|
|
{
|
|
@@ -183,9 +209,20 @@ public class SeaSJ
|
|
|
}
|
|
|
}
|
|
|
temptimeNum += (days - 1) * 24 + hour;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
double currentSpeed = (double)p140208Array[temptimeNum][latitudeNum][longitudeNum];
|
|
|
+ Random random = new Random();
|
|
|
+ if (currentSpeed > 10)
|
|
|
+ currentSpeed = random.NextDouble();
|
|
|
+
|
|
|
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);
|
|
@@ -194,7 +231,7 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static double GetWaveHeightFromAPI(NCread WaveNCread, double latitude, double longitude, double temptime, int times, int latitudes, int longitudes, int days, int hour)
|
|
|
+ public static double GetWaveHeightFromAPI(NCread WaveNCread, double latitude, double longitude, double temptime, int times4, int latitudes4, int longitudes4, int days, int hour)
|
|
|
{
|
|
|
float[] longitudeArray = WaveNCread.longitudeArray;
|
|
|
float[] latitudeArray = WaveNCread.latitudeArray;
|
|
@@ -206,7 +243,7 @@ public class SeaSJ
|
|
|
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < longitudes - 1; i++)
|
|
|
+ for (int i = 0; i < longitudes4 - 1; i++)
|
|
|
{
|
|
|
if (longitude >= longitudeArray[i] && longitude < longitudeArray[i + 1])
|
|
|
{
|
|
@@ -216,7 +253,7 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < latitudes - 1; i++)
|
|
|
+ for (int i = 0; i < latitudes4 - 1; i++)
|
|
|
{
|
|
|
if (latitude >= latitudeArray[i] && latitude < latitudeArray[i + 1])
|
|
|
{
|
|
@@ -226,7 +263,7 @@ public class SeaSJ
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < times - 1; i++)
|
|
|
+ for (int i = 0; i < times4 - 1; i++)
|
|
|
{
|
|
|
if (temptime >= 3600 * i && temptime < (3600 * (i + 1)))
|
|
|
{
|