Changeset 2757 in lmdz_wrf for trunk/tools
- Timestamp:
- Nov 13, 2019, 4:21:26 PM (5 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r2751 r2757 2570 2570 2571 2571 timename = timevals.split('|')[0] 2572 timekind = timevals.split('|')[ 1]2573 timefmt = timevals.split('|')[ 2]2572 timekind = timevals.split('|')[2] 2573 timefmt = timevals.split('|')[3] 2574 2574 2575 2575 if rangevals == 'None': … … 2765 2765 2766 2766 if ifn == 0: 2767 varunits = drw.units_lunits(vvobj0.units)2767 varunits = gen.units_lunits(vvobj0.units) 2768 2768 else: 2769 if varunits != drw.units_lunits(vvobj0.units):2769 if varunits != gen.units_lunits(vvobj0.units): 2770 2770 print errormsg 2771 2771 print ' ' + fname + ': wrong units:', vvobj0.units, " of " + \ … … 2795 2795 print ' ' + fname + ': plotting from: ' + dtiS + ' to ' + dteS 2796 2796 2797 timepos, timelabels = drw.CFtimes_plot(tvals, timeunit, timekind, timefmt) 2797 tU = timeunit.replace('!', ' ') 2798 print timeunit, timekind, timefmt 2799 timepos, timelabels = drw.CFtimes_plot(tvals, tU, timekind, timefmt) 2798 2800 2799 2801 # print 'Lluis min/max tval +/- dtval/2:', mintval-dtvals/2., maxtval+dtvals/2.,'dt:', len(tvals) -
trunk/tools/drawing_tools.py
r2755 r2757 1928 1928 fontsize = int(fontsize0) 1929 1929 if len(legstring.split(char)) == 2: 1930 return locleg, fontsize 1930 return locleg, fontsize, 1 1931 1931 else: 1932 1932 ncol = int(legstring.split(char)[2]) -
trunk/tools/generic_tools.py
r2734 r2757 77 77 # auto_val: Function to provide a value following an 'auto' configuration 78 78 # auto_val_list: Function to provide a list of values following an 'auto' configuration or a single value 79 # begend_spaces: Function to remove any spaces at the beginning and end of an String 79 80 # Capturing: Class to capture the standard output from a function 80 81 # CF_gribequiv: Function to provide the GRIB variable code number from a CF name … … 594 595 595 596 return sign 597 598 def begend_spaces(Str): 599 """ Function to remove any spaces at the beginning and end of an Sting 600 Str: string to remove spaces 601 >>> begend_spaces(' Antartic ') 602 'Antartic' 603 """ 604 fname = 'begend_spaces' 605 606 newstring='' 607 Nchars = len(Str) 608 Hspace = True 609 for ic in range(Nchars): 610 if Hspace: 611 if Str[ic:ic+1] == ' ': 612 newstring = '' 613 else: 614 newstring = newstring + Str[ic:ic+1] 615 Hspace = False 616 else: 617 newstring = newstring + Str[ic:ic+1] 618 619 Tspace = True 620 newstring2 = '' 621 for ic in range(Nchars-2,-1,-1): 622 if Tspace: 623 if newstring[ic:ic+1] == ' ': 624 newstring2 = '' 625 else: 626 newstring2 = newstring[ic:ic+1] + newstring2 627 Tspace = False 628 else: 629 newstring2 = newstring[ic:ic+1] + newstring2 630 631 return newstring2 596 632 597 633 ## … … 17317 17353 'U', 'U'] 17318 17354 17355 print " Lluis '" + stval + "' " 17356 17319 17357 if stcrit == 'h': 17320 17358 print fname + '_____________________________________________________________' … … 17344 17382 Nst = 0 17345 17383 stations = {} 17384 availvals = [] 17346 17385 for line in ncf: 17347 17386 if line[0:1] != '#' and len(line) > 10: … … 17354 17393 17355 17394 stvalues = list_listKs(values, stKs) 17356 if stvalues[icrit] == stv: 17395 if not searchInlist(availvals, stvalues[icrit]): 17396 availvals.append(stvalues[icrit]) 17397 print "'" + stvalues[icrit] + "'", "'"+ stv+ "'", type(stvalues[icrit]), type(stv), stvalues[icrit] == stv 17398 if stvalues[icrit] == stv: 17357 17399 stations[Nst] = stvalues 17358 17400 Nst = Nst + 1 … … 17360 17402 if Nst == 0: 17361 17403 print errormsg 17362 print ' ' + fname + ": station with criteria '" + stcrit + "'= '", stval, \ 17363 "' not found !!!" 17404 if type (stval) == type('H'): 17405 print ' ' + fname + ": station with criteria '" + stcrit + "'= '" + \ 17406 stval + "' not found !!!" 17407 else: 17408 print ' ' + fname + ": station with criteria '" + stcrit + "'= '", \ 17409 stval, "' not found !!!" 17410 print ' available ones', availvals 17364 17411 ncf.close() 17365 17412 if Notfound: … … 17385 17432 return stations 17386 17433 17434 print stations_values('prov', 'Antartic') 17435 quit() 17436 17387 17437 def list_rmchar(listv, rmchr): 17388 17438 """ Function to remove a list of characters from its values
Note: See TracChangeset
for help on using the changeset viewer.