Changeset 655 in lmdz_wrf
- Timestamp:
- Oct 15, 2015, 11:01:51 AM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r651 r655 13 13 ## e.g. # drawing.py -o draw_2D_shad_line -f 'mean_dtcon-pluc-pres_lat.nc,mean_dtcon-pluc-pres_lat.nc' -S 'dtcon,prc:bottom_top|-1,south_north|-1:latmean:presmean:seismic,k:-5.,5.:monthly|dtcon|&|prc:pdf:flip@y:None:True' -v 'dtconmean,prcmean' 14 14 ## e.g. # drawing.py -f 'geo_em.d02.nc' -o draw_topo_geogrid -S '0.,3000.:None:FF_3dom d02:png:cyl,i' 15 ## e.g. # drawing.py -o draw_topo_geogrid_boxes -S '0.,3000.:None:FF domains:pdf:lcc,i:d01,d02,d03 ' -f geo_em.d01.nc,geo_em.d02.nc,geo_em.d03.nc15 ## e.g. # drawing.py -o draw_topo_geogrid_boxes -S '0.,3000.:None:FF domains:pdf:lcc,i:d01,d02,d03:0' -f geo_em.d01.nc,geo_em.d02.nc,geo_em.d03.nc 16 16 ## e.g. # drawing.py -o draw_trajectories -f 'WRF/control/trajectory.dat@-1@/home/lluis/etudes/domains/WL_HyMeX_HighRes_C/geo_em.d03.nc#XLONG_M#XLAT_M,WRF_LMDZ/wlmdza/trajectory.dat@-1@/home/lluis/etudes/domains/WL_HyMeX_C/geo_em.d01.nc#XLONG_M#XLAT_M,WRF_LMDZ/wlmdzb/trajectory.dat@-1@/home/lluis/etudes/domains/WL_HyMeX_C/geo_em.d01.nc#XLONG_M#XLAT_M,WRF_LMDZ/wlmdzb_ii/trajectory.dat@-1@/home/lluis/etudes/domains/WL_HyMeX_C/geo_em.d01.nc#XLONG_M#XLAT_M' -S '$WRF_{CRM}$,$LMDZ_{AR4.0}$,$LMDZ_{NPv3.1}$,$LMDZ_{NPv3.1b}$|None|medicane trajectories|pdf|cyl,i' -v obs/trajectory.dat,satellite,-1 17 17 ## e.g. # drawing.py -o draw_vals_trajectories -f WRF_LMDZ/wlmdza/tevolboxtraj_T2.nc,WRF_LMDZ/wlmdzb/tevolboxtraj_T2.nc,WRF/control/tevolboxtraj_T2.nc -S 'mean:-1:$WRF_{CRM}$,$LMDZ_{AR4.0}$,$LMDZ_{NPv3.1}$@4:tas:time|($[DD]^[HH]$):exct,6,h:$%d^{%H}$:trajectory|following|mean:pdf' -v T2 … … 1412 1412 draw_topo_geogrid_boxes(ncfile, values) 1413 1413 ncfiles= ',' list of geo_em.d[nn].nc files to use (fisrt as topographyc reference) 1414 values= [minTopo],[maxTopo]:[lonlatL]:[title]:[graphic_kind]:[mapvalues]:[labels] 1414 values= [minTopo],[maxTopo]:[lonlatL]:[title]:[graphic_kind]:[mapvalues]:[labels]:[legloc] 1415 1415 [min/max]Topo: minimum and maximum values of topography to draw 1416 1416 lonlatL: limits of longitudes and latitudes [lonmin, latmin, lonmax, latmax] or None … … 1428 1428 * 'h', high 1429 1429 * 'f', full 1430 legloc= location of the legend (0, autmoatic) 1431 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 1432 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', 1433 9: 'upper center', 10: 'center' 1430 1434 labels= labels to write in the graph 1431 1435 """ … … 1460 1464 mapvalues = values.split(':')[4] 1461 1465 labels = values.split(':')[5] 1466 legloc = int(values.split(':')[6]) 1462 1467 1463 1468 ncfile = ncfiles.split(',')[0] … … 1509 1514 1510 1515 drw.plot_topo_geogrid_boxes(topography, Xboxlines, Yboxlines, boxlabels, \ 1511 objlon0, objlat0, mintopo, maxtopo, lonlatL, grtit, kindfig, mapvalues, True) 1516 objlon0, objlat0, mintopo, maxtopo, lonlatL, grtit, kindfig, mapvalues, legloc,\ 1517 True) 1512 1518 1513 1519 objdomf.close() … … 1695 1701 [vartit]: name of the variable in the graph 1696 1702 [title]: title of the plot ('|' for spaces) 1697 [locleg]: location of the legend ( -1, autmoatic)1703 [locleg]: location of the legend (0, autmoatic) 1698 1704 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 1699 1705 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', … … 1824 1830 'l': milisecond 1825 1831 [tfmt]; desired format 1826 [locleg]: location of the legend ( -1, autmoatic)1832 [locleg]: location of the legend (0, autmoatic) 1827 1833 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 1828 1834 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', … … 1893 1899 if points0.find(',') != -1: 1894 1900 points = points0.split(',') 1901 for ip in range(len(points)): 1902 points[ip] = points[ip] + '-' 1895 1903 elif points0 == 'None': 1896 1904 points = None … … 1898 1906 points = [] 1899 1907 for ip in range(Nfiles): 1900 points.append(points0 )1908 points.append(points0+'-') 1901 1909 1902 1910 # Getting values … … 2029 2037 timepos, timelabels = drw.CFtimes_plot(tvals, timeunit, timekind, timefmt) 2030 2038 2031 if leglabels.find(',') != -1: 2032 drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, \ 2033 leglabels.split(','), vartit, varunits, timepos, timelabels, title, locleg, \ 2034 graphk, collines, points) 2035 else: 2036 drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, \ 2037 None, vartit, varunits, timepos, timelabels, title, locleg, graphk, collines) 2039 if leglabels != 'None': 2040 legvals = leglabels.split(',') 2041 else: 2042 legvals = None 2043 2044 drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, legvals, vartit, \ 2045 varunits, timepos, timelabels, title, locleg, graphk, collines, points) 2046 2038 2047 return 2039 2048 … … 2442 2451 [timefmt]: format of the time labels 2443 2452 [title]: title of the graphic ('|' for spaces) 2444 [locleg]: location of the legend ( -1, autmoatic)2453 [locleg]: location of the legend (0, automatic) 2445 2454 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 2446 2455 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', … … 2706 2715 [Tint]: [Tbeg]@[Tend] or None, interval of time to plot or -1 for all the times 2707 2716 [labels]: ',' separated list of labels for the legend 2708 [locleg]: location of the legend ( -1, autmoatic)2717 [locleg]: location of the legend (0, automatic) 2709 2718 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 2710 2719 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', -
trunk/tools/drawing_tools.py
r652 r655 95 95 dateD = np.zeros((3), dtype=int) 96 96 timeT = np.zeros((3), dtype=int) 97 98 print 'Lluis:',StringDT 99 # quit() 97 100 98 101 dateD[0] = int(StringDT[0:4]) … … 1901 1904 Srefdate = txtunits[Ntxtunits - 2] 1902 1905 1906 print 'Lluis Srefdate:',Srefdate, 'txtunits:',txtunits,'units:',units 1903 1907 if not trefT == -1: 1904 1908 # print ' ' + fname + ': refdate with time!' … … 2452 2456 2453 2457 def plot_TimeSeries(valtimes, vunits, tunits, hfileout, vtit, ttit, tkind, tformat, \ 2454 tit, linesn, lloc, kfig ):2458 tit, linesn, lloc, kfig,coll,ptl): 2455 2459 """ Function to draw time-series 2456 2460 valtimes= list of arrays to plot [vals1[1values, 1times], [...,valsM[Mvals,Mtimes]]) … … 2469 2473 tit= title of the graph 2470 2474 linesn= list of values fot the legend 2471 lloc= location of the legend ( -1, autmoatic)2475 lloc= location of the legend (0, autmoatic) 2472 2476 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 2473 2477 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', 2474 2478 9: 'upper center', 10: 'center' 2475 2479 kfig= type of figure: jpg, png, pds, ps 2480 coll= ',' list of colors for the lines, None for automatic, single 2481 value all the same 2482 ptl= ',' list of type of points for the lines, None for automatic, single 2483 value all the same 2476 2484 """ 2477 2485 fname = 'plot_TimeSeries' … … 2482 2490 quit() 2483 2491 2484 2492 Nlines = len(linesn) 2485 2493 # Canging line kinds every 7 lines (end of standard colors) 2486 linekinds=['.-','x-','o-'] 2487 2488 Nlines = len(valtimes) 2494 linekinds = [] 2495 if ptl is None: 2496 linekindsauto=['.-','x-','o-'] 2497 for ptype in range(4): 2498 for ip in range(7): 2499 linekinds.append(linekindsauto[ptype]) 2500 else: 2501 if len(ptl) > 1: 2502 linekinds = ptl 2503 else: 2504 for il in range(Nlines): 2505 linekinds.append(ptl+'-') 2489 2506 2490 2507 Nvalues = [] … … 2522 2539 if vmin < ymin: ymin = vmin 2523 2540 if vmax > ymax: ymax = vmax 2541 print il,'Lluis: ymin;',ymin,'ymax;',ymax 2524 2542 2525 2543 dx = np.max(Ntimes) … … 2543 2561 if vtit == 'ps': 2544 2562 array[0,:] = np.where(array[0,:] < 98000., None, array[0,:]) 2545 plt.plot(array[1,:],array[0,:], linekinds[N7lines], label= linesn[il]) 2546 if il == 6: N7lines = N7lines + 1 2563 2564 if coll is None: 2565 plt.plot(array[1,:],array[0,:], linekinds[il], label= linesn[il]) 2566 else: 2567 plt.plot(array[1,:],array[0,:], linekinds[il], label= linesn[il], \ 2568 color=coll[il]) 2547 2569 2548 2570 timevals = np.arange(xmin,xmax)*1. 2549 2571 2572 print 'Lluis tunits:',tunits 2550 2573 tpos, tlabels = CFtimes_plot(timevals, tunits, tkind, tformat) 2551 2574 … … 3309 3332 3310 3333 def plot_topo_geogrid_boxes(varv, boxesX, boxesY, boxlabels, olon, olat, mint, maxt, \ 3311 lonlatLims, gtit, kfig, mapv, closeif):3334 lonlatLims, gtit, kfig, mapv, gloc, closeif): 3312 3335 """ plotting geo_em.d[nn].nc topography from WPS files 3313 3336 plot_topo_geogrid(domf, mint, maxt, gtit, kfig, mapv) … … 3331 3354 * 'h', high 3332 3355 * 'f', full 3356 gloc= location of the legend (0, autmoatic) 3357 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 3358 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', 3359 9: 'upper center', 10: 'center' 3333 3360 closeif= Boolean value if the figure has to be closed 3334 3361 """ … … 3454 3481 3455 3482 plt.title(graphtit) 3456 plt.legend(loc= 0)3483 plt.legend(loc=gloc) 3457 3484 3458 3485 output_kind(kfig, figname, closeif) … … 5195 5222 vunit= units of the vaxis 5196 5223 gtit= main title 5197 gloc= location of the legend ( -1, autmoatic)5224 gloc= location of the legend (0, autmoatic) 5198 5225 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 5199 5226 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', … … 5280 5307 tlabs= labels of the time ticks 5281 5308 gtit= main title 5282 gloc= location of the legend ( -1, autmoatic)5309 gloc= location of the legend (0, autmoatic) 5283 5310 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 5284 5311 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
Note: See TracChangeset
for help on using the changeset viewer.