Ejemplo n.º 1
0
 def __str__(self):
     info = ['NRL library at ' + self.root]
     if self.sensors is None:
         info.append('  Sensors not parsed yet.')
     else:
         info.append('  Sensors: {} manufacturers'.format(len(
             self.sensors)))
         if len(self.sensors):
             keys = [key for key in sorted(self.sensors)]
             lines = _textwrap("'" + "', '".join(keys) + "'",
                               initial_indent='    ',
                               subsequent_indent='    ')
             info.extend(lines)
     if self.dataloggers is None:
         info.append('  Dataloggers not parsed yet.')
     else:
         info.append('  Dataloggers: {} manufacturers'.format(
             len(self.dataloggers)))
         if len(self.dataloggers):
             keys = [key for key in sorted(self.dataloggers)]
             lines = _textwrap("'" + "', '".join(keys) + "'",
                               initial_indent='    ',
                               subsequent_indent='    ')
             info.extend(lines)
     return '\n'.join(_i.rstrip() for _i in info)
Ejemplo n.º 2
0
 def __str__(self):
     info = ['NRL library at ' + self.root]
     if self.sensors is None:
         info.append('  Sensors not parsed yet.')
     else:
         info.append(
             '  Sensors: {} manufacturers'.format(len(self.sensors)))
         if len(self.sensors):
             keys = [key for key in sorted(self.sensors)]
             lines = _textwrap("'" + "', '".join(keys) + "'",
                               initial_indent='    ',
                               subsequent_indent='    ')
             info.extend(lines)
     if self.dataloggers is None:
         info.append('  Dataloggers not parsed yet.')
     else:
         info.append('  Dataloggers: {} manufacturers'.format(
             len(self.dataloggers)))
         if len(self.dataloggers):
             keys = [key for key in sorted(self.dataloggers)]
             lines = _textwrap("'" + "', '".join(keys) + "'",
                               initial_indent='    ',
                               subsequent_indent='    ')
             info.extend(lines)
     return '\n'.join(_i.rstrip() for _i in info)
Ejemplo n.º 3
0
 def __str__(self):
     if len(self):
         if self._question:
             info = ['{} ({} items):'.format(self._question, len(self))]
         else:
             info = ['{} items:'.format(len(self))]
         texts = ["'{}'".format(k) for k in sorted(self.keys())]
         info.extend(_textwrap(", ".join(texts), initial_indent='  ',
                               subsequent_indent='  '))
         return '\n'.join(_i.rstrip() for _i in info)
     else:
         return '0 items.'
Ejemplo n.º 4
0
 def __str__(self):
     if len(self):
         if self._question:
             info = ['{} ({} items):'.format(self._question, len(self))]
         else:
             info = ['{} items:'.format(len(self))]
         texts = ["'{}'".format(k) for k in sorted(self.keys())]
         info.extend(_textwrap(", ".join(texts), initial_indent='  ',
                               subsequent_indent='  '))
         return '\n'.join(_i.rstrip() for _i in info)
     else:
         return '0 items.'
Ejemplo n.º 5
0
    def __str__(self):
        contents = self.get_contents()

        x = self.latitude
        y = self.longitude
        z = self.elevation
        site_count = len(self.sites)
        channel_count = len(self.channels)
        ret = (f"\tStation {self.historical_code}\n"
               f"\tStation Code: {self.code}\n"
               f"\tSite Count: {site_count}\n"
               f"\tChannel Count: {channel_count}\n"
               f"\t{self.start_date} - {self.end_date}\n"
               f"\tx: {x:.0f}, y: {y:.0f}, z: {z:.0f} m\n")

        if getattr(self, 'extra', None):
            if getattr(self.extra, 'x', None) and getattr(
                    self.extra, 'y', None):
                x = self.x
                y = self.y
                z = self.z
                ret = ("Station {station_name}\n"
                       "\tStation Code: {station_code}\n"
                       "\tChannel Count: {selected}/{total}"
                       " (Selected/Total)\n"
                       "\t{start_date} - {end_date}\n"
                       "\tEasting [x]: {x:.0f} m, Northing [y] m: {y:.0f}, "
                       "Elevation [z]: {z:.0f} m\n")

        ret = ret.format(station_name=contents["stations"][0],
                         station_code=self.code,
                         selected=self.selected_number_of_channels,
                         total=self.total_number_of_channels,
                         start_date=str(self.start_date),
                         end_date=str(self.end_date) if self.end_date else "",
                         restricted=self.restricted_status,
                         alternate_code="Alternate Code: %s " %
                         self.alternate_code if self.alternate_code else "",
                         historical_code="Historical Code: %s " %
                         self.historical_code if self.historical_code else "",
                         x=x,
                         y=y,
                         z=z)
        ret += "\tAvailable Channels:\n"
        ret += "\n".join(
            _textwrap(", ".join(_unified_content_strings(
                contents["channels"])),
                      initial_indent="\t\t",
                      subsequent_indent="\t\t",
                      expand_tabs=False))

        return ret