def test_less_refringent_bottom_layer(): # Regression test 19-03-2018: value may change if other bugs found snowpack = make_snowpack([0.2, 0.3], "sticky_hard_spheres", density=[290.0, 250.0], radius=50e-6, stickiness=0.2, substrate=make_soil("transparent", 1, 270)) m = make_model("dmrt_qcacp_shortrange", "dort") scat = active(10e9, 45) res = m.run(scat, snowpack) print(res.sigmaVV_dB(), res.sigmaHH_dB()) assert abs(res.sigmaVV_dB() - -50.25547167709486) < 1e-1 assert abs(res.sigmaHH_dB() - -50.52755576862734) < 1e-1 # The following test fails # def test_less_refringent_bottom_layer_VV(): # # Regression test 19-03-2018: value may change if other bugs found # snowpack = make_snowpack([0.2, 0.3], "sticky_hard_spheres", density = [290.0, 250.0], radius = 1e-4, stickiness=0.2) # m = make_model("dmrt_qcacp_shortrange", "dort") # scat = active(10e9, 45) # res = m.run(scat, snowpack) # print(res.sigmaVV()) # assert abs(res.sigmaVV() - 7.54253344e-05) < 1e-7 # # # def test_less_refringent_bottom_layer_HH(): # # Regression test 19-03-2018: value may change if other bugs found # snowpack = make_snowpack([0.2, 0.3], "sticky_hard_spheres", density = [290.0, 250.0], radius = 1e-4, stickiness=0.2) # m = make_model("dmrt_qcacp_shortrange", "dort") # scat = active(10e9, 45) # res = m.run(scat, snowpack) # print(res.sigmaHH()) # assert abs(res.sigmaHH() - 7.09606407e-05) < 1e-7
def test_soil_wegmuller_dobson85(): # prepare inputs soiltemperature = 270 clay = 0.3 sand = 0.4 drymatter = 1100 moisture = 0.2 roughness_rms = 1e-2 substrate = make_soil("soil_wegmuller", "dobson85", soiltemperature, moisture=moisture, roughness_rms=roughness_rms, clay=clay, sand=sand, drymatter=drymatter) snowpack = prepare_snowpack(substrate) res = run_model(snowpack) print(res.TbV(), res.TbH()) assert abs(res.TbV() - 262.60009290172155) < 1e-4 assert abs(res.TbH() - 255.8655605977706) < 1e-4
def _do_test_isothermal_universe(pc, thickness_1): T = 265 substrate = make_soil('soil_wegmuller', permittivity_model=complex(10, 1), roughness_rms=0.001, temperature=T) snowpack = make_snowpack([0.3, thickness_1], "exponential", density=[200, 300], temperature=T, corr_length=pc, substrate=substrate) atmosphere = SimpleIsotropicAtmosphere(tbdown=T, tbup=0, trans=1) # create the sensor theta = range(10, 80, 5) radiometer = sensor_list.passive(37e9, theta) # create the EM Model m = make_model("iba", "dort") # run the model sresult = m.run(radiometer, snowpack, atmosphere) np.testing.assert_allclose(sresult.TbV(), T, atol=0.01) np.testing.assert_allclose(sresult.TbH(), T, atol=0.01)
def test_less_refringent_bottom_layer_VV(): # Regression test 19-03-2018: value may change if other bugs found snowpack = make_snowpack([0.2, 0.3], "sticky_hard_spheres", density = [290.0, 250.0], radius = 50e-6, stickiness=0.2, substrate=make_soil("transparent", 1, 270)) m = make_model("dmrt_qcacp_shortrange", "dort") scat = active(10e9, 45) res = m.run(scat, snowpack) print(res.sigmaVV()) assert abs(res.sigmaVV() - 9.42202173e-06) < 1e-9
def test_dmrt_with_soil(): # prepare inputs density = [300, 300] temperature = [245, 245] thickness = [0.1, 0.1] radius = [200e-6, 400e-6] stickiness = [1000, 1000] soiltemperature = 270 clay = 0.3 sand = 0.4 drymatter = 1100 moisture = 0.2 roughness_rms = 1e-2 substrate = make_soil("soil_wegmuller", "dobson85", soiltemperature, moisture=moisture, roughness_rms=roughness_rms, clay=clay, sand=sand, drymatter=drymatter) snowpack = make_snowpack(thickness, "sticky_hard_spheres", density=density, temperature=temperature, radius=radius, stickiness=stickiness, substrate=substrate) # create the EM Model m = make_model("dmrt_qcacp_shortrange", "dort") # create the sensor radiometer = sensor.passive(37e9, 40) # test at 40° to avoid the Brewster angle # run the model res = m.run(radiometer, snowpack) print(res.TbV(), res.TbH()) #assert (res.TbV() - 262.6214674671272) < 1e-4 assert (res.TbV() - 262.62154074526325) < 1e-4 #assert (res.TbH() - 255.88791903746) < 1e-4 assert (res.TbH() - 255.88831382514428) < 1e-4
def test_soil_wegmuller_montpetit2008(): # prepare inputs soiltemperature = 270 roughness_rms = 1e-2 substrate = make_soil("soil_wegmuller", "montpetit2008", soiltemperature, roughness_rms=roughness_rms) snowpack = prepare_snowpack(substrate) res = run_model(snowpack) print(res.TbV(), res.TbH()) assert abs(res.TbV() - 262.45644269568135) < 1e-4 assert abs(res.TbH() - 255.7131655561391) < 1e-4
def setup_snowpack(l): nl = l // 2 # // Forces integer division thickness = np.array([0.1, 0.1] * nl) thickness[-1] = 100 # last one is semi-infinit p_ex = np.array([5e-5] * l) temperature = np.array([250.0, 250.0] * nl) density = [200, 400] * nl soil = make_soil("geometrical_optics_backscatter", water_permittivity, temperature=273.15, mean_square_slope=1e-2) # create the snowpack snowpack = make_snowpack(thickness=thickness, microstructure_model="exponential", density=density, temperature=temperature, corr_length=p_ex, substrate=soil) return snowpack
def _do_test_kirchoff_law(pc, thickness_1): T = 265 substrate = make_soil('soil_wegmuller', permittivity_model=complex(10, 1), roughness_rms=0.001, temperature=T) snowpack = make_snowpack([0.3, thickness_1], "exponential", density=[200, 300], temperature=T, corr_length=pc, substrate=substrate) atmosphere1K = SimpleIsotropicAtmosphere(tbdown=1, tbup=0, trans=1) # create the sensor theta = range(10, 80, 5) radiometer = sensor_list.passive(37e9, theta) # create the EM Model m = make_model("iba", "dort") # run the model sresult_0 = m.run(radiometer, snowpack) sresult_1 = m.run(radiometer, snowpack, atmosphere1K) # V-pol emissivity_V = (sresult_0.TbV() + sresult_1.TbV()) / 2 / T reflectivity_V = (sresult_1.TbV() - sresult_0.TbV()) print(emissivity_V, 1 - reflectivity_V) np.testing.assert_allclose(emissivity_V, 1 - reflectivity_V, atol=0.002) # H-pol emissivity_H = (sresult_0.TbH() + sresult_1.TbH()) / 2 / T reflectivity_H = (sresult_1.TbH() - sresult_0.TbH()) print(emissivity_H, 1 - reflectivity_H) np.testing.assert_allclose(emissivity_H, 1 - reflectivity_H, atol=0.002)