Example #1
0
def get_model(dt, lats, lons):
    alt = 0
    # set isv to 0 (main field) because that is what it is in example ??
    isv = 0
    # set itype to 1 (geodectic)
    itype = 1
    mx,my,mz,mf,yeardec = runigrf12(dt, isv, itype, [alt], lats, lons)
    return mx[0], my[0], mz[0], mf[0], yeardec
Example #2
0
def get_model_df(df):
    xs = []
    ys = []
    zs = []
    fs = []    
    alt = 0
    # set isv to 0 (main field) because that is what it is in example ??
    isv = 0
    # set itype to 1 (geodectic)
    itype = 1
    for i in df.index:
        x,y,z,f,yr = mx,my,mz,mf,yeardec = runigrf12(i, isv, itype, alt, 
                                                     df.loc[i,'lat'], df.loc[i,'lon'])
        xs.append(x[0])
        ys.append(y[0])
        zs.append(z[0])
        fs.append(f[0])
    df.loc[:,'igrfx'] = xs
    df.loc[:,'igrfy'] = ys
    df.loc[:,'igrfz'] = zs
    df.loc[:,'igrff'] = fs
    return df