def _climlab_to_cam3(self, field):
if np.isscalar(field):<EOL><INDENT>return field<EOL><DEDENT>elif self.JM > <NUM_LIT:1>:<EOL><INDENT>if (field.shape == (self.KM,)):<EOL><INDENT>return np.tile(field[...,np.newaxis], self.JM)<EOL><DEDENT>else:<EOL><INDENT>return np.squeeze(np.transpose(field))[..., np.newaxis]<EOL><DEDENT><DEDENT>else:  <EOL><INDENT>return field[..., np.newaxis, np.newaxis]<EOL><DEDENT>
Prepare field with proper dimension order.
        CAM3 code expects 3D arrays with (KM, JM, 1)
        and 2D arrays with (JM, 1).

        climlab grid dimensions are any of:
            - (KM,)
            - (JM, KM)
            - (JM, IM, KM)

        (longitude dimension IM not yet implemented here).