Thursday, July 27, 2017

Alternating Block Hyetograph Method with Python

To generate hypothetic storm events, we can use some methods as Alternating block method, Chicago method, Balanced method, SCS Storms among others.

In this post I show a way to generate a hypothetic storm event using the Alternating block method.

This python code uses the numpy library. The altblocks functions uses as input the idf parameters as list, and total duration, delta time and return period as floats.


import numpy as np

def altblocks(idf,dur,dt,RP):
    aDur = np.arange(dt,dur+dt,dt)    # in minutes
    aInt = (idf[0]*RP**idf[1])/((aDur+idf[2])**idf[3])  # idf equation - in mm/h
    aDeltaPmm = np.diff(np.append(0,np.multiply(aInt,aDur/60.0)))
    aOrd=np.append(np.arange(1,len(aDur)+1,2)[::-1],np.arange(2,len(aDur)+1,2))
    prec = np.asarray([aDeltaPmm[x-1] for x in aOrd])
    aAltBl = np.vstack((aDur,prec))
    return aAltBl

5 comments:

  1. Świetnie napisany artykuł. Jak dla mnie bomba.

    ReplyDelete
  2. a and b are not defined at:
    aAltBl = np.vstack((a,b))

    ReplyDelete
    Replies
    1. Sorry! I just updated the post with the correct values. Thanks!

      Delete
  3. aAltBl = np.vstack((a,b))
    a and b is undefined

    ReplyDelete
    Replies
    1. Sorry! I just updated the post with the correct values. Thanks!

      Delete