- Timestamp:
- Nov 4, 2019, 2:33:42 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing_tools.py
r2743 r2744 4401 4401 m = DefineMap(map_proj, map_res, [lat2, lon2]) 4402 4402 elif map_proj == 'spstere': 4403 if len(mapv.split(',')) > 2: 4403 Nvals = len(mapv.split(',')) 4404 if Nvals > 2: 4405 expected = ['xlat', 'ref_lon'] 4406 Nexpected = len(expected) 4407 if Nvals - 2 != Nexpected: 4408 print errormsg 4409 print ' ' + fname + ": additional values provided for '" + \ 4410 map_proj + "' but ", Nexpected, "where expected and", Nvals, \ 4411 "provided" 4412 print ' one epxect to additinoaly have:', ','.join(expected) 4413 quit(-1) 4404 4414 xlat = np.float(mapv.split(',')[2]) 4405 4415 ref_lon = np.float(mapv.split(',')[3]) 4406 4416 m = DefineMap(map_proj, map_res, [xlat, ref_lon]) 4407 4417 else: 4408 m = DefineMap(map_proj, map_res, [xlat, -65.])4418 m = DefineMap(map_proj, map_res, [xlat, lon2]) 4409 4419 else: 4410 4420 print errormsg … … 4430 4440 Nboxes = len(boxesX)/4 4431 4441 for ibox in range(Nboxes): 4432 print ibox, boxesX[ibox], boxesY[ibox]4433 plt.plot( boxesX[ibox*4], boxesY[ibox*4], linestyle='-', linewidth=3,\4442 xi, yi = m(boxesX[ibox*4], boxesY[ibox*4]) 4443 plt.plot(xi, yi, linestyle='-', linewidth=3, \ 4434 4444 label=gen.latex_text(boxlabels[ibox].replace('!',' ')), color=cols[ibox]) 4435 plt.plot(boxesX[ibox*4+1], boxesY[ibox*4+1], linestyle='-', linewidth=3, \ 4436 color=cols[ibox]) 4437 plt.plot(boxesX[ibox*4+2], boxesY[ibox*4+2], linestyle='-', linewidth=3, \ 4438 color=cols[ibox]) 4439 plt.plot(boxesX[ibox*4+3], boxesY[ibox*4+3], linestyle='-', linewidth=3, \ 4440 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, '-']) 4445 xi, yi = m(boxesX[ibox*4+1], boxesY[ibox*4+1]) 4446 plt.plot(xi, yi, linestyle='-', linewidth=3, color=cols[ibox]) 4447 xi, yi = m(boxesX[ibox*4+2], boxesY[ibox*4+2]) 4448 plt.plot(xi, yi, linestyle='-', linewidth=3, color=cols[ibox]) 4449 xi, yi = m(boxesX[ibox*4+3], boxesY[ibox*4+3]) 4450 plt.plot(xi, yi, linestyle='-', linewidth=3, color=cols[ibox]) 4446 4451 4447 4452 m.drawcoastlines() … … 14267 14272 14268 14273 if map_proj == 'cyl': 14269 mapenv = Basemap(projection=map_proj, llcrnrlon=nlon, llcrnrlat=nlat, \ 14270 urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res) 14274 mapenv = DefineMap(map_proj, map_res, [nlon,nlat,xlon,xlat]) 14271 14275 elif map_proj == 'lcc': 14272 mapenv = Basemap(projection=map_proj, lat_0=lat2, lon_0=lon2, llcrnrlon=nlon, \ 14273 llcrnrlat=nlat, urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res) 14274 else: 14275 print gen.errormsg 14276 print ' ' + fname + ": map projection '" + map_proj + "' not defined!!!" 14277 print ' available: cyl, lcc' 14278 quit(-1) 14276 mapenv = DefineMap(map_proj, map_res, [lat2, lon2, nlon, nlat, xlon, xlat]) 14277 elif map_proj == 'npstere': 14278 mapenv = DefineMap(map_proj, map_res, [lat2, lon2]) 14279 elif map_proj == 'spstere': 14280 Nvals = len(mapvals.split(',')) 14281 if Nvals > 2: 14282 expected = ['xlat', 'ref_lon'] 14283 Nexpected = len(expected) 14284 if Nvals - 2 != Nexpected: 14285 print errormsg 14286 print ' ' + fname + ": additional values provided for '" + \ 14287 map_proj + "' but ", Nexpected, "where expected and", Nvals, \ 14288 "provided" 14289 print ' one epxect to additinoaly have:', ','.join(expected) 14290 quit(-1) 14291 xlat = np.float(mapvals.split(',')[2]) 14292 ref_lon = np.float(mapvals.split(',')[3]) 14293 mapenv = DefineMap(map_proj, map_res, [xlat, ref_lon]) 14294 else: 14295 mapenv = DefineMap(map_proj, map_res, [xlat, lon2]) 14296 else: 14297 print errormsg 14298 print ' ' + fname + ": projection '" + map_proj + "' not ready !!" 14299 quit(-1) 14279 14300 14280 14301 merids = gen.pretty_int(nlon, xlon, Nlon) … … 14408 14429 polylabv: [polylab, color, size, face, angle, pos]: values for the label of 14409 14430 the polygon. if color='auto', then: 14410 [polylab, 'k', 10, 'normal', angle=0, pos='c']14431 [polylab, 'k', 10, 'normal', 0, 'c'] 14411 14432 polylab: label of the polygon (already LaTeX freindly, None for no label) 14412 14433 color: color of the characters … … 14474 14495 if polylabv is not None: 14475 14496 if polylabv[1] == 'auto': 14476 polylabv = [polylabv[0], 'k', 10, 'normal', angle=0, pos='c']14497 polylabv = [polylabv[0], 'k', 10, 'normal', 0, 'c'] 14477 14498 polylabpos = polylabv[5].split(',') 14478 14499 if polylabpos[0] == 'c': … … 14574 14595 closeif= Boolean value if the figure has to be closed 14575 14596 """ 14576 fname = 'plot_topofix_geogrid '14597 fname = 'plot_topofix_geogrid_boxes' 14577 14598 14578 14599 topobnds=[-140., 0., 100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.,\ … … 14586 14607 if type(varv) == type('S') and varv == 'h': 14587 14608 print fname + '_____________________________________________________________' 14588 print plot_topofix_geogrid .__doc__14609 print plot_topofix_geogrid_boxes.__doc__ 14589 14610 quit() 14590 14611
Note: See TracChangeset
for help on using the changeset viewer.