13. Assignment 1, brightness temperatures#
Download assign1.ipynb from the week2 folder
For this assignment you’re asked to write a function to calculate the “brightness temperature”, defined as the temperature a blackbody would need to have to emit an observed monochromatic radiance \(I_\lambda\):
Fill in the notebooks cells indicated below and upload your notebook to canvas.
13.1. Question 1#
In the cell below, write a function that calculates the blackbody radiance. You can/should just adapt the code from Plotting the Planck function - solution so that it evaluates W&H 4.10:
Your function should have the following name and signature
def calc_Blambda(wavel, Temp):
"""
Calculate the blackbody radiance (W&H 4.10)
Parameters
----------
wavel: float or array
wavelength (meters)
Temp: float
temperature (K)
Returns
-------
Blambda: float or arr
monochromatic blackbody radiance (W/m^2/m/sr)
"""
### Question 1
### your Blambda function here
###
13.2. Question 2#
13.2.1. brightness temperature function#
In the cell below, write a new function to compute the brightness temperature \(T_{bright}\). It should have the following name and signature
def calc_Tbright(wavel, I):
"""
Calculate the brightness temperature
Parameters
----------
wavel: float
wavelength (meters)
I: float or array
radiance (W/m^2/m/sr)
Returns
-------
Tbright: float or arr
brightness temperature (K)
"""
### Question 2 answer
### your version of calc_Tbright here
###
13.3. Question 3#
Test your function by executing a round trip for some wavelength and temperature. In the cell below, define a wavelength wavelen and a temperture the_temp and use them to calculate blackbody radiance Iblack with your function calc_Blambda. Then calculate a brightness temperature Tbright using calc_Tbright and make sure it is equal to the_temp using the function numpy.testing.assert_almost_equal
Something like:
np.testing.assert_almost_equal(the_temp, Tbright)
### Question 3 answer
#
# your question 3 solution here
#