# ASIF WRF: Ash, Smoke, Ice and Fire

so2du

### How to Calculate Sulfur Dioxide Concentrations in Dobson Units with WRF Output

To calculate the total Dobson Units (DU) in a column, the user needs to extract the necessary information from the WRF output files, first. First, you need temperature and pressure.

WRF uses perturbation pressure and perturbation temperature, which must first be converted to T and P to yield pressure and potential temperature.

```P  = a->P
T  = a->T
PB = a->PB

pres = P + PB
temp = T + 300
```

a is the variable specifying the file.

Now, pressure and potential temperature may be converted into T in Kelvin by using the NCL function wrf_tk. This function will not retain dimensions and coordinates, however. After this is done, the mixing ratio of air must be calculated for each pressure level.

```TK = wrf_tk(pres,temp)

av   = 6.02 * 10^23
avp  = av * pres
rt   = 8.314 * TK
nair = avp/rt
```

nair will contain the mixing ratio of air for each i,j,k cell. All the user needs to do after is convert the SO2 field from ppmv to molecules / m3.

```so2ppm = a->so2
so2 = so2ppm ;to retain metadata
so2 = so2 X nair
```

Dobson units are a column density, so we must add up all of the values in the column. This reduces the units from molecules / m3 to molecules / m2. Using DX@a and DY@a, one can calculate how much this is per meter squared.

I wrote a page on the Dobson Unit on Wikipedia which explains where the conversion comes from. Because 1 DU is equal to 2.69 X 1020 molecules m-2, the variable so2 which we created needs to be divided by this number.

```du    = 2.69 * 10^20
so2DU = so2 / du
```