Changeset 3006
- Timestamp:
- May 29, 2006, 1:07:46 PM (19 years ago)
- Location:
- development/stochastic_study
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
development/stochastic_study/plot_spread.py
r2986 r3006 7 7 # Related major packages 8 8 from Numeric import zeros, Float, allclose, arange 9 from caching import cache10 9 11 10 # Application specific imports 12 11 from utilities.numerical_tools import histogram, create_bins 12 from read_realisations import read_realisations 13 13 import project 14 14 15 15 # Initialise 16 gauge = '%s.txt' %project.gauge_names[0]17 number_of_realisations = project.number_of_realisations18 19 time = zeros(project.number_of_timesteps, Float)20 data = zeros((project.number_of_timesteps, number_of_realisations), Float)21 22 23 16 # Read in all realisations-timeseries 24 25 j = 0 # Count realisations 26 for filename in os.listdir(project.working_dir): 27 if filename.startswith(project.basename) and filename.endswith(gauge): 28 if j < data.shape[1]: 29 print 'Reading filename %s (column %d)' %(filename, j) 30 fid = open(filename) 31 for i, line in enumerate(fid.readlines()): 32 if i < data.shape[0]: 33 fields = line.strip().split() 34 time[i] = float(fields[0]) 35 data[i,j] = float(fields[1]) 36 else: 37 print 'Ignored %s (column %d)' %(filename, j) 38 39 fid.close() 40 j += 1 17 time, data, filenames = read_realisations('cyclone1', 18 max_realisations = 200, 19 use_cache=True) 20 #time, data, filenames = read_realisations('test', exclude='_0_', 21 # max_realisations = 200, 22 # use_cache=True) 23 #time, data, filenames = read_realisations('nautilus1', exclude='_0_') 24 number_of_realisations = data.shape[1] 41 25 42 26 … … 45 29 46 30 ion() 47 #hold(True)48 hold(False)31 hold(True) 32 #hold(False) 49 33 50 34 # Simple plot of timeseries for different realisations 51 for j in range( number_of_realisations):52 print j, data[:,j]35 for j in range(20): 36 print j, filenames[j] 53 37 plot(time, data[:,j], 'k-') 54 38 55 39 xlabel('time(s)') 56 40 ylabel('stage (m)') 57 title('Realisation %d of %d' %(j, number_of_realisations-1)) # 58 #raw_input('Next') 41 title('Timeseries for realisation %d of %d' %(j, number_of_realisations-1)) 42 raw_input('Next') 43 59 44 60 45 61 46 hold(False) 62 47 # Plot spread of stage values for each timestep 63 for i in range( 200,project.number_of_timesteps):64 # Plot histogram 48 for i in range(300,320): #project.number_of_timesteps): 49 # Plot histogram# 65 50 66 51 w = data[i,:] … … 68 53 xlabel('realisations') 69 54 ylabel('stage (m)') 70 title(' Timestep %d of %d (t=%.2f)'\55 title('Spread at timestep %d of %d (t=%.2f)'\ 71 56 %(i, project.number_of_timesteps-1, time[i])) 72 57 raw_input('Next') … … 75 60 hold(False) 76 61 # Plot histogram of stage values for each timestep 77 for i in range( 200,project.number_of_timesteps):62 for i in range(300,320):#project.number_of_timesteps): 78 63 # Plot histogram 79 64 … … 89 74 xlabel('stage (m)') 90 75 ylabel('frequency') 91 title(' Timestep %d of %d (t=%.2f)'\76 title('Histogram at timestep %d of %d (t=%.2f)'\ 92 77 %(i, project.number_of_timesteps-1, time[i])) 93 #raw_input('Next')78 raw_input('Next') 94 79 95 80 -
development/stochastic_study/project.py
r2989 r3006 34 34 blocksize = 10 #How many realisations to fit at a time 35 35 36 number_of_bins = 10 36 number_of_bins = 100
Note: See TracChangeset
for help on using the changeset viewer.