Skip to content
Snippets Groups Projects
Commit 1af197bc authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

Add min and max methods

parent cae819a3
No related branches found
No related tags found
2 merge requests!109Production Release,!107AASHTO Updates
...@@ -7,11 +7,11 @@ import java.util.List; ...@@ -7,11 +7,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import gov.usgs.earthquake.nshmp.geo.Bounds; import gov.usgs.earthquake.nshmp.Maths;
import gov.usgs.earthquake.nshmp.geo.Location; import gov.usgs.earthquake.nshmp.geo.Location;
import gov.usgs.earthquake.nshmp.geo.Regions;
import gov.usgs.earthquake.nshmp.gmm.Imt; import gov.usgs.earthquake.nshmp.gmm.Imt;
import gov.usgs.earthquake.nshmp.gmm.NehrpSiteClass; import gov.usgs.earthquake.nshmp.gmm.NehrpSiteClass;
import gov.usgs.earthquake.nshmp.netcdf.reader.NetcdfUtils;
/** /**
* Data info from the NetCDF file. * Data info from the NetCDF file.
...@@ -19,7 +19,8 @@ import gov.usgs.earthquake.nshmp.gmm.NehrpSiteClass; ...@@ -19,7 +19,8 @@ import gov.usgs.earthquake.nshmp.gmm.NehrpSiteClass;
* @author U.S. Geological Survey * @author U.S. Geological Survey
*/ */
public class NetcdfData { public class NetcdfData {
private final Bounds bounds; private final Location minimumBounds;
private final Location maximumBounds;
private final List<Imt> imts; private final List<Imt> imts;
private final double[] latitudes; private final double[] latitudes;
private final double[] longitudes; private final double[] longitudes;
...@@ -33,10 +34,12 @@ public class NetcdfData { ...@@ -33,10 +34,12 @@ public class NetcdfData {
var minLongitude = Arrays.stream(builder.longitudes).min().getAsDouble(); var minLongitude = Arrays.stream(builder.longitudes).min().getAsDouble();
var maxLongitude = Arrays.stream(builder.longitudes).max().getAsDouble(); var maxLongitude = Arrays.stream(builder.longitudes).max().getAsDouble();
bounds = Regions.createRectangular( minimumBounds = Location.create(
"", Maths.round(minLongitude, NetcdfUtils.LOCATION_PRECISION),
Location.create(minLongitude, minLatitude), Maths.round(minLatitude, NetcdfUtils.LOCATION_PRECISION));
Location.create(maxLongitude, maxLatitude)).bounds(); maximumBounds = Location.create(
Maths.round(maxLongitude, NetcdfUtils.LOCATION_PRECISION),
Maths.round(maxLatitude, NetcdfUtils.LOCATION_PRECISION));
imts = builder.imts; imts = builder.imts;
latitudes = builder.latitudes; latitudes = builder.latitudes;
longitudes = builder.longitudes; longitudes = builder.longitudes;
...@@ -46,10 +49,17 @@ public class NetcdfData { ...@@ -46,10 +49,17 @@ public class NetcdfData {
} }
/** /**
* Returns the bounds * Returns the maximum location bounds
*/ */
public Bounds bounds() { public Location maximumBounds() {
return bounds; return maximumBounds;
}
/**
* Returns the minimum location bounds
*/
public Location minimumBounds() {
return minimumBounds;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment