Changeset 2972 for development


Ignore:
Timestamp:
May 25, 2006, 3:42:31 PM (19 years ago)
Author:
ole
Message:

Added create_bins and refactored pyvolution/mesh.py

Location:
development/stochastic_study
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • development/stochastic_study/plot_spread.py

    r2967 r2972  
    22"""
    33
     4# Standard modules
    45import sys, os
     6
     7# Related major packages
     8from Numeric import zeros, Float, allclose, arange
    59from caching import cache
     10
     11# Application specific imports
     12from utilities.numerical_tools import histogram, create_bins
    613import project
    714
     15# Initialise
    816gauge_name = project.gauge_names[0]
    9 from Numeric import zeros, Float, allclose
    10 
    11 
    1217number_of_realisations = project.number_of_realisations
    1318
    1419time = zeros(project.number_of_timesteps, Float)
    1520data = zeros((project.number_of_timesteps, number_of_realisations), Float)
     21
     22
     23# Read in all realisations-timeseries
    1624
    1725j = 0 # Count realisations
     
    3745
    3846ion()
    39 hold(True)
     47#hold(True)
    4048hold(False)
    4149
    42 #for i in range(project.number_of_timesteps):
    43 #    print i, data[i,:]
    44 #    plot(data[i,:], 'k.')
    45 #    raw_input('Next')   
    46 
     50# Simple plot of timeseries for different realisations
    4751for j in range(number_of_realisations):
    48     print j, data[:,j]
     52    #print j, data[:,j]
    4953    plot(data[:,j], 'k-')
    5054   
    5155    raw_input('Next')
     56    xlabel('time(s)')
     57    ylabel('stage (m)')
     58    title('Realisation %d of %d' %(j, number_of_realisations))   
     59   
     60
     61
     62# Plot histogram of stage values for each timestep
     63for i in range(project.number_of_timesteps):
     64    # Plot histogram
     65
     66    w = data[i,:]
     67     
     68    bins = create_bins(w, project.number_of_bins)
     69    print 'bins', bins
     70    hist = histogram(w, bins)
     71    print 'hist', hist
     72   
     73    #plot(w, 'k.')
     74    plot(hist, 'k.')
     75    xlabel('stage (m)')
     76    ylabel('count')
     77    title('Timestep %d of %d (t=%.2f)'\
     78          %(i, project.number_of_timesteps, time[i]))       
     79    raw_input('Next')
     80
     81
    5282#title('Gauge %s' %name)
    5383#xlabel('time(s)')
     
    5585#legend(('Observed', 'Modelled'), shadow=True, loc='upper left')
    5686#savefig(name, dpi = 300)
     87
     88
     89
     90
    5791
    5892
  • development/stochastic_study/project.py

    r2966 r2972  
    1919
    2020# Stats (Suresh ?)
    21 number_of_realisations = 4
     21number_of_realisations = 1
    2222#std_dev = 0.0026  #Range is 26.035 cm
    2323std_dev = 0.0013  #Range is 26.035 cm
     
    2525blocksize = 100 #How many realisations to fit at a time
    2626
    27 
     27number_of_bins = 10
    2828
    2929
Note: See TracChangeset for help on using the changeset viewer.