Added optional ncid parameter to nc_write subroutines. Dramatic speed-up. Interface could be improved though.