Exemple #1
0
def GetTb(Tz, H, NbLayers, Freq, Angle, NbStreams, Perm, Model, Tbatmo):
    l = NbLayers  # number of layers
    nbinputlayers = np.size(Tz)
    temperature = np.transpose(Tz) + 273.15
    thickness = np.array([H / l] * l)
    depthini = np.linspace(0, H, nbinputlayers)
    depthfin = np.linspace(0, H, l)
    temp = np.interp(depthfin, depthini, temperature[::-1])[::-1]
    density = np.zeros(l)
    radius = 1e-4
    medium = list()
    soilp = dmrtml.HUTRoughSoilParams(273)

    for d in depthfin:
        i = np.where(depthfin == d)[0]
        density[i] = 921.9 - 595.3 * math.exp(-0.01859 * d)

        if density[i] < 458.5:
            medium.append('S')
        elif density[i] < 458.5 and density[i] <= 900.:
            medium.append('F')
        else:
            medium.append('I')

    # Compute the permittivity for the whole profile
    e_ice = Permittivity(Perm, temp, density, Freq)

    if Model == "DMRT-ML":
        res = dmrtml.dmrtml_bis(Freq,
                                NbStreams,
                                thickness,
                                density,
                                radius,
                                temp,
                                medium=medium,
                                soilp=soilp,
                                tbatmodown=Tbatmo,
                                eps_ice=(e_ice[0, :], e_ice[1, :]))
        print(temp)
        return res.TbV(Angle)

    if Model == "SMRT":
        if Perm == "Tiuri":
            ice_permittivity_model = ice_permittivity_tiuri84
        if Perm == "Matzler":
            ice_permittivity_model = ice_permittivity_matzler87

        # create the snowpack
        snowpack = make_snowpack(thickness=thickness,
                                 microstructure_model="sticky_hard_spheres",
                                 density=density,
                                 temperature=temp,
                                 radius=radius,
                                 ice_permittivity_model=ice_permittivity_model)
        # create the snowpack
        m = make_model("dmrt_qcacp_shortrange", "dort")
        radiometer = sensor.passive(Freq, Angle)
        res = m.run(radiometer, snowpack)
        return res.TbV()
Exemple #2
0
def GetTb_SMRT(Tz, H, NbLayers, Freq, Angle, Perm):
    l = NbLayers  # number of layers
    nbinputlayers = np.size(Tz)
    thickness = np.array([H / l] * l)

    #Prepare temperature field and interpolate on the layer altitude
    temperature = np.transpose(Tz) + 273.15
    zini = np.linspace(0, H, nbinputlayers)
    zfin = np.linspace(0, H, l)
    temp = np.interp(zfin, zini, temperature[::-1])[::-1]
    #print(temperature, temp)
    #plt.plot(temperature, zini[::-1])
    #plt.plot(temp, zfin[::-1])
    #plt.show()

    density = np.zeros(l)
    p_ex = np.zeros(l)

    i = 0
    for z in zfin:
        density[i] = 1000. * (0.916 - 0.593 * math.exp(-0.01859 * z)
                              )  #From Macelloni et al, 2016
        #p_ex[i] = 1 - 0.9999 * math.exp(-0.01859 * z / 1e4)
        i = i + 1

    p_ex = 1. / (917 - density + 100)  #100)
    p_ex[0] = 1e-4

    if Perm == "Tiuri":
        ice_permittivity_model = ice_permittivity_tiuri84
    if Perm == "Matzler":
        ice_permittivity_model = ice_permittivity_matzler87

    # create the snowpack
    snowpack = make_snowpack(
        thickness=thickness,
        microstructure_model="exponential",  #sticky_hard_spheres",
        density=density,
        temperature=temp,
        #radius=p_ex,
        corr_length=p_ex)
    #stickiness = 0.1)

    #                             ice_permittivity_model=ice_permittivity_model)

    # create the snowpack
    m = make_model("iba", "dort")
    #m = make_model("dmrt_qcacp_shortrange", "dort")
    # create the sensor
    radiometer = sensor.passive(Freq, Angle)
    # run the model
    res = m.run(radiometer, snowpack)
    # outputs
    return res.TbV()
Exemple #3
0
def run_model(snowpack):

    # 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)
    return res
Exemple #4
0
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