reworking KLo's trend and gapfilling code for CW
finished step 1 of KLo's trend calculation