#!/bin/bash

for file in ../NETCDF/*.nc ; do
  BN=`basename $file`
  ON=SUBS/$BN
  #echo "$file into $ON"
  if [[ $file -nt $ON ]] ; then
    echo "subsetting $file into $ON"
    ncks -d time,0,23 -O $file $ON 
  else 
    #echo "skipping $BN as "
    true
  fi
done
cp $file $ON
