import glob


def number_of_netcdf_files(source_dir):
    """
    Counts the number of netcdf files in the given directory
    :param source_dir:
    :return:
    """
    netcdf_pattern = source_dir + "/*.nc"
    netcdf_list=sorted(glob.glob(netcdf_pattern))
    return len(netcdf_list)