  We present the wavelength calibration for the lenslet-based Integral Field
Spectrograph (IFS) that serves as the science instrument for the Gemini Planet
Imager (GPI). The GPI IFS features a 2.7" x 2.7" field of view and a 190 x 190
lenslet array (14.3 mas/lenslet) operating in $Y$, $J$, $H$, and $K$ bands with
spectral resolving power ranging from $R$ $\sim$ 35 to 78. Due to variations
across the field of view, a unique wavelength solution is determined for each
lenslet characterized by a two-dimensional position, the spectral dispersion,
and the rotation of the spectrum with respect to the detector axes. The four
free parameters are fit using a constrained Levenberg-Marquardt least-squares
minimization algorithm, which compares an individual lenslet's arc lamp
spectrum to a simulated arc lamp spectrum. This method enables measurement of
spectral positions to better than 1/10th of a pixel on the GPI IFS detector
using Gemini's facility calibration lamp unit GCAL, improving spectral
extraction accuracy compared to earlier approaches. Using such wavelength
calibrations we have measured how internal flexure of the spectrograph with
changing zenith angle shifts spectra on the detector. We describe the methods
used to compensate for these shifts when assembling datacubes from on-sky
observations using GPI.
