 
     //-----------------Create Netcdf output file with attributes----------//
     int ncid_out;
-    err = nc_create(argv[2],NC_NETCDF4|NC_CLOBBER, &ncid_out);
+    err = nc_create(argv[2],NC_NETCDF4|NC_NOCLOBBER, &ncid_out);
 
     /// Set global attributes
     std::map<std::string, std::string> att;

        if( record.name != "xc" && record.name != "yc" && record.name != "zc" )
        {
            int vID;
            err = nc_def_var( ncid_out, record.name.data(), NC_FLOAT, 3, &dim_ids[1],
                &vID);
            err = nc_put_att_text( ncid_out, vID, "long_name", record.long_name.size(),
                record.long_name.data());

            int dataID = 0;
            err = nc_inq_varid(ncid_in, record.name.data(), &dataID);

    double time=0.;

    size_t steps;
    err = nc_inq_unlimdim( ncid_in, &timeID);
    err = nc_inq_dimlen( ncid_in, timeID, &steps);
    size_t count3d_in[4]  = {1, g3d_in.Nz(), g3d_in.n()*g3d_in.Ny(),
        g3d_in.n()*g3d_in.Nx()};
    size_t count3d_out[4] = {1, g3d_out_periodic_equidistant.Nz(),
        g3d_out_equidistant.n()*g3d_out_equidistant.Ny(),
        g3d_out_equidistant.n()*g3d_out_equidistant.Nx()};
    size_t count3d_aligned_out[4] = {1, g3d_out_fieldaligned.Nz(),
        g3d_out_fieldaligned.n()*g3d_out_fieldaligned.Ny(),
        g3d_out_fieldaligned.n()*g3d_out_fieldaligned.Nx()};
    size_t start3d_in[4] = {0, 0, 0, 0};
    size_t start3d_out[4] = {0, 0, 0, 0};
    ///////////////////////////////////////////////////////////////////////
    for( unsigned i=0; i<steps; i+=TIME_FACTOR)//timestepping
    {
        std::cout << "Timestep = "<<i<< "/"<<steps;
        start3d_in[0] = i;
        // read and write time
        err = nc_get_vara_double( ncid_in, timeID, start3d_in, count3d_in,
                &time);
        std::cout << "  time = " << time << std::endl;
        start3d_out[0] = i/TIME_FACTOR;
        err = nc_put_vara_double( ncid_out, tvarID, start3d_out, count3d_out,
                &time);
        err = nc_put_vara_double( ncid_out, tvarIDF, start3d_out,
                count3d_aligned_out, &time);
        for( auto& record : feltor::diagnostics3d_list)
        {
            std::string record_name = record.name;
