;********************************************************* ; sphum_to_mxrat.pro converts specific humidity to mixing ratio ; ; INPUT ; sphum = specific humidity in kg/kg ; = kg vapor/kg total air ; ; OUTPUT ; mxrat = mixing ratio in kg/kg ; = kg vapor/ kg dry air ;********************************************************* pro sphum_to_mxrat,sphum,mxrat,missing ; Make a mxrat array the same size as sphum mxrat=sphum ; Convert specific humidity to mixing ratio using this equation: ; w = q/(1-q) w=mxrat, q=sphum result=where(sphum ne missing,count) if count gt 0 then begin mxrat[result]=sphum[result]/(1.0-sphum[result]) endif return end