existing_file.close()

            else:
                # create new SD based variable values for extracted lons and lats

                #output_nr= str(iterations) # use iterator for different output names

                # create new HDF5 file containing the datasets within the TP

                import h5py

                f = h5py.File(
                    '/media/juli/Elements/masterthesis_JK/CLOUDSAT_TP/2C-ICE/2009/2009_'
                    + day + '_night.hdf5', "w")

                dset = f.create_dataset("Height", output_dim)
                dset[...] = height_TP

                dset = f.create_dataset("IWC", output_dim)
                dset[...] = iwc_TP

                dset = f.create_dataset("EXT_coef", output_dim)
                dset[...] = EXT_coef_TP

                dset = f.create_dataset("ice_water_path", output_dim_vdata)
                dset[...] = ice_water_path_TP

                dset = f.create_dataset("re", output_dim)
                dset[...] = re_TP

                dset = f.create_dataset("optical_depth", output_dim_vdata)