GNS-Science / nzshm-opensha

renamed successor to old nshm-nz-opensha , all python history removed to new nzshm-runzi repo
MIT License
1 stars 2 forks source link

Min mag is off by one MFD bin #289

Closed chrisdicaprio closed 7 months ago

chrisdicaprio commented 7 months ago

For the NZ NSHM 2022 we had set crustal min mag = 6.8. However, the target MFD in the inversion was set to 6.9. To correct this, we had to set min mag = 6.799

See

I suspect the culprit may be in public static ArrayList<GutenbergRichterMagFreqDist> getCharSubSeismoOnFaultMFD_forEachSection(

lines 124-136. See the TODO comment in the code below:

 mMaxIndex = Math.max(mMaxIndex, totalTargetGR.getClosestXIndex(minMag));
        //  int mMaxIndex = totalTargetGR.getXIndex(upperMag);
            if(mMaxIndex == -1) throw new RuntimeException("Problem Mmax: "
                    +rupSet.getMinMagForSection(s)+"\t"+rupSet.getFaultSectionDataList().get(s).getName());

            /*
             * TODO: why does mMaxIndex = 14 return 6.449999999999999, while 15 returns 6.55 ??
             */
            double mMax = totalTargetGR.getX(mMaxIndex); // rounded to nearest MFD value
//if(mMax<5.85)
//  System.out.println("PROBLEM SubSesMmax=\t"+mMax+"\tMinSeismoRupMag=\t"
//          +invRupSet.getFinalMinMagForSection(s)+"\t"+invRupSet.getFaultSectionData(s).getName());
            GutenbergRichterMagFreqDist tempOnFaultGR = new GutenbergRichterMagFreqDist(totalTargetGR.getMinX(), totalTargetGR.size(),