Commit 50aed654c9152ed0142569c32f857cf8c20e0f9d

Authored by Marcelo Bianchi
1 parent 4c7fd16d
Exists in code

CSV as default dump

Showing 1 changed file with 8 additions and 3 deletions   Show diff stats
readbol.py
... ... @@ -116,7 +116,7 @@ def completudeTwo(evento):
116 116 global years, years2
117 117  
118 118 if evento.magnitude is None: return False
119   -
  119 + if evento.ot < years2[0][0]: return False
120 120 limit_mag = np.interp(evento.ot, years2[0], years2[1])
121 121 return evento.magnitude >= limit_mag
122 122  
... ... @@ -521,8 +521,12 @@ class Evento(object):
521 521 'comentario' : self.comentario
522 522 })
523 523  
  524 + @staticmethod
  525 + def headers():
  526 + return "Ot;Latitude;Longitude;Erh;Profundidade;Magnitude;Estado;Tipo M.;Categoria;Intensidade;Area;Commentario"
  527 +
524 528 def __str__(self):
525   - return "{} {:6.2f} {:7.2f} {:3.0f} {:5.1f} {:4.1f} {:2s} {:2d} {} {:3s} {:5.1f} -- {}".format(
  529 + return "{};{:6.2f};{:7.2f};{:3.0f};{:5.1f};{:4.1f};{:2s};{:2d};{};{:3s};{:5.1f};{}".format(
526 530 self.ot.strftime("%Y-%m-%dT%H:%M:%S"),
527 531 self.latitude,
528 532 self.longitude,
... ... @@ -534,7 +538,7 @@ class Evento(object):
534 538 self.categoria,
535 539 (("{}-{}".format(*self.intensidade)) if self.intensidade[0] != self.intensidade[1] else " {} ".format(self.intensidade[0])) if self.intensidade is not None else " - ",
536 540 self.area,
537   - self.comentario
  541 + self.comentario.replace(";",",")
538 542 )
539 543  
540 544  
... ... @@ -718,6 +722,7 @@ if __name__ == &quot;__main__&quot;:
718 722 ## Dump
719 723 #
720 724 if options.dodump:
  725 + print(Evento.headers())
721 726 list(map(print, bolall))
722 727 elif options.dogmtdump:
723 728 exportgmt(bolall)
... ...