Hello, I am trying to calculate the vertical temperature gradient between the surface and 1 km AGL using wrf-python.
I did the following:
temp2m= wrf.getvar(wrfnc,'T2') #wrfnc is the WRF output file for a specific hour
tk= wrf.getvar(wrfnc,'tk') # Temperature in Kelvin
height_agl= wrf.getvar(wrfnc,'height_agl') # Model Height for Mass Grid (AGL) in m
temp_1km = wrf.interplevel(tk, height_agl, 1000) # tempertaure interpolated to 1000 m above AGL
Then I caculate dthe temperature gradient between surace and 1 km AGL as follows:
del_T1= temp_1km-temp2m # kelvin
del_h1= 998 #1000 m- 2 m
Temp_gradient= -(del_T1/del_h1)*1000 # -dT/dz (K/km)
I am getting very high values for Temp_gradient, and I am not sure if they are meteorologically correct. I have attached a screenshot of the values.
The minimum and maximum values of the temperature gradient between the surface and 1 km AGL are between -10.44 K/km and 153.48 K/km. Can anyone please tell me what I am doing wrong that is leading to such high values for temperature gradient?
I did the following:
temp2m= wrf.getvar(wrfnc,'T2') #wrfnc is the WRF output file for a specific hour
tk= wrf.getvar(wrfnc,'tk') # Temperature in Kelvin
height_agl= wrf.getvar(wrfnc,'height_agl') # Model Height for Mass Grid (AGL) in m
temp_1km = wrf.interplevel(tk, height_agl, 1000) # tempertaure interpolated to 1000 m above AGL
Then I caculate dthe temperature gradient between surace and 1 km AGL as follows:
del_T1= temp_1km-temp2m # kelvin
del_h1= 998 #1000 m- 2 m
Temp_gradient= -(del_T1/del_h1)*1000 # -dT/dz (K/km)
I am getting very high values for Temp_gradient, and I am not sure if they are meteorologically correct. I have attached a screenshot of the values.
![1712183790245.png 1712183790245.png](https://forum.mmm.ucar.edu/data/attachments/11/11963-dd930a0755818731c1fa0186710ccd48.jpg)