Exemplo n.º 1
0
def plot_2d(field,slat,slon,elat,elon,pdepth,new=True):
    """
    Calculate delaunay triangulation and subsequently probe velocity
    field at points of interest.
    """

    ndist = 0.
    nd = 0.
    values = 0.
                    
    ### calculate points between start and end point using a GMT's project program
    fout = 'profile_points.xyp'
    gmt = GMT()
    gmt.project(C='%f/%f'%(slon,slat),E='%f/%f'%(elon,elat),G=50,Q=True,out_filename=fout)
    lon,lat,dist = np.loadtxt(fout,unpack=True)
    os.remove(fout)
    
    cx = []
    cy = []
    cz = []
    cd = []
    cdp = []
    for _lon,_lat,_dist in zip(lon,lat,dist):
        for _d in pdepth:
            x,y,z = convert_pt(_lat,_lon,_d)
            cx.append(x)
            cy.append(y)
            cz.append(z)
            cd.append(_dist)
            cdp.append(_d)
    values = mlab.pipeline.probe_data(field,cx,cy,cz)
    return np.array(cd), np.array(cdp), values
Exemplo n.º 2
0
def find_scale(slat,slon,elat,elon):
    gmt = GMT()
    maxdist = 0.
    fout = 'profile_points.xyp'
    for _slat,_slon,_elat,_elon in zip(slat,slon,elat,elon):
        gmt.project(C='%f/%f'%(_slon,_slat),E='%f/%f'%(_elon,_elat),G=100,Q=True,out_filename=fout)
        lon,lat,dist = np.loadtxt(fout,unpack=True)
        if dist.max() > maxdist:
            maxdist = dist.max()
        os.remove(fout)
    return maxdist
Exemplo n.º 3
0
        "ANOT_FONT_SIZE": 14,
        "LABEL_FONT_SIZE": 14,
        "ANNOT_OFFSET_SECONDARY": "0.1c",
        "ANNOT_OFFSET_PRIMARY": "0.1c",
        "LABEL_OFFSET": "0.1c",
        "FRAME_PEN": ".5p",
        "PLOT_DEGREE_FORMAT": "-D",
    }
)
rng = "-145/-50/41/85"
scl = "L-97.5/63/41/85/15c"
markers = "markers.xyp"
gmt.psbasemap(R=rng, J=scl, B="a15f5WSne", Y="2c", X="2c")
gmt.pscoast("-N1", R=True, J=True, D="i", W="0.5p,black", N="2")
cnt = 0
for _slon, _slat, _elon, _elat in zip(slon, slat, elon, elat):
    gmt.project(C="%f/%f" % (_slon, _slat), E="%f/%f" % (_elon, _elat), G=100, Q=True, out_filename=markers)
    gmt.psxy(R=True, J=True, W="2p,red,", in_rows=[[_slon, _slat], [_elon, _elat]])
    # gmt.psxy(markers,R=True,J=True,S='y0.1c',W='1p,blue')
    gmt.psxy(markers, R=True, J=True, S="s0.1c", W="1p,blue")
    lbl1, lbl2 = anot[cnt]
    txtstr1 = """%f %f 10 0 1 RB %s""" % (_slon, _slat, lbl1)
    txtstr2 = """%f %f 10 0 1 LB %s""" % (_elon, _elat, lbl2)
    gmt.pstext(R=True, J=True, W="white", G="blue", N=True, in_string=txtstr1)
    gmt.pstext(R=True, J=True, W="white", G="blue", N=True, in_string=txtstr2)
    cnt += 1
for lon, lat in invres:
    gmt.psxy(R=True, J=True, S="t0.5c", G="red", in_rows=[[lon, lat]])

gmt.save(foutmap)