def read_phi(self):
        """
        Read the electrostatic potenential from the NetCDF file.
        """

        self.phi = field.get_field_final_timestep(self.cdf_file, 'phi', None)

        self.phi = field.field_to_real_space_final_timestep(self.phi)*\
                   self.rho_star
    """
    shape = field.shape
    nx = shape[0]
    nky = shape[1]
    ny = 2*(nky - 1)
    nth = shape[2]

    field_real_space = np.empty([nx,ny,nth],dtype=float)
    field_real_space = np.fft.irfft2(field, axes=[0,1])
    field_real_space = np.roll(field_real_space, int(nx/2), axis=0)

    return field_real_space*nx*ny

cdf_file = sys.argv[1]
ncfile = Dataset(cdf_file, 'r')
phi = field.get_field_final_timestep(cdf_file, 'phi', None)
ntot = field.get_field_final_timestep(cdf_file, 'ntot', 0)
tperp = field.get_field_final_timestep(cdf_file, 'tperp', 0)
tpar = field.get_field_final_timestep(cdf_file, 'tpar', 0)
ky = np.array(ncfile.variables['ky'][:])
theta = np.array(ncfile.variables['theta'][:])
gradpar = np.array(ncfile.variables['gradpar'][:])
bmag = np.array(ncfile.variables['bmag'][:])
grho = np.array(ncfile.variables['grho'][:])
q_nc = np.array(ncfile.variables['es_heat_flux'][:, 0])

shape = phi.shape
nx = shape[0]
nky = shape[1]
ny = 2*(nky - 1)
nth = shape[2]