This is the process to generate phase for each LROC NAC image. This is a circuitous process that involves ISIS and SPC and ends with an ASCII image.
More details can be found here ISIStoPhase
The Fortran code used (processLROjrw.f) can be found on Local Emission
The Fortran code used (rawMOSAICXjrw.f) can be found on Local Emission
A wrapper to run MOSAICX is here. ||MOSAICX Phase Wrapper ||
Finally, sometimes the output from MOSAICX gives low DN for a string of pixels (zero + the offset). If this low value is not correct (i.e. it is not low in the output from ISIS to Emission) then the DN can be interpolated from the surrounding pixels. This is done via dumpMapLRO_fixErrors.f found on Local Emission.