private Optional < CoverageCoordAxis > subsetLon ( LatLonRect llbb , int stride ) throws InvalidRangeException { double wantMin = LatLonPointImpl . lonNormalFrom ( llbb . getLonMin ( ) , lonAxis . getStartValue ( ) ) ; double wantMax = LatLonPointImpl . lonNormalFrom ( llbb . getLonMax ( ) , lonAxis . getStartValue ( ) ) ; double start = lonAxis . getStartValue ( ) ; double end = lonAxis . getEndValue ( ) ; // use MAMath.MinMax as a container for two values, min and max List < MAMath . MinMax > lonIntvs = subsetLonIntervals ( wantMin , wantMax , start , end ) ; if ( lonIntvs . size ( ) == 0 ) return Optional . empty ( String . format ( "longitude want [%f,%f] does not intersect lon axis [%f,%f]" , wantMin , wantMax , start , end ) ) ; if ( lonIntvs . size ( ) == 1 ) { MAMath . MinMax lonIntv = lonIntvs . get ( 0 ) ; return lonAxis . subset ( lonIntv . min , lonIntv . max , stride ) ; } // this is the seam crossing case return lonAxis . subsetByIntervals ( lonIntvs , stride ) ; }
here s where to deal with crossing seam