     err = nc_inq_unlimdim( ncid_in, &timeID); //Attention: Finds first unlimited dim, which hopefully is time and not energy_time
     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.Nz(), g3d_out.n()*g3d_out.Ny(), g3d_out.n()*g3d_out.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 start3d[4] = {0, 0, 0, 0};
     ///////////////////////////////////////////////////////////////////////
     for( unsigned i=0; i<steps; i+=10)//timestepping

            err = nc_get_var_double( ncid_in, dataID, transferH_in.data());
            transferH_out = fieldaligned.interpolate_from_coarse_grid(
                g3d_in, transferH_in);
            dg::assign( transferH_out, transferH_out_float);

            err = nc_enddef( ncid_out);
            err = nc_put_var_float( ncid_out, vID, append(transferH_out_float, g3d_out).data());
            err = nc_redef(ncid_out);
        }
    }
    for( auto record : feltor::generate_cyl2cart( g3d_out) )
    {
        int vID;
        err = nc_def_var( ncid_out, std::get<0>(record).data(), NC_FLOAT, 3, &dim_ids[1],

        p.n_out, p.Nx_out, p.Ny_out, p.Nz_out, p.bcxN, p.bcyN, dg::PER);
    dg::RealCylindricalGrid3d<double> g3d_out( Rmin,Rmax, Zmin,Zmax, 0, 2*M_PI,
        p.n_out, p.Nx_out, p.Ny_out, 3*p.Nz_out, p.bcxN, p.bcyN, dg::PER);
    dg::RealCylindricalGrid3d<double> g3d_out_equidistant( Rmin,Rmax, Zmin,Zmax, 0, 2*M_PI,
        1, p.n_out*p.Nx_out, p.n_out*p.Ny_out, 3*p.Nz_out, p.bcxN, p.bcyN, dg::PER);
    dg::RealCylindricalGrid3d<float> g3d_out_periodic( Rmin,Rmax, Zmin,Zmax, 0, 2*M_PI+g3d_out.hz(),
        p.n_out, p.Nx_out, p.Ny_out, 3*p.Nz_out+1, p.bcxN, p.bcyN, dg::PER);
    dg::RealCylindricalGrid3d<float> g3d_out_periodic_equidistant( Rmin,Rmax, Zmin,Zmax, 0, 2*M_PI+g3d_out.hz(),
        1, p.n_out*p.Nx_out, p.n_out*p.Ny_out, 3*p.Nz_out+1, p.bcxN, p.bcyN, dg::PER);

    // Construct weights and temporaries
    dg::HVec transferH_in = dg::evaluate(dg::zero,g3d_in);
    dg::HVec transferH_out = dg::evaluate(dg::zero,g3d_out);
    dg::HVec transferH = dg::evaluate(dg::zero,g3d_out_equidistant);
    dg::fHVec transferH_out_float = dg::construct<dg::fHVec>( transferH);

    // define 4d dimension
    int dim_ids[4], tvarID;
    err = file::define_dimensions( ncid_out, dim_ids, &tvarID, g3d_out_periodic_equidistant, {"time", "z", "y", "x"});
    std::map<std::string, int> id4d;

    /////////////////////////////////////////////////////////////////////////
