def test_simple_isotropic_atmosphere(): # prepare inputs density = [300, 300] temperature = [265, 265] thickness = [0.4, 10] radius = [200e-6, 400e-6] stickiness = [0.2, 0.2] rads = sensor_list.amsre('36V') atmos = SimpleIsotropicAtmosphere(30., 6., 0.90) snowpack = make_snowpack(thickness, "sticky_hard_spheres", density=density, temperature=temperature, radius=radius, stickiness=stickiness) # create the EM Model - Equivalent DMRTML iba = make_model("iba", "dort") res1 = iba.run(rads, snowpack) snowpack.atmosphere = atmos res2 = iba.run(rads, snowpack) print('TB 1: ', res1.TbV(), 'TB2: ', res2.TbV()) # absorption with effective permittivity assert abs(res1.TbV() - 227.61318467710458) < 1e-2 assert abs(res2.TbV() - 214.66092232541834) < 1e-2
def test_iba_oneconfig(): # prepare inputs l = 2 n_max_stream = 64 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 # create the snowpack snowpack = make_snowpack(thickness=thickness, microstructure_model="exponential", density=density, temperature=temperature, corr_length=p_ex) # create the snowpack m = make_model("iba_original", "dort") # create the sensor radiometer = sensor_list.amsre('37V') # run the model res = m.run(radiometer, snowpack) print(res.TbV(), res.TbH()) #original absorption (Maetzler 1998) assert abs(res.TbV() - 247.92344524715216) < 1e-4 assert abs(res.TbH() - 237.0863426896562) < 1e-4
def test_simple_isotropic_atmosphere(): # prepare inputs density = [300, 300] temperature = [265, 265] thickness = [0.4, 10] radius = [200e-6, 400e-6] #stickiness = [1000, 1000] stickiness = [0.2, 0.2] rads = sensor_list.amsre('36V') atmos = SimpleIsotropicAtmosphere(30., 6., 0.90) snowpack = make_snowpack(thickness, "sticky_hard_spheres", density=density, temperature=temperature, radius=radius, stickiness=stickiness) # create the EM Model - Equivalent DMRTML iba = make_model("iba", "dort") res1 = iba.run(rads, snowpack) res2 = iba.run(rads, snowpack, atmosphere=atmos) print('TB 1: ', res1.TbV(), 'TB2: ', res2.TbV()) #absorption with effective permittivity #ok_(abs(res1.TbV() - 227.59158654174465) < 1e-2) #ok_(abs(res2.TbV() - 214.64368439876984) < 1e-2) #original absorption (Maetzler 1998) ok_(abs(res1.TbV() - 223.925496277253) < 1e-2) ok_(abs(res2.TbV() - 211.7175839349701) < 1e-2)
def test_mixed_emmodel(): # prepare inputs l = 2 nl = l // 2 # // Forces integer division thickness = np.array([0.1, 0.1] * nl) thickness[-1] = 100 # last one is semi-infinit radius = np.array([2e-4] * l) temperature = np.array([250.0, 250.0] * nl) density = [200, 400] * nl stickiness = [0.1, 0.1] * nl emmodel = ["dmrt_qcacp_shortrange", "iba"] * nl # create the snowpack snowpack = make_snowpack(thickness, "sticky_hard_spheres", density=density, temperature=temperature, radius=radius, stickiness=stickiness) # create the EM Model m = make_model(emmodel, "dort") # create the sensor radiometer = sensor_list.amsre('37V') # run the model res = m.run(radiometer, snowpack) print(res.TbV(), res.TbH()) #assert (res.TbV() - 203.84730126016882) < 1e-4 #assert (res.TbH() - 189.53130277932084) < 1e-4 #assert (res.TbV() - 203.8473395866384) < 1e-4 #assert (res.TbH() - 189.53346053779396) < 1e-4 #assert (res.TbV() - 204.6641326749464) < 1e-4 #assert (res.TbH() - 190.42438454209372) < 1e-4 assert (res.TbV() - 204.61156255625286) < 1e-4 assert (res.TbH() - 190.5085529486018) < 1e-4
def test_iba_oneconfig_passive(): # prepare inputs snowpack = setup_snowpack(l=2) # create the snowpack m = make_model("iba", "dort") # create the sensor radiometer = sensor_list.amsre('37V') # run the model res = m.run(radiometer, snowpack) print(res.TbV(), res.TbH()) #absorption with effective permittivity # abs(res.TbV() - 248.08794944809972) < 1e-4 # abs(res.TbH() - 237.3056263719142) < 1e-4 assert abs(res.TbV() - 248.08744066791073) < 1e-4 assert abs(res.TbH() - 237.30720491883298) < 1e-4
def test_iba_oneconfig(): # prepare inputs l = 2 n_max_stream = 64 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 # create the snowpack snowpack = make_snowpack(thickness=thickness, microstructure_model="exponential", density=density, temperature=temperature, corr_length=p_ex) # create the snowpack m = make_model("iba", "dort") # create the sensor radiometer = sensor_list.amsre('37V') # run the model res = m.run(radiometer, snowpack) print(res.TbV(), res.TbH()) #absorption with effective permittivity #ok_(abs(res.TbV() - 248.08807673119517) < 1e-4) #ok_(abs(res.TbH() - 237.3106696695165) < 1e-4) #original absorption (Maetzler 1998) ok_(abs(res.TbV() - 247.92402825320272) < 1e-4) ok_(abs(res.TbH() - 237.08967658310334) < 1e-4)
# prepare inputs l = 2 n_max_stream = 64 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 # create the snowpack snowpack = make_snowpack(thickness=thickness, microstructure_model="exponential", density=density, temperature=temperature, corr_length=p_ex) # create the snowpack m = make_model("iba", "dort") # create the sensor sensor = sensor_list.amsre('37V') # run the model res = m.run(sensor, snowpack) # outputs print(res.TbV())
#!/usr/bin/env python from smrt import make_snowpack, make_model, sensor_list # prepare inputs thickness = [100] corr_length = [5e-5] temperature = [270] density = [320] # create the snowpack snowpack = make_snowpack(thickness=thickness, microstructure_model="exponential", density=density, temperature=temperature, corr_length=corr_length) # create the sensor radiometer = sensor_list.amsre('37V') # create the model m = make_model("iba", "dort") # run the model result = m.run(radiometer, snowpack) # outputs print(result.TbV(), result.TbH())