Commit cc777e26 authored by a001188's avatar a001188
Browse files

Firts Front check in

parent 367855a6
......@@ -17,27 +17,44 @@ import org.json.JSONException;
* @author a001188
*/
public class Main {
public static int GRID_COEFF = 50;
public static final boolean CLOSE_AROUND_THE_BORDER = true;
public static final int ISO_LEVELS = 1;
public static final int ISO_LEVELS = 3;
public static final boolean TEST = false;
public static final int MIN_POLYGON_SIZE = 1000;
public static final boolean FILTERED_VALUES = false;
public static final boolean ORIGINAL_VALUES = true;
public static final int MIN_POLYGON_SIZE = 100;
public static final boolean FILTERED_VALUES = true;
public static final boolean ORIGINAL_VALUES = false;
public static final int FILTER_WIDTH = 2;
public static final int FILTER_TREATMENTS = 3;
public static final double FILTER_RANGE = 0.8;
public static final double FILTER_RANGE = 1;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
public static void main(String[] args) throws Exception {
Matrix coords;
try {
Matrix coords;
if(TEST)
coords = new TestMatrix(13);
else
coords = JSONMatrix.read(TEST);
if(TEST){
GRID_COEFF=1;
coords = new TestMatrix(13);
}
else{
GRID_COEFF=50;
String model = "pmp2g";
String version = "2";
String parameter = "msl";
String validTime1 = "20171023T220000Z";
String validTime2 = "20171023T230000Z";
String levelType = "hmsl";
String level = "0";
int rows=753;//613
int cols=613;//753
coords = JSONMatrix.read(model, version, parameter, validTime1, levelType, level, rows, cols);
//Matrix coords2 = JSONMatrix.read(model, version, parameter, validTime2, levelType, level, rows, cols);
//coords = coords1.diff(coords2);
}
IsoLevels isoLevels = new IsoLevels(ISO_LEVELS, coords.min(), coords.max());
System.out.println("Coords size: " + coords.size());
IsoSplineFactory isoSplineFactory;
......
......@@ -114,29 +114,7 @@ public class Matrix extends Coordinates implements IsoApi, Cloneable{
}
// public IsoErrorlist getIsoErrorList(){
// IsoErrorlist isoErrorlist = new IsoErrorlist();
// isoErrorlist.add(new IsoErrorElement(getMinRow(), getMinCol(), min(), 0));
// isoErrorlist.add(new IsoErrorElement(getMaxRow(), getMaxCol(), max(), 0));
//
// for(int r=0; r<rows-1;r++)
// for(int c=0; c<cols-1;c++){
// if(getMinA(r,c) > getMaxB(r,c)){
// isoErrorlist.add(new IsoErrorElement(r, c, getMinA(r, c),-1));
// isoErrorlist.add(new IsoErrorElement(r, c, getMaxB(r, c), 1));
// }
// if(getMaxA(r,c) < getMinB(r,c)){
// isoErrorlist.add(new IsoErrorElement(r, c, getMinB(r, c),-1));
// isoErrorlist.add(new IsoErrorElement(r, c, getMaxA(r, c), 1));
// }
// }
// return isoErrorlist;
// }
//
private int getIndexFromCoord(int row, int col){
int index;
index = row * getCols() + col ;
......@@ -169,4 +147,23 @@ public class Matrix extends Coordinates implements IsoApi, Cloneable{
return sb.toString();
}
Matrix diff(Matrix coords2) {
Matrix matrix = new Matrix(rows, cols);
double offset = 5;
for(int i=0; i<size();i++){
double diff = get(i).value - coords2.get(i).value;
if(Math.abs(diff)>offset)
if(diff<0)
diff = -offset;
else
diff = offset;
else
diff = 0;
Coordinate coord = new Coordinate(get(i).lon, get(i).lat, get(i).r, get(i).c, diff, null);
matrix.add(coord);
}
return matrix;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment