added function to write temporal netCDF files