refactored slice_nc.py