title: Filtering seasonal time series outliers
body: <p>I have some weather-related data that is highly seasonal, what i want to do is
  to identify some 'outliers' and change these outliers to reasonable values (i dont wan't to remove them).</p>
  
  <p>I'm using the <strong>hampel</strong> filter from the <strong>pracma</strong> package to identify and correct these outliers, but the problem is that some seasonal-peaks are being lowered too much. I guess
  this function doesn't take into account seasonality. 
  The plot below shows this (window of 24 months), the red line is the filtered data.</p>
  
  <p>Is there a way to correct this?In other words, take the 'peaks' and average them between seasons?
  Thanks!
  <img src="https://i.stack.imgur.com/XhEu5.png" alt="enter image description here"></p>