public static CalendarDateRange getWantedDateRange(SubsetParams ncssParams) throws NcssException {
        if (ncssParams.isTrue(SubsetParams.timePresent)) {  // present
            CalendarDate time = CalendarDate.present();
            CalendarPeriod timeWindow = ncssParams.getTimeWindow();
            if (timeWindow == null) timeWindow = CalendarPeriod.Hour;
            return CalendarDateRange.of(time.subtract(timeWindow), time.add(timeWindow));

        } else if (ncssParams.getTime() != null) {  // Means we want just one single time.
            CalendarDate time = ncssParams.getTime();
            CalendarPeriod timeWindow = ncssParams.getTimeWindow();
            if (timeWindow == null) timeWindow = CalendarPeriod.Hour;

            // To prevent features from being too agressively excluded, we are accepting times that are within
            // an hour of the specified time.
            // LOOK: Do we really need the +- increment?
            //CalendarDate startR = CalendarDate.parseISOformat(null, time);
            //startR = startR.subtract(CalendarPeriod.Hour);
            //CalendarDate endR = CalendarDate.parseISOformat(null, time);
            //endR = endR.add(CalendarPeriod.Hour);
            return CalendarDateRange.of(time.subtract(timeWindow), time.add(timeWindow));

        } else if (ncssParams.getTimeRange() != null) {
            return ncssParams.getTimeRange();

        } else if (ncssParams.isTrue(SubsetParams.timeAll )) {  // Client explicitly requested all times.
            return null;   // "null" means that we want ALL times, i.e. "do not subset".

        } else {          // Client didn't specify a time parameter.
            return null;  // Do not subset.
        }
    }
public static CalendarDateRange getWantedDateRange(SubsetParams ncssParams) throws NcssException {
        if (ncssParams.isTrue(SubsetParams.timePresent)) {  
            CalendarDate time = CalendarDate.present();
            CalendarPeriod timeWindow = ncssParams.getTimeWindow();
            if (timeWindow == null) timeWindow = CalendarPeriod.Hour;
            return CalendarDateRange.of(time.subtract(timeWindow), time.add(timeWindow));

        } else if (ncssParams.getTime() != null) {  
            CalendarDate time = ncssParams.getTime();
            CalendarPeriod timeWindow = ncssParams.getTimeWindow();
            if (timeWindow == null) timeWindow = CalendarPeriod.Hour;

            
            
            
            
            
            
            
            return CalendarDateRange.of(time.subtract(timeWindow), time.add(timeWindow));

        } else if (ncssParams.getTimeRange() != null) {
            return ncssParams.getTimeRange();

        } else if (ncssParams.isTrue(SubsetParams.timeAll )) {  
            return null;   

        } else {          
            return null;  
        }
    }
public static CalendarDateRange getWantedDateRange ( SubsetParams ncssParams ) throws NcssException { if ( ncssParams . isTrue ( SubsetParams . timePresent ) ) { // present CalendarDate time = CalendarDate . present ( ) ; CalendarPeriod timeWindow = ncssParams . getTimeWindow ( ) ; if ( timeWindow == null ) timeWindow = CalendarPeriod . Hour ; return CalendarDateRange . of ( time . subtract ( timeWindow ) , time . add ( timeWindow ) ) ; } else if ( ncssParams . getTime ( ) != null ) { // Means we want just one single time. CalendarDate time = ncssParams . getTime ( ) ; CalendarPeriod timeWindow = ncssParams . getTimeWindow ( ) ; if ( timeWindow == null ) timeWindow = CalendarPeriod . Hour ; // To prevent features from being too agressively excluded, we are accepting times that are within // an hour of the specified time. // LOOK: Do we really need the +- increment? //CalendarDate startR = CalendarDate.parseISOformat(null, time); //startR = startR.subtract(CalendarPeriod.Hour); //CalendarDate endR = CalendarDate.parseISOformat(null, time); //endR = endR.add(CalendarPeriod.Hour); return CalendarDateRange . of ( time . subtract ( timeWindow ) , time . add ( timeWindow ) ) ; } else if ( ncssParams . getTimeRange ( ) != null ) { return ncssParams . getTimeRange ( ) ; } else if ( ncssParams . isTrue ( SubsetParams . timeAll ) ) { // Client explicitly requested all times. return null ; // "null" means that we want ALL times, i.e. "do not subset". } else { // Client didn't specify a time parameter. return null ; // Do not subset. } }
TODO: This needs testing.
TODO : This needs testing .