function ddt_ew = ddt_vapor_press(pressure, ta)

%function ddt_ew = ddt_vapor_press(pressure, ta)
%This calculates the rate of change with temperature of the saturation
%vapor pressure.  The 'old' formula, which ignores the corrections
%due to having air above salt water is given by
%ddt_ew = log(10)*0.031532*ew_ta./((1 + 0.00412*ta).^2);
%The simpler procedure is to take finite differences.  This works fine
%because the curve for the saturation vapor pressure is very smooth.
%This procedure was tested by running test_ddt_ew.m which compared the
%two formulae at 1000 mb and with temperature varying between -5 and
%30 degrees celsius.  The relative difference was less than 0.07%.

%     Copyright J. V. Mansbridge, CSIRO, october 11 1993

delta_t = 0.001;
tap = ta + delta_t;
tam = ta - delta_t;
two_del = 2*delta_t;
ddt_ew = ( vapor_press(pressure, tap) - ...
    vapor_press(pressure, tam) )/two_del;
