The mechanism of magnetization reversal has been studied in a model system of self-assembled cobalt nanowires with a 3nm diameter. The structure, orientation and size of grains within the nanowires could be determined by high resolution transmission electron microscopy. The magnetic properties were probed using static and dynamic magnetization measurements. Micromagnetic modeling based on the structural analysis allows us to correlate the structure and the magnetic behavior of the wires, revealing competition between shape anisotropy, magnetocrystalline anisotropy and exchange in the localized reversal within Co hcp oriented grains. These results provide direct experimental evidence of the link between anisotropy fluctuations and reversal localization in nanowires.