Esempio n. 1
0
def compdelta(latlon):
    assert isinstance(latlon,DataFrame)
    latlon.sort_values(by=['mlat','glat'],inplace=True)
    Dmlat_deg = latlon['mlat'].diff()
    Dglat_km = latlon['glat'].diff()*kmperdeglat
    return latlon,Dmlat_deg,Dglat_km

if __name__ == '__main__':
    from matplotlib.pyplot import show
    from geo2mag.plots import plotgeomag
    #
    from argparse import ArgumentParser
    p = ArgumentParser(description='read site data and convert geographic/geodetic coordinates to geomagnetic coordinates')
    g = p.add_mutually_exclusive_group(required=True)
    g.add_argument('fn',help='data file',nargs='?')
    g.add_argument('-c','--latlon',help='enter lat,lon instead of file',nargs=2,type=float)
    p = p.parse_args()

    if p.latlon:
        latlon = p.latlon
    else:
        latlon = loadsites(p.fn)
#%% go to the cloud to compute magnetic coordinate from geodetic
    latlon = loopcoord(latlon)
#%% compute kilometers per magnetic degree lat vs. geodetic degree
    latlon,Dmlat_deg,Dglat_km = compdelta(latlon)
#%% plot
    plotgeomag(latlon)
    show()
Esempio n. 2
0
#!/usr/bin/env python
from numpy.testing import assert_allclose
from geo2mag.geo2mag_coord import loopcoord


latlon = loopcoord((65,-148))

assert_allclose(latlon.values[0,2:],[ 65.56, -96.46])