Skip to content

Commit 7503137

Browse files
committed
fix for non joining basins + cleanup of kriging module, that being abstract, breaks spatialtoolbox
1 parent 160fb5f commit 7503137

3 files changed

Lines changed: 60 additions & 24 deletions

File tree

gui/src/main/resources/META-INF/services/org.hortonmachine.gears.libs.modules.HMModel

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,22 @@ org.hortonmachine.gears.modules.v.vectortransformer.OmsVectorTransformer
125125
org.hortonmachine.gears.ui.OmsCoverageViewer
126126
org.hortonmachine.gears.ui.OmsMapsViewer
127127
org.hortonmachine.hmachine.geoframe.core.WaterBudgetSimulation
128+
org.hortonmachine.hmachine.geoframe.ermworkflow.ErmCalibration
129+
org.hortonmachine.hmachine.geoframe.ermworkflow.ErmDataPreparator
130+
org.hortonmachine.hmachine.geoframe.ermworkflow.ErmKriging
131+
org.hortonmachine.hmachine.geoframe.ermworkflow.ErmPrestleyEt
132+
org.hortonmachine.hmachine.geoframe.ermworkflow.ErmRadiation
133+
org.hortonmachine.hmachine.geoframe.ermworkflow.ErmSimulation
134+
org.hortonmachine.hmachine.geoframe.ermworkflow.ErmStationDataImporter
128135
org.hortonmachine.hmachine.geoframe.io.GeoframeEnvDatabaseIterator
129136
org.hortonmachine.hmachine.geoframe.io.GeoframeWaterBudgetSimulationWriter
137+
org.hortonmachine.hmachine.geoframe.io.database.importer.GeoframeRawDataImporter
138+
org.hortonmachine.hmachine.geoframe.utils.KrigingAtCentroid
139+
org.hortonmachine.hmachine.geoframe.utils.PrestleyETAtCentroid
140+
org.hortonmachine.hmachine.geoframe.utils.RadiationAtCentroid
141+
org.hortonmachine.hmachine.geoframe.utils.radiation.LwrbPointCase.Lwrb
142+
org.hortonmachine.hmachine.geoframe.utils.radiation.NetRadiationPointCase
143+
org.hortonmachine.hmachine.geoframe.utils.radiation.swrbPointCase.ShortwaveRadiationBalancePointCase
130144
org.hortonmachine.hmachine.modules.basin.basinshape.OmsBasinShape
131145
org.hortonmachine.hmachine.modules.basin.rescaleddistance.OmsRescaledDistance
132146
org.hortonmachine.hmachine.modules.basin.topindex.OmsTopIndex
@@ -218,19 +232,21 @@ org.hortonmachine.hmachine.modules.networktools.trento_p.utils.DiametersReader
218232
org.hortonmachine.hmachine.modules.statistics.cb.OmsCb
219233
org.hortonmachine.hmachine.modules.statistics.jami.OmsJami
220234
org.hortonmachine.hmachine.modules.statistics.kerneldensity.OmsKernelDensity
221-
org.hortonmachine.hmachine.modules.statistics.kriging.OmsKrigingCheckMode
222-
org.hortonmachine.hmachine.modules.statistics.kriging.OmsKrigingRasterMode
223-
org.hortonmachine.hmachine.modules.statistics.kriging.OmsKrigingVectorMode
224-
org.hortonmachine.hmachine.modules.statistics.kriging.OmsKrigingVectorModeOrig
225-
org.hortonmachine.hmachine.modules.statistics.kriging.nextgen.OmsExperimentalVariogram
226-
org.hortonmachine.hmachine.modules.statistics.kriging.nextgen.OmsKrigingInterpolator
227-
org.hortonmachine.hmachine.modules.statistics.kriging.nextgen.OmsMeasurementsDataCoach
228-
org.hortonmachine.hmachine.modules.statistics.kriging.nextgen.OmsTheoreticalVariogram
229-
org.hortonmachine.hmachine.modules.statistics.kriging.old.OmsKriging
230-
org.hortonmachine.hmachine.modules.statistics.kriging.old.OmsValidateDoubleStation
231-
org.hortonmachine.hmachine.modules.statistics.kriging.old.OmsVariogram
235+
org.hortonmachine.hmachine.modules.statistics.kriging.loo.LeaveOneOutKrigingParallel
236+
org.hortonmachine.hmachine.modules.statistics.kriging.loo.LeaveOneOutKrigings
232237
org.hortonmachine.hmachine.modules.statistics.kriging.variogram.experimental.ExperimentalVariogram
233238
org.hortonmachine.hmachine.modules.statistics.kriging.variogram.theoretical.TheoreticalVariogram
239+
org.hortonmachine.hmachine.modules.statistics.krigingexp.OmsKrigingCheckMode
240+
org.hortonmachine.hmachine.modules.statistics.krigingexp.OmsKrigingRasterMode
241+
org.hortonmachine.hmachine.modules.statistics.krigingexp.OmsKrigingVectorMode
242+
org.hortonmachine.hmachine.modules.statistics.krigingexp.OmsKrigingVectorModeOrig
243+
org.hortonmachine.hmachine.modules.statistics.krigingexp.nextgen.OmsExperimentalVariogram
244+
org.hortonmachine.hmachine.modules.statistics.krigingexp.nextgen.OmsKrigingInterpolator
245+
org.hortonmachine.hmachine.modules.statistics.krigingexp.nextgen.OmsMeasurementsDataCoach
246+
org.hortonmachine.hmachine.modules.statistics.krigingexp.nextgen.OmsTheoreticalVariogram
247+
org.hortonmachine.hmachine.modules.statistics.krigingexp.old.OmsKriging
248+
org.hortonmachine.hmachine.modules.statistics.krigingexp.old.OmsValidateDoubleStation
249+
org.hortonmachine.hmachine.modules.statistics.krigingexp.old.OmsVariogram
234250
org.hortonmachine.hmachine.modules.statistics.sumdownstream.OmsSumDownStream
235251
org.hortonmachine.lesto.modules.buildings.LasOnDtmBuildingsExtractor
236252
org.hortonmachine.lesto.modules.filter.LasHeightDistribution
@@ -422,4 +438,3 @@ org.hortonmachine.modules.VoronoiDiagram
422438
org.hortonmachine.modules.Wateroutlet
423439
org.hortonmachine.modules.WindowSampler
424440
org.hortonmachine.modules.Xyz2Raster
425-
org.hortonmachine.hmachine.geoframe.ErmDataPreparator

hmachine/src/main/java/org/hortonmachine/hmachine/modules/network/netnumbering/OmsGeoframeInputsBuilder.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.awt.image.WritableRaster;
2121
import java.io.File;
2222
import java.util.ArrayList;
23+
import java.util.Collection;
24+
import java.util.Collections;
2325
import java.util.HashMap;
2426
import java.util.List;
2527
import java.util.Map;
@@ -65,13 +67,18 @@
6567
import org.locationtech.jts.geom.Coordinate;
6668
import org.locationtech.jts.geom.Envelope;
6769
import org.locationtech.jts.geom.Geometry;
70+
import org.locationtech.jts.geom.GeometryFactory;
6871
import org.locationtech.jts.geom.LineString;
6972
import org.locationtech.jts.geom.Point;
7073
import org.locationtech.jts.geom.Polygon;
74+
import org.locationtech.jts.geom.PrecisionModel;
7175
import org.locationtech.jts.geom.prep.PreparedGeometry;
7276
import org.locationtech.jts.geom.prep.PreparedGeometryFactory;
7377
import org.locationtech.jts.linearref.LengthIndexedLine;
78+
import org.locationtech.jts.operation.overlay.snap.GeometrySnapper;
7479
import org.locationtech.jts.operation.union.CascadedPolygonUnion;
80+
import org.locationtech.jts.operation.union.UnaryUnionOp;
81+
import org.locationtech.jts.precision.GeometryPrecisionReducer;
7582

7683
import oms3.annotations.Author;
7784
import oms3.annotations.Description;
@@ -316,8 +323,19 @@ public void process() throws Exception {
316323
maxBasinNum = Math.max(maxBasinNum, basinNum);
317324

318325
List<Geometry> polygons = entry.getValue();
319-
Geometry basin = CascadedPolygonUnion.union(polygons);
320-
326+
327+
// TODO check
328+
// Geometry basin = CascadedPolygonUnion.union(polygons);
329+
330+
// this has been done for an example that was not joining the polygons
331+
PrecisionModel pm2 = new PrecisionModel(1e7);
332+
GeometryPrecisionReducer reducer = new GeometryPrecisionReducer(pm2);
333+
reducer.setPointwise(true); // avoids introducing new topology issues
334+
List<Geometry> reduced = polygons.stream()
335+
.map(reducer::reduce)
336+
.collect(Collectors.toList());
337+
Geometry basin = CascadedPolygonUnion.union(reduced);
338+
321339
// extract largest basin
322340
double maxArea = Double.NEGATIVE_INFINITY;
323341
Geometry maxPolygon = basin;

hmachine/src/main/java/org/hortonmachine/hmachine/modules/statistics/kriging/Kriging.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.commons.math3.util.Pair;
3131
import org.geotools.data.simple.SimpleFeatureCollection;
3232
import org.hortonmachine.gears.libs.exceptions.ModelsRuntimeException;
33+
import org.hortonmachine.gears.libs.modules.HMConstants;
3334
import org.hortonmachine.gears.libs.modules.HMModel;
3435
import org.hortonmachine.gears.libs.monitor.IHMProgressMonitor;
3536
import org.hortonmachine.gears.libs.monitor.LogProgressMonitor;
@@ -55,6 +56,7 @@
5556
import oms3.annotations.License;
5657
import oms3.annotations.Name;
5758
import oms3.annotations.Status;
59+
import oms3.annotations.UI;
5860

5961
/**
6062
* Abstract class implementing the core Ordinary Kriging algorithm.
@@ -79,16 +81,17 @@
7981
* NullPointerException.
8082
* </p>
8183
*/
82-
@Description("Ordinary kriging algorithm.")
83-
@Documentation("Kriging.html")
84-
@Author(name = "Giuseppe Formetta, Daniele Andreis, Silvia Franceschi, Andrea Antonello, Marialaura Bancheri & Francesco Serafin")
85-
@Keywords("Kriging, Hydrology")
86-
@Label("")
87-
@Name("kriging")
88-
@Status()
89-
@License("General Public License Version 3 (GPLv3)")
90-
@SuppressWarnings("nls")
91-
public abstract class Kriging extends HMModel {
84+
//@Description("Ordinary kriging algorithm.")
85+
//@Documentation("Kriging.html")
86+
//@Author(name = "Giuseppe Formetta, Daniele Andreis, Silvia Franceschi, Andrea Antonello, Marialaura Bancheri & Francesco Serafin")
87+
//@Keywords("Kriging, Hydrology")
88+
//@Label("")
89+
//@Name("kriging")
90+
//@UI(HMConstants.HIDE_UI_HINT)
91+
//@Status()
92+
//@License("General Public License Version 3 (GPLv3)")
93+
//@SuppressWarnings("nls")
94+
public abstract class Kriging {
9295

9396
@Description("The .shp of the measurement point, containing the position of the stations.")
9497
@In

0 commit comments

Comments
 (0)