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

Merge branch 'handle-singleton-siteclass-dim' into 'main'

Handle singleton site class dimension

Closes #61

See merge request !129
parents feb51bf3 02e116b4
No related branches found
No related tags found
2 merge requests!131Production Release | nshmp-ws-static,!129Handle singleton site class dimension
Pipeline #181900 passed
......@@ -124,21 +124,24 @@ public class BoundingReaderHazardCurves extends BoundingReader<StaticDataHazardC
for (int iImt = 0; iImt < netcdfData.imts().size(); iImt++) {
var imt = netcdfData.imts().get(iImt);
// Build origin array, e.g [0, imt, siteClass]
var origin = netcdf.netcdfShape().buildShape()
// origin array builder, e.g [0, imt, siteClass]
var originBuilder = netcdf.netcdfShape().buildShape()
.add(IndexKey.IML, 0)
.add(IndexKey.IMT, iImt)
.add(IndexKey.SITE_CLASS, iSiteClass)
.reduce()
.build();
.add(IndexKey.IMT, iImt);
// Build shape array, e.g. [nIML, 1, 1]
var shape = netcdf.netcdfShape().buildShape()
// shape array builder, e.g. [nIML, 1, 1]
var shapeBuilder = netcdf.netcdfShape().buildShape()
.add(IndexKey.IML, netcdfData.nIml())
.add(IndexKey.IMT, 1)
.add(IndexKey.SITE_CLASS, 1)
.reduce()
.build();
.add(IndexKey.IMT, 1);
// Only add index for siteClass if this is not a singleton dimension
if (netcdfData.siteClasses().size() > 1) {
originBuilder.add(IndexKey.SITE_CLASS, iSiteClass);
shapeBuilder.add(IndexKey.SITE_CLASS, 1);
}
var origin = originBuilder.reduce().build();
var shape = shapeBuilder.reduce().build();
try {
var xySequence = XySequence.create(
......
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