コード例 #1
0
    def __str__(self):
        """
        Pretty string representation.
        """
        from lasif.utils import sizeof_fmt
        # Count all files and sizes.

        raw_data_file_count = 0
        processed_data_file_count = 0
        synthetic_data_file_count = 0
        station_file_count = 0
        project_filesize = 0

        for dirpath, _, filenames in os.walk(self.paths["root"]):
            size = sum([
                os.path.getsize(os.path.join(dirpath, _i)) for _i in filenames
            ])
            project_filesize += size
            if dirpath.startswith(self.paths["data"]):
                if dirpath.endswith("raw"):
                    raw_data_file_count += len(filenames)
                elif "processed" in dirpath:
                    processed_data_file_count += len(filenames)
            elif dirpath.startswith(self.paths["synthetics"]):
                synthetic_data_file_count += len(filenames)
            elif dirpath.startswith(self.paths["stations"]):
                station_file_count += len(filenames)

        ret_str = "LASIF project \"%s\"\n" % self.config["name"]
        ret_str += "\tDescription: %s\n" % self.config["description"]
        ret_str += "\tProject root: %s\n" % self.paths["root"]
        ret_str += "\tContent:\n"
        ret_str += "\t\t%i events\n" % self.comm.events.count()
        ret_str += "\t\t%i station files\n" % station_file_count
        ret_str += "\t\t%i raw waveform files\n" % raw_data_file_count
        ret_str += "\t\t%i processed waveform files \n" % \
                   processed_data_file_count
        ret_str += "\t\t%i synthetic waveform files\n" % \
                   synthetic_data_file_count

        ret_str += "\tTotal project size: %s\n\n" % \
                   sizeof_fmt(project_filesize)

        d = str(self.domain)
        ret_str += "\n".join(["\t" + i for i in d.splitlines()])

        return ret_str
コード例 #2
0
ファイル: project.py プロジェクト: Phlos/LASIF
    def __str__(self):
        """
        Pretty string representation.
        """
        from lasif.utils import sizeof_fmt
        # Count all files and sizes.

        raw_data_file_count = 0
        processed_data_file_count = 0
        synthetic_data_file_count = 0
        station_file_count = 0
        project_filesize = 0

        for dirpath, _, filenames in os.walk(self.paths["root"]):
            size = sum([os.path.getsize(os.path.join(dirpath, _i))
                        for _i in filenames])
            project_filesize += size
            if dirpath.startswith(self.paths["data"]):
                if dirpath.endswith("raw"):
                    raw_data_file_count += len(filenames)
                elif "processed" in dirpath:
                    processed_data_file_count += len(filenames)
            elif dirpath.startswith(self.paths["synthetics"]):
                synthetic_data_file_count += len(filenames)
            elif dirpath.startswith(self.paths["stations"]):
                station_file_count += len(filenames)

        ret_str = "LASIF project \"%s\"\n" % self.config["name"]
        ret_str += "\tDescription: %s\n" % self.config["description"]
        ret_str += "\tProject root: %s\n" % self.paths["root"]
        ret_str += "\tContent:\n"
        ret_str += "\t\t%i events\n" % self.comm.events.count()
        ret_str += "\t\t%i station files\n" % station_file_count
        ret_str += "\t\t%i raw waveform files\n" % raw_data_file_count
        ret_str += "\t\t%i processed waveform files \n" % \
                   processed_data_file_count
        ret_str += "\t\t%i synthetic waveform files\n" % \
                   synthetic_data_file_count

        ret_str += "\tTotal project size: %s\n\n" % \
                   sizeof_fmt(project_filesize)

        d = str(self.domain)
        ret_str += "\n".join(["\t" + i for i in d.splitlines()])

        return ret_str
コード例 #3
0
ファイル: project.py プロジェクト: Debesys/LASIF
    def __str__(self):
        """
        Pretty string representation.
        """
        from lasif.utils import sizeof_fmt
        # Count all files and sizes.

        raw_data_file_count = 0
        processed_data_file_count = 0
        synthetic_data_file_count = 0
        station_file_count = 0
        project_filesize = 0

        for dirpath, _, filenames in os.walk(self.paths["root"]):
            size = sum([os.path.getsize(os.path.join(dirpath, _i))
                        for _i in filenames])
            project_filesize += size
            if dirpath.startswith(self.paths["data"]):
                if dirpath.endswith("raw"):
                    raw_data_file_count += len(filenames)
                elif "processed" in dirpath:
                    processed_data_file_count += len(filenames)
            elif dirpath.startswith(self.paths["synthetics"]):
                synthetic_data_file_count += len(filenames)
            elif dirpath.startswith(self.paths["stations"]):
                station_file_count += len(filenames)

        ret_str = "LASIF project \"%s\"\n" % self.config["name"]
        ret_str += "\tDescription: %s\n" % self.config["description"]
        ret_str += "\tProject root: %s\n" % self.paths["root"]
        ret_str += "\tContent:\n"
        ret_str += "\t\t%i events\n" % self.comm.events.count()
        ret_str += "\t\t%i station files\n" % station_file_count
        ret_str += "\t\t%i raw waveform files\n" % raw_data_file_count
        ret_str += "\t\t%i processed waveform files \n" % \
                   processed_data_file_count
        ret_str += "\t\t%i synthetic waveform files\n" % \
                   synthetic_data_file_count

        ret_str += "\tTotal project size: %s\n\n" % \
                   sizeof_fmt(project_filesize)

        # Add information about the domain.
        if self.domain == "global":
            ret_str += u"\tGlobal domain"
        else:
            domain = {}
            domain.update(self.domain["bounds"])
            domain["latitude_extend"] = \
                domain["maximum_latitude"] - domain["minimum_latitude"]
            domain["latitude_extend_in_km"] = domain["latitude_extend"] \
                                              * 111.32
            domain["longitude_extend"] = \
                domain["maximum_longitude"] - domain["minimum_longitude"]
            domain["longitude_extend_in_km"] = domain["longitude_extend"] \
                                               * 111.32
            domain["depth_extend_in_km"] = \
                domain["maximum_depth_in_km"] - domain["minimum_depth_in_km"]
            ret_str += (
                u"\tLatitude: {minimum_latitude:.2f}° - "
                u"{maximum_latitude:.2f}°"
                u" (total of {latitude_extend:.2f}° "
                u"≅ {latitude_extend_in_km} km)\n"
                u"\tLongitude: {minimum_longitude:.2f}° - "
                u"{maximum_longitude:.2f}°"
                u" (total of {longitude_extend:.2f}° "
                u"≅ {longitude_extend_in_km} km)\n"
                u"\tDepth: {minimum_depth_in_km}km - {maximum_depth_in_km}km"
                u" (total of {depth_extend_in_km}km)\n") \
                .format(**domain)

            # Add information about rotation axis.
            if self.domain["rotation_angle"]:
                a = self.domain["rotation_axis"]
                ret_str += \
                    u"\tDomain rotated around axis %.1f/%.1f/%.1f for %.2f°" \
                    % (a[0], a[1], a[2], self.domain["rotation_angle"])
            else:
                ret_str += "\tDomain is not rotated."

        return ret_str.encode("utf-8")