a bit more elaborated example of writing netcdf