Exemple #1
0
TEST_F(TestCalibratorPhase, phases) {
    FileFake file(1,1,1,1);
    FieldPtr phase = file.getField(Variable::Phase, 0);
    ParameterFile parFile = getParameterFile(273.7,274.7);
    CalibratorPhase cal = getCalibrator(&parFile);
    setValues(file, 5, 270, 0.95, 101325);
    cal.calibrate(file);
    EXPECT_FLOAT_EQ(Variable::PhaseSnow, (*phase)(0,0,0));

    setValues(file, 5, 274, 0.98, 101325);
    cal.calibrate(file);
    EXPECT_FLOAT_EQ(Variable::PhaseSleet, (*phase)(0,0,0));

    setValues(file, 0, 274, 0.5, 101325);
    cal.calibrate(file);
    EXPECT_FLOAT_EQ(Variable::PhaseNone, (*phase)(0,0,0));

    setValues(file, 5, 275, 0.5, 101325);
    cal.calibrate(file);
    EXPECT_FLOAT_EQ(Variable::PhaseSnow, (*phase)(0,0,0));
}
Exemple #2
0
TEST_F(TestCalibratorPhase, useWetbulb) {
    FileFake file(1,1,1,1);
    FieldPtr phase = file.getField(Variable::Phase, 0);
    ParameterFile parFile = getParameterFile(273.7,274.7);
    CalibratorPhase cal = getCalibrator(&parFile);
    setValues(file, 5, 275, 0.5, 101325);

    cal.setUseWetbulb(false);
    cal.calibrate(file);
    EXPECT_FLOAT_EQ(Variable::PhaseRain, (*phase)(0,0,0));

    cal.setUseWetbulb(true);
    cal.calibrate(file);
    EXPECT_FLOAT_EQ(Variable::PhaseSnow, (*phase)(0,0,0));

    setValues(file, 5, 274, 0.5, 101325);
    cal.setUseWetbulb(false);
    cal.calibrate(file);
    EXPECT_FLOAT_EQ(Variable::PhaseSleet, (*phase)(0,0,0));
    cal.setUseWetbulb(true);
    cal.calibrate(file);
    EXPECT_FLOAT_EQ(Variable::PhaseSnow, (*phase)(0,0,0));
}
Exemple #3
0
TEST_F(TestCalibratorPhase, missingParameters) {
    FileArome file("testing/files/10x10.nc");
    ParameterFile parFile = getParameterFile(Util::MV,1.5);
    CalibratorPhase cal = getCalibrator(&parFile);

    cal.calibrate(file);
    FieldPtr phase = file.getField(Variable::Phase, 0);
    for(int i = 0; i < file.getNumLat(); i++) {
        for(int j = 0; j < file.getNumLon(); j++) {
            for(int e = 0; e < file.getNumEns(); e++) {
                EXPECT_FLOAT_EQ(Util::MV, (*phase)(i,j,e));
            }
        }
    }
}