# Create a new variable “dbz” (VAPOR 3.3)

**URL:** <https://vapor.discourse.group/t/create-a-new-variable-dbz-vapor-3-3/46>\
**Category:** Uncategorized\
**Created:** [December 23, 2020, 1:29pm UTC](https://vapor.discourse.group/t/create-a-new-variable-dbz-vapor-3-3/46 "2020-12-23T13:29:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jack](https://vapor.discourse.group/u/jack)\
**Post date:** [December 23, 2020, 1:29pm UTC](https://vapor.discourse.group/t/create-a-new-variable-dbz-vapor-3-3/46/1 "2020-12-23T13:29:19Z")

</div>

Hello everyone.  
I want to add a new variable “dbz” which represents the simulated radar reflectivity.  
The python script consists of the following two lines:  
import vapor\_wrf  
dbz = vapor\_wrf.DBZ(P,PB,QRAIN,QGRAUP,QSNOW,T,QVAPOR)

## However, there was error message as below: Vapor 3.3.0. OS: Windows 6.2 (9200)

## Failed to calculate variable dbz

## Failed to read variable “dbz” at time step (0), and refinement level (-1) and level-of-detail (-1) Failed to read region from variable/timestep/level/lod (dbz, 0, -1, -1) PyRun\_String() : Traceback (most recent call last): File “”, line 1, in File “C:\Program Files\VAPOR\share\python\vapor\_wrf.py”, line 18, in import vapor ModuleNotFoundError: No module named ‘vapor’

Can anyone help me with this problem?  
Thank you!

Jack

---

<div class="post-metadata">

**Author:** ![clyne](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@clyne](https://vapor.discourse.group/u/clyne)\
**Post date:** [December 24, 2020, 10:00pm UTC](https://vapor.discourse.group/t/create-a-new-variable-dbz-vapor-3-3/46/2 "2020-12-24T22:00:50Z")

</div>

Unfortunately, support for the vapor\_wrf module has not yet been added to VAPOR3. There is an open issue for it on GitHub here:

> <https://github.com/NCAR/VAPOR/issues/2239>
>
> Is your feature request related to a problem?
> One functionality that was in VAPOR2 that I found extremely useful was the vapor\_wrf...

Feel free to comment or upvote. That said, the VAPOR2 vapor\_wrf Python module is included with VAPOR3. I was able to get the DBZ code to work with the following change:

```
diff --git a/share/python/vapor_wrf.py b/share/python/vapor_wrf.py
index b87cf363..d5e9d175 100755
--- a/share/python/vapor_wrf.py
+++ b/share/python/vapor_wrf.py
@@ -14,8 +14,8 @@
        wrf_div_findiff - finite-difference divergence'''
        
 import numpy 
-import vapor_utils
-import vapor
+#import vapor_utils^M
+#import vapor^M
 def CTT(P,PB,T,QCLOUD,QICE):
        '''Calculate cloud-top temperature using WRF variables.
        Calling sequence: VAL=CTT(P,PB,T,QCLOUD,QICE)
@@ -114,11 +114,11 @@ def DBZ(P,PB,QRAIN,QGRAUP,QSNOW,T,QVAPOR,iliqskin=0,ivarint=0):
        QVAPOR = numpy.maximum(QVAPOR,0.0)
        QSNOW = numpy.maximum(QSNOW,0.0)
        QRAIN = numpy.maximum(QRAIN,0.0)
- if (vapor.VariableExists(vapor.TIMESTEP,"QGRAUP")):
- QGRAUP = numpy.maximum(QGRAUP,0.0)
- else:   
+# if (vapor.VariableExists(vapor.TIMESTEP,"QGRAUP")):
+# QGRAUP = numpy.maximum(QGRAUP,0.0)
+# else:  
 #Avoid divide by zero if QGRAUP is not present:
- QGRAUP = 1.e-30 
+# QGRAUP = 1.e-30 
        TestT = numpy.less(TK,CELKEL)
        QSNOW = numpy.where(TestT,QRAIN, QSNOW)
        QRAIN = numpy.where(TestT,0.0, QRAIN)
```
