Changeset 5069
- Timestamp:
- Feb 21, 2008, 4:30:01 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r5016 r5069 1729 1729 min_start_time = 100000 1730 1730 1731 1731 1732 if verbose: print 'Determining uniform axes \n' 1732 1733 #this entire loop is to determine the min and max range for the … … 1736 1737 quantities.insert(0,'time') 1737 1738 1738 quantity_value={} 1739 directory_quantity_value={} 1740 # quantity_value={} 1739 1741 min_quantity_value={} 1740 1742 max_quantity_value={} … … 1742 1744 1743 1745 for i, directory in enumerate(directories_dic.keys()): 1744 1746 filename_quantity_value={} 1745 1747 if assess_all_csv_files==False: 1746 1748 which_csv_to_assess = list_filenames[i] … … 1748 1750 #gets list of filenames for directory "i" 1749 1751 which_csv_to_assess = all_csv_filenames[i] 1752 # print'IN DIR', list_filenames[i] 1753 1754 1750 1755 1751 1756 1752 1757 for j, filename in enumerate(which_csv_to_assess): 1758 quantity_value={} 1753 1759 1754 1760 dir_filename=join(directory,filename) … … 1790 1796 # than the max and mins so the plots look good. 1791 1797 1792 increase_axis = 0.05 1798 increase_axis = (max-min)*0.05 1799 # print quantity, "MIN MAX", max, min 1793 1800 if min<=min_quantity_value[quantity]: 1794 1801 if quantity == 'time': 1795 1802 min_quantity_value[quantity]=min 1796 1803 else: 1797 if round(min,1) == 0.0: 1798 min_quantity_value[quantity]=-2. 1804 if round(min,2) == 0.00: 1805 min_quantity_value[quantity]=-increase_axis 1806 # min_quantity_value[quantity]=-2. 1799 1807 #min_quantity_value[quantity]= -max_quantity_value[quantity]*increase_axis 1800 1808 else: 1801 min_quantity_value[quantity]=min*(1+increase_axis) 1809 # min_quantity_value[quantity]=min*(1+increase_axis) 1810 min_quantity_value[quantity]=min-increase_axis 1811 # print quantity, min_quantity_value[quantity] 1802 1812 1803 1813 if max>max_quantity_value[quantity]: … … 1805 1815 max_quantity_value[quantity]=max 1806 1816 else: 1807 max_quantity_value[quantity]=max*(1+increase_axis) 1817 max_quantity_value[quantity]=max+increase_axis 1818 # max_quantity_value[quantity]=max*(1+increase_axis) 1819 # print quantity, max_quantity_value[quantity],increase_axis 1808 1820 1809 1821 # print 'min,maj',quantity, min_quantity_value[quantity],max_quantity_value[quantity] … … 1818 1830 max_start_time = directory_start_time 1819 1831 #print 'start_time' , max_start_time, min_start_time 1820 1821 1832 1833 filename_quantity_value[filename]=quantity_value 1834 1835 directory_quantity_value[directory]=filename_quantity_value 1836 1822 1837 #final step to unifrom axis for the graphs 1823 1838 quantities_axis={} … … 1848 1863 if verbose: print'Plotting in %s %s' %(directory, new_plot_numbers) 1849 1864 # print 'LIST',list_filenames 1865 #FIXME THIS SORT IS VERY IMPORTANT, without it the assigned plot numbers may not work correctly 1866 #there must be a better way 1867 list_filenames[i].sort() 1850 1868 for j, filename in enumerate(list_filenames[i]): 1869 # print'IN plot', list_filenames[i] 1851 1870 1852 1871 if verbose: print'Starting %s' %filename … … 1860 1879 attribute_dic, title_index_dic = csv2dict(directory+filename+'.csv') 1861 1880 #get data from dict in to list 1862 t = [float(x) for x in attribute_dic["time"]]1881 # t = [float(x) for x in attribute_dic["time"]] 1863 1882 1864 1883 #do maths to list by changing to array 1865 t=(array(t)+directory_start_time)/seconds_in_minutes 1884 # t=(array(t)+directory_start_time)/seconds_in_minutes 1885 t=(array(directory_quantity_value[directory][filename]['time'])+directory_start_time)/seconds_in_minutes 1866 1886 1867 1887 #finds the maximum elevation, used only as a test … … 1878 1898 #populates the legend_list_dic with dir_name and the elevation 1879 1899 if i==0: 1880 legend_list_dic.append({directory_name:round(max_ele, 2)})1900 legend_list_dic.append({directory_name:round(max_ele,3)}) 1881 1901 else: 1882 1902 #print j,max_ele, directory_name, legend_list_dic 1883 legend_list_dic[j][directory_name]=round(max_ele, 2)1903 legend_list_dic[j][directory_name]=round(max_ele,3) 1884 1904 1885 1905 # creates a list for the legend after at "legend_dic" has been fully populated … … 1896 1916 for k, quantity in enumerate(quantities): 1897 1917 if quantity != 'time' and quantity != 'elevation': 1898 quantity_value[quantity] = [float(x) for x in attribute_dic[quantity]] 1899 1918 #quantity_value[quantity] = [float(x) for x in attribute_dic[quantity]] 1919 1920 #add tide to stage if provided 1921 # if quantity == 'stage': 1922 # quantity_value[quantity]=array(quantity_value[quantity])+directory_add_tide 1923 1900 1924 num=int(k*100+j) 1901 1925 pylab.figure(num) 1902 1926 # print directory,len(t),'LENgth',len(directory_quantity_value[directory]),directory_quantity_value[directory][filename][quantity][1:10] 1903 1927 pylab.ylabel(quantities_label[quantity]) 1904 pylab.plot(t, quantity_value[quantity], c = cstr[i], linewidth=1)1928 pylab.plot(t, directory_quantity_value[directory][filename][quantity], c = cstr[i], linewidth=1) 1905 1929 pylab.xlabel(quantities_label['time']) 1906 1930 pylab.axis(quantities_axis[quantity])
Note: See TracChangeset
for help on using the changeset viewer.