Awkable

Load and convert data to a form suitable for Alex’s awk based scripts

import pandas as pd
from igndata import load
import matplotlib.pyplot as plt
df = load('./lapalma.csv')
df.head()
Loading...
df["id"] = df["Event"]
df["yyyymmdd"] = df["Date"].dt.strftime("%Y%m%d")
df["hhmmss"] = pd.to_datetime(df["UTC time"]).dt.strftime("%H%M%S.000")
df["zero"] = 0
df.head()
Loading...
df.to_csv("./lapalma_awkable.csv", index=False, 
          columns=['yyyymmdd','hhmmss','Latitude','Longitude','Depth(km)','Magnitude','zero','zero','zero','zero','id','zero'],
          header=["yyyymmdd","hhmmss.sss","lat","lon","depth","Mw","q1","q2","nSta","nPha","ID","sourceType"])