Coherent terahertz emission from a plasma layer due to linear conversion of laser wakefields on pre-modulated ion density