Changeset 5071
- Timestamp:
- Feb 22, 2008, 5:01:53 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r5069 r5071 1858 1858 1859 1859 i_max = len(directories_dic.keys()) 1860 legend_list_dic =[]1860 legend_list_dic={} 1861 1861 legend_list =[] 1862 1862 for i, directory in enumerate(directories_dic.keys()): … … 1879 1879 attribute_dic, title_index_dic = csv2dict(directory+filename+'.csv') 1880 1880 #get data from dict in to list 1881 # t = [float(x) for x in attribute_dic["time"]]1882 1883 1881 #do maths to list by changing to array 1884 # t=(array(t)+directory_start_time)/seconds_in_minutes1885 1882 t=(array(directory_quantity_value[directory][filename]['time'])+directory_start_time)/seconds_in_minutes 1886 1883 … … 1896 1893 print "Note! Elevation changes in %s" %dir_filename 1897 1894 1898 #populates the legend_list_dic with dir_name and the elevation 1899 if i==0: 1900 legend_list_dic.append({directory_name:round(max_ele,3)}) 1901 else: 1902 #print j,max_ele, directory_name, legend_list_dic 1903 legend_list_dic[j][directory_name]=round(max_ele,3) 1904 1905 # creates a list for the legend after at "legend_dic" has been fully populated 1895 # creates a dictionary with keys that is the filename and attributes are a list of 1896 # lists containing 'directory_name' and 'elevation'. This is used to make the contents 1897 # for the legends in the graphs, this is the name of the model and the elevation. 1898 # All in this great one liner from DG. If the key 'filename' doesn't exist it creates the 1899 # entry if the entry exist it appends to the key. 1900 1901 legend_list_dic.setdefault(filename,[]).append([directory_name,round(max_ele,3)]) 1902 1903 # creates a LIST for the legend on the last iteration of the directories 1904 # which is when "legend_list_dic" has been fully populated. Creates a list of strings 1905 # which is used in the legend 1906 1906 # only runs on the last iteration for all the gauges(csv) files 1907 1907 # empties the list before creating it 1908 1908 if i==i_max-1: 1909 1909 legend_list=[] 1910 for k, l in legend_list_dic[j].iteritems(): 1911 legend_list.append('%s (elevation = %sm)'%(k,l)) 1912 #print k,l, legend_list_dic[j] 1910 1911 print 'DIC',legend_list_dic 1912 for name_and_elevation in legend_list_dic[filename]: 1913 legend_list.append('%s (elevation = %sm)'%(name_and_elevation[0],name_and_elevation[1])) 1913 1914 1914 1915 #print 'filename',filename, quantities 1915 # remove timeso it is not plotted!1916 #skip time and elevation so it is not plotted! 1916 1917 for k, quantity in enumerate(quantities): 1917 1918 if quantity != 'time' and quantity != 'elevation': 1918 #quantity_value[quantity] = [float(x) for x in attribute_dic[quantity]]1919 1920 #add tide to stage if provided1921 # if quantity == 'stage':1922 # quantity_value[quantity]=array(quantity_value[quantity])+directory_add_tide1923 1919 1924 1920 num=int(k*100+j) 1925 1921 pylab.figure(num) 1926 # print directory,len(t),'LENgth',len(directory_quantity_value[directory]),directory_quantity_value[directory][filename][quantity][1:10]1927 1922 pylab.ylabel(quantities_label[quantity]) 1928 1923 pylab.plot(t, directory_quantity_value[directory][filename][quantity], c = cstr[i], linewidth=1) … … 1930 1925 pylab.axis(quantities_axis[quantity]) 1931 1926 pylab.legend(legend_list,loc='upper right') 1927 1932 1928 pylab.title('%s at %s gauge' %(quantity,filename[len(base_name):])) 1933 1929 if output_dir == '':
Note: See TracChangeset
for help on using the changeset viewer.