SolarFluxCorrectionFactorCalculator { static double getDayCorrectionFactorFor(int day, int year) { final double gamma = PI * 2 * (day - 1) / getNumDaysInTheYear(year); return 1.000110 + 0.034221 * cos(gamma) + 0.001280 * sin(gamma) + 0.000719 * cos(2 * gamma) + 0.000077 * sin(2 * gamma); }  static double computeFactorFor(ProductData.UTC startTime, ProductData.UTC endTime); static double computeFactorFor(ProductData.UTC time); static ProductData.UTC getCenterUTC(ProductData.UTC start, ProductData.UTC end); static synchronized int getNumDaysInTheYear(int year);  }
@Test public void testGetSolarFluxDayCorrectionFactorForADay() { final int nonLeapYear = 2007; assertEquals(1.0350, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1, nonLeapYear), 1e-4); assertEquals(1.0306, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endJan, nonLeapYear), 1e-4); assertEquals(1.0190, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endFeb, nonLeapYear), 1e-4); assertEquals(1.0014, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endMar, nonLeapYear), 1e-4); assertEquals(0.9845, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endApr, nonLeapYear), 1e-4); assertEquals(0.9717, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endMay, nonLeapYear), 1e-4); assertEquals(0.9666, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endJun, nonLeapYear), 1e-4); assertEquals(0.9700, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endJul, nonLeapYear), 1e-4); assertEquals(0.9814, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endAug, nonLeapYear), 1e-4); assertEquals(0.9976, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endSep, nonLeapYear), 1e-4); assertEquals(1.0155, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endOct, nonLeapYear), 1e-4); assertEquals(1.0292, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(1 + endNov, nonLeapYear), 1e-4); assertEquals(1.0309, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endJan, nonLeapYear), 1e-4); assertEquals(1.0195, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endFeb, nonLeapYear), 1e-4); assertEquals(1.0020, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endMar, nonLeapYear), 1e-4); assertEquals(0.9851, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endApr, nonLeapYear), 1e-4); assertEquals(0.9720, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endMay, nonLeapYear), 1e-4); assertEquals(0.9667, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endJun, nonLeapYear), 1e-4); assertEquals(0.9698, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endJul, nonLeapYear), 1e-4); assertEquals(0.9809, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endAug, nonLeapYear), 1e-4); assertEquals(0.9970, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endSep, nonLeapYear), 1e-4); assertEquals(1.0150, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endOct, nonLeapYear), 1e-4); assertEquals(1.0288, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(endNov, nonLeapYear), 1e-4); assertEquals(1.0350, SolarFluxCorrectionFactorCalculator.getDayCorrectionFactorFor(31 + endNov, nonLeapYear), 1e-4); }