Generic Example#

This example shows how to use calculate the upwelling brigthness temperature by using R16 and R03 absorption model and then plotting them difference.

import matplotlib.pyplot as plt

plt.rcParams.update({'font.size': 15})
import matplotlib.ticker as ticker
from matplotlib.ticker import ScalarFormatter
import numpy as np

Import pyrtlib package#

from pyrtlib.climatology import AtmosphericProfiles as atmp
from pyrtlib.tb_spectrum import TbCloudRTE
from pyrtlib.utils import ppmv2gkg, mr2rh
atm = ['Tropical',
       'Midlatitude Summer',
       'Midlatitude Winter',
       'Subarctic Summer',
       'Subarctic Winter',
       'U.S. Standard']

Load standard atmosphere (low res at lower levels, only 1 level within 1 km) and define which absorption model will be used.#

z, p, d, t, md = atmp.gl_atm(atmp.TROPICAL)
gkg = ppmv2gkg(md[:, atmp.H2O], atmp.H2O)
rh = mr2rh(p, t, gkg)[0] / 100

mdl = 'R16'

Performing upwelling brightness temperature calculation#

Default calculatoin consideres no cloud

ang = np.array([90.])
frq = np.arange(20, 201, 1)
nf = len(frq)

Setup matplotlib plot

fig, ax = plt.subplots(1, 1, figsize=(12,8))
ax.set_xlabel('Frequency [GHz]')
ax.set_ylabel('${T_B}$ [K]')

rte = TbCloudRTE(z, p, t, rh, frq, ang)
rte.init_absmdl(mdl)
df = rte.execute()

df = df.set_index(frq)
df.tbtotal.plot(ax=ax, linewidth=1, label='{} - {}'.format(atm[atmp.TROPICAL], mdl))

ax.legend()
plt.show()
generic tutorial

Print dataframe

tbtotal tbatm tmr tmrcld tauwet taudry tauliq tauice angle
20 298.110002 0.0 286.950083 0.0 0.120344 0.012852 0.0 0.0 90.0
21 297.245665 0.0 286.301002 0.0 0.188808 0.013520 0.0 0.0 90.0
22 296.153554 0.0 285.000618 0.0 0.261848 0.014254 0.0 0.0 90.0
23 296.340281 0.0 285.635982 0.0 0.257913 0.015061 0.0 0.0 90.0
24 297.158487 0.0 286.738458 0.0 0.202308 0.015949 0.0 0.0 90.0
... ... ... ... ... ... ... ... ... ...
196 281.727840 0.0 281.271511 0.0 3.672975 0.025470 0.0 0.0 90.0
197 282.282634 0.0 281.732202 0.0 3.460000 0.025639 0.0 0.0 90.0
198 282.748703 0.0 282.110004 0.0 3.289848 0.025809 0.0 0.0 90.0
199 283.140697 0.0 282.421200 0.0 3.152710 0.025979 0.0 0.0 90.0
200 283.470546 0.0 282.678463 0.0 3.041424 0.026150 0.0 0.0 90.0

181 rows × 9 columns



Performing calculation for R03 absorption model#

mdl = 'R03'
rte.init_absmdl(mdl)
df_r03 = rte.execute()
df_r03 = df_r03.set_index(frq)

Add brigthness temperature values as new column

tbtotal tbatm tmr tmrcld tauwet taudry tauliq tauice angle delta
20 298.110002 0.0 286.950083 0.0 0.120344 0.012852 0.0 0.0 90.0 0.001587
21 297.245665 0.0 286.301002 0.0 0.188808 0.013520 0.0 0.0 90.0 -0.048560
22 296.153554 0.0 285.000618 0.0 0.261848 0.014254 0.0 0.0 90.0 -0.142017
23 296.340281 0.0 285.635982 0.0 0.257913 0.015061 0.0 0.0 90.0 -0.076094
24 297.158487 0.0 286.738458 0.0 0.202308 0.015949 0.0 0.0 90.0 0.007044
... ... ... ... ... ... ... ... ... ... ...
196 281.727840 0.0 281.271511 0.0 3.672975 0.025470 0.0 0.0 90.0 -0.163239
197 282.282634 0.0 281.732202 0.0 3.460000 0.025639 0.0 0.0 90.0 -0.155826
198 282.748703 0.0 282.110004 0.0 3.289848 0.025809 0.0 0.0 90.0 -0.148959
199 283.140697 0.0 282.421200 0.0 3.152710 0.025979 0.0 0.0 90.0 -0.142665
200 283.470546 0.0 282.678463 0.0 3.041424 0.026150 0.0 0.0 90.0 -0.136943

181 rows × 10 columns



Difference between R16 and R03 brightness temperature

fig, ax = plt.subplots(1, 1, figsize=(12,8))
ax.set_xlabel('Frequency [GHz]')
ax.set_ylabel('$\Delta {T_B}$ [K]')
df.delta.plot(ax=ax, figsize=(12,8), label='$\Delta {T_B}$ (R16-R03)')
ax.legend()
plt.show()
generic tutorial

Performing downwelling brightness temperature calculation#

fig, ax = plt.subplots(1, 1, figsize=(12,8))
ax.set_xlabel('Frequency [GHz]')
ax.set_ylabel('${T_B}$ [K]')

rte.satellite = False
df_from_ground = rte.execute()

df_from_ground = df_from_ground.set_index(frq)
df_from_ground.tbtotal.plot(ax=ax, linewidth=1, label='{} - {}'.format(atm[atmp.TROPICAL], mdl))
ax.legend()
plt.show()
generic tutorial
tbtotal tbatm tmr tmrcld tauwet taudry tauliq tauice angle
20 38.128741 36.134999 287.743766 0.0 0.119654 0.012880 0.0 0.0 90.0
21 53.630710 51.778478 287.523121 0.0 0.183271 0.013535 0.0 0.0 90.0
22 68.662408 66.946561 286.852765 0.0 0.249677 0.014254 0.0 0.0 90.0
23 68.995937 67.297760 287.359334 0.0 0.249866 0.015044 0.0 0.0 90.0
24 58.551138 56.787298 288.054500 0.0 0.201670 0.015913 0.0 0.0 90.0
... ... ... ... ... ... ... ... ... ...
196 290.018674 290.011203 297.080877 0.0 3.697474 0.024929 0.0 0.0 90.0
197 288.150026 288.140925 296.858817 0.0 3.486909 0.025091 0.0 0.0 90.0
198 286.377998 286.367374 296.670993 0.0 3.318905 0.025255 0.0 0.0 90.0
199 284.738957 284.726955 296.513082 0.0 3.183692 0.025418 0.0 0.0 90.0
200 283.252699 283.239484 296.380928 0.0 3.074147 0.025583 0.0 0.0 90.0

181 rows × 9 columns



Total running time of the script: (0 minutes 15.012 seconds)

Gallery generated by Sphinx-Gallery