[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python #KVR-769486]: Warning at the calculation of relative humidity from water vapor mixing ratio by using metpy

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [python #KVR-769486]: Warning at the calculation of relative humidity from water vapor mixing ratio by using metpy
  • Date: Sun, 20 Aug 2023 16:40:10 -0600

Greetings!

Without seeing the original data, it's hard to know exactly the cause of the 
warnings. Given what those warnings are about, though, it's definitely likely 
that those values will result in NaN (or *possibly* Inf) values in the final 
resulting arrays.

Cheers,

Ryan

> Dear all,
> By using metpy, we are trying to calculate the relative humidity from 
> satellite-derived temperature and mixing ratio. But, we got the error/warning 
> like a mentioned below. Is it provide any wrong in the relative humidity data 
> ? or is the value will be deleted and filling with Nan at that place 
> (position where error occur). Please provide any suggestion…
> 
> Error:
> /home/srinu/anaconda3/lib/python3.9/site-packages/metpy/calc/thermo.py:1384: 
> RuntimeWarning: divide by zero encountered in log
> val = np.log(vapor_pressure / mpconsts.nounit.sat_pressure_0c)
> /home/srinu/anaconda3/lib/python3.9/site-packages/metpy/calc/thermo.py:1385: 
> RuntimeWarning: invalid value encountered in divide
> return mpconsts.nounit.zero_degc + 243.5 * val / (17.67 - val)
> /home/srinu/anaconda3/lib/python3.9/site-packages/metpy/calc/thermo.py:1384: 
> RuntimeWarning: invalid value encountered in log
> val = np.log(vapor_pressure / mpconsts.nounit.sat_pressure_0c)


Ticket Details
===================
Ticket ID: KVR-769486
Department: Support Python
Priority: Low
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.