adjusted order by and limitations

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@111875 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Gianpaolo Coro 2015-02-10 18:50:16 +00:00
parent 2ea1481244
commit 4e6addb87f
6 changed files with 19 additions and 12 deletions

View File

@ -103,7 +103,7 @@ public class CSquaresCreator extends StandardLocalExternalAlgorithm {
String x = IOHelper.getInputParameter(config, xDim);
String y = IOHelper.getInputParameter(config, yDim);
String select = "select *," + x + "," + y + " from " + table + " order by " + x + " limit " + limit + " offset " + offset;
String select = "select *," + x + " as loforcs01," + y + " as laforcs01 from " + table + " limit " + limit + " offset " + offset;
return select;
}
@ -161,14 +161,14 @@ public class CSquaresCreator extends StandardLocalExternalAlgorithm {
while (true) {
String select = selectInformationForTransformation(config, table, limit, initIdx);
AnalysisLogger.getLogger().debug("CodeCreator: from " + initIdx + " to " + (initIdx + limit));
AnalysisLogger.getLogger().debug("CodeCreator: from " + initIdx + " to " + (initIdx + limit) + " limit "+limit);
List<Object> rows = DatabaseFactory.executeSQLQuery(select, connection);
if (rows == null || rows.size() == 0) {
AnalysisLogger.getLogger().debug("CodeCreator: no more rows");
break;
}
AnalysisLogger.getLogger().debug("CodeCreator: transforming");
AnalysisLogger.getLogger().debug("CodeCreator: transforming ");
// take x and y
List<String[]> stringrows = new ArrayList<String[]>();
for (Object row : rows) {
@ -187,7 +187,7 @@ public class CSquaresCreator extends StandardLocalExternalAlgorithm {
AnalysisLogger.getLogger().debug("CSquareCreator: inserting chunks into the table");
// write the vector into the table
DatabaseUtils.insertChunksIntoTable(outTable, colnames.toString(), stringrows, limit, connection, true);
initIdx += limit;
initIdx = initIdx+limit;
status = Math.min(90, 20 + (70 * initIdx / maxRows));
AnalysisLogger.getLogger().debug("CSquareCreator: status " + status);
}

View File

@ -46,7 +46,7 @@ public class FAOOceanAreaCreator extends CSquaresCreator {
String x = IOHelper.getInputParameter(config, xDim);
String y = IOHelper.getInputParameter(config, yDim);
String select = "select *," + x + "," + y + " from " + table + " order by " + x + " limit " + limit + " offset " + offset;
String select = "select *," + x + " as loforcs01," + y + " as laforcs01 from " + table + " limit " + limit + " offset " + offset;
return select;
}

View File

@ -52,7 +52,7 @@ public class FAOOceanAreaCreatorQuadrant extends FAOOceanAreaCreator {
String y = IOHelper.getInputParameter(config, yDim);
String quadrant = IOHelper.getInputParameter(config, quadrantDim);
String select = "select *," + x + "," + y +","+quadrant+ " from " + table + " order by " + x + " limit " + limit + " offset " + offset;
String select = "select *," + x + " as loforcs01," + y +" as laforcs01,"+quadrant+ " from " + table + " limit " + limit + " offset " + offset;
return select;
}
@Override

View File

@ -22,10 +22,15 @@ public class TestCSquareCodesCreator {
config.setParam("DatabaseURL", "jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");
config.setParam("DatabaseDriver", "org.postgresql.Driver");
config.setParam("Longitude_Column", "centerlong");
config.setParam("Latitude_Column", "centerlat");
// config.setParam("Longitude_Column", "centerlong");
// config.setParam("Latitude_Column", "centerlat");
// config.setParam("InputTable", "interp_2024_linear_01355325354899");
config.setParam("InputTable", "interp_2036_linear_11384851795640");
// config.setParam("InputTable", "interp_2036_linear_11384851795640");
config.setParam("Longitude_Column", "center_long");
config.setParam("Latitude_Column", "center_lat");
config.setParam("InputTable", "generic_ide4573b63_b955_4bbc_b83f_579ff3f0858f");
config.setParam("OutputTableName", "csqout");
config.setParam("CSquare_Resolution", "0.5");

View File

@ -18,7 +18,7 @@ public class TestFAOAreaCodesQuadrantCreator {
config.setParam("DatabaseURL", "jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");
config.setParam("DatabaseDriver", "org.postgresql.Driver");
config.setParam("Quadrant_column", "quadrant");
config.setParam("Quadrant_Column", "quadrant");
config.setParam("Longitude_Column", "long");
config.setParam("Latitude_Column", "lat");
config.setParam("InputTable", "generic_id6ef3e4fa_6a06_4df1_9445_553f2e918102");

View File

@ -32,7 +32,9 @@ public class CSquareCodesConverter {
// System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(-49.99999999999994,35.75000000000006, 1));
// System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(35.75000000000006,-49.99999999999994, 0.5));
// System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(35.75,-50, 0.5));
System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(35.7500,-49.9999, 0.5));
// System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(0.75,31.25, 0.5));
//System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(31.25, 0.75,0.1));
System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(0.75,31.25, 0.1));
}
}