Changeset 2743 in lmdz_wrf


Ignore:
Timestamp:
Nov 4, 2019, 1:52:01 PM (6 years ago)
Author:
lfita
Message:

Adding 'auto' option into labels in 'drawpolygon_map'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing_tools.py

    r2742 r2743  
    44014401            m = DefineMap(map_proj, map_res, [lat2, lon2])
    44024402        elif map_proj == 'spstere':
    4403             m = DefineMap(map_proj, map_res, [xlat, -65.])
     4403            if len(mapv.split(',')) > 2:
     4404                xlat = np.float(mapv.split(',')[2])
     4405                ref_lon = np.float(mapv.split(',')[3])
     4406                m = DefineMap(map_proj, map_res, [xlat, ref_lon])
     4407            else:
     4408                m = DefineMap(map_proj, map_res, [xlat, -65.])
     4409        else:
     4410            print errormsg
     4411            print '  ' + fname + ": projection '" + map_proj + "' not ready !!"
     4412            quit(-1)
     4413
     4414
    44044415        if len(olon[:].shape) == 1:
    44054416            lons, lats = np.meshgrid(olon[:], olat[:])
     
    44194430        Nboxes = len(boxesX)/4
    44204431        for ibox in range(Nboxes):
     4432            print ibox, boxesX[ibox], boxesY[ibox]
    44214433            plt.plot(boxesX[ibox*4], boxesY[ibox*4], linestyle='-', linewidth=3,     \
    44224434              label=gen.latex_text(boxlabels[ibox].replace('!',' ')), color=cols[ibox])
     
    44274439            plt.plot(boxesX[ibox*4+3], boxesY[ibox*4+3], linestyle='-', linewidth=3, \
    44284440              color=cols[ibox])
     4441
     4442            lonlatb = [boxesX[ibox][0], boxesY[ibox][0], boxesX[ibox*4+2][0],        \
     4443              boxesY[ibox*4+2][0]]
     4444            labv = [gen.latex_text(boxlabels[ibox].replace('!',' ')), ]
     4445            drawpolygon_map(lonlatb, m, labv, 10, ['k', 2, '-'])
    44294446
    44304447        m.drawcoastlines()
     
    1439014407      mape: basemap map environtment where to draw the polygon
    1439114408      polylabv: [polylab, color, size, face, angle, pos]: values for the label of
    14392           the polygon
     14409          the polygon. if color='auto', then:
     14410            [polylab, 'k', 10, 'normal', angle=0, pos='c']
    1439314411        polylab: label of the polygon (already LaTeX freindly, None for no label)
    1439414412        color: color of the characters
     
    1445514473    # Label location
    1445614474    if polylabv is not None:
     14475        if polylabv[1] == 'auto':
     14476           polylabv = [polylabv[0], 'k', 10, 'normal', angle=0, pos='c']
    1445714477        polylabpos = polylabv[5].split(',')
    1445814478        if polylabpos[0] == 'c':
Note: See TracChangeset for help on using the changeset viewer.