def osborn_theta(inputs):
    """Calculate potential temperature theta and its derivative."""
    Rcp = 0.286
    P0 = 1000 * 100  # mbar to Pa

    theta = inputs['t'] * (P0 / inputs['p'])**Rcp

    amp = (P0/inputs['p'])**Rcp
    p_ratio = inputs['dpdz'] / inputs['p']
    dthetaz = amp * (inputs['dtdz'] - Rcp * inputs['t'] * p_ratio)

    return theta, dthetaz