Beispiel #1
0
wdm.create_dataset('test.wdm', 126, attributes)

attributes['TSTYPE'] = 'SEDM'
wdm.create_dataset('test.wdm', 127, attributes)

attributes['TSTYPE'] = 'FLOW'
wdm.create_dataset('test.wdm', 136, attributes)

# then we have to manually close the WDM file

wdm.close('test.wdm')

# Run example1.uci--this simulation just inputs data from TEST01DT.91 to the
# test.wdm file we just made

hspf.hsppy('test01.uci', messagepath)

# let's go back into the test.wdm and pull out the data and graph it (you may
# get a warning about the file being open--i've worked around it but needs
# a better fix)

wdm.open('test.wdm', 'r')

# get the datasets

wtemps = wdm.get_data('test.wdm', 134)
evaps = wdm.get_data('test.wdm', 41)
winds = wdm.get_data('test.wdm', 42)
flow1 = wdm.get_data('test.wdm', 113)
flow2 = wdm.get_data('test.wdm', 119)
dewp1 = wdm.get_data('test.wdm', 124)
Beispiel #2
0
# Import the hspf library et al.

from pyhspf import hspf

import os

os.chdir('data/tests')

# this is the path to the message file in PyHSPF (hspfmsg.wdm)

pyhspfdirectory = os.path.dirname(hspf.__file__)
messagepath = '{}/pyhspf/core/hspfmsg.wdm'.format(pyhspfdirectory)

# there is really nothing to do but just run these--but if you feel creative
# and wish to contribute it would be nice if someone would pull out the results
# of these and make plots to illustrate what the simulations do.

print('')

for i in range(4, 16):

    p = 'test{:02d}.uci'.format(i)
    if os.path.isfile(p):
        print('performing HSPF simulation {}'.format(p))
        hspf.hsppy(p, messagepath)
        print('successfully completed simulation\n')
    else:
        print('unable to locate {}, terminating'.format(p))
        raise
Beispiel #3
0
wdm.create_dataset('test.wdm', 126, attributes)

attributes['TSTYPE'] = 'SEDM'
wdm.create_dataset('test.wdm', 127, attributes)

attributes['TSTYPE'] = 'FLOW'
wdm.create_dataset('test.wdm', 136, attributes)

# then we have to manually close the WDM file

wdm.close('test.wdm')

# Run example1.uci--this simulation just inputs data from TEST01DT.91 to the
# test.wdm file we just made

hspf.hsppy('test01.uci', messagepath)

# let's go back into the test.wdm and pull out the data and graph it (you may 
# get a warning about the file being open--i've worked around it but needs
# a better fix)

wdm.open('test.wdm', 'r')

# get the datasets

wtemps = wdm.get_data('test.wdm', 134)
evaps  = wdm.get_data('test.wdm', 41)
winds  = wdm.get_data('test.wdm', 42)
flow1  = wdm.get_data('test.wdm', 113)
flow2  = wdm.get_data('test.wdm', 119)
dewp1  = wdm.get_data('test.wdm', 124)
Beispiel #4
0
if os.path.isdir('data'):

    os.chdir('data')

else:
    print('you appear to be missing the data files in the "data"')
    print('directory that are needed for this simulation')
    raise

# this is the path to the message file in PyHSPF (hspfmsg.wdm)

pyhspfdirectory = os.path.dirname(hspf.__file__)
messagepath = '{}/pyhspf/core/hspfmsg.wdm'.format(pyhspfdirectory)

# there is really nothing to do but just run these--but if you feel creative
# and wish to contribute it would be nice if someone would pull out the results
# of these and make plots to illustrate what the simulations do.

print('')

for i in range(4, 16):

    p = 'test{:02d}.uci'.format(i)
    if os.path.isfile(p): 
        print('performing HSPF simulation {}'.format(p))
        hspf.hsppy(p, messagepath)
        print('successfully completed simulation\n')
    else:
        print('unable to locate {}, terminating'.format(p))
        raise
Beispiel #5
0
    os.chdir(directory)

    # check that the file exists

    if not os.path.isfile(ucifile):
        print('file does not exist')
        raise

    # find the path to the HSPF message file

    pyhspfdirectory = os.path.dirname(hspf.__file__)
    messagepath = '{}/pyhspf/core/hspfmsg.wdm'.format(pyhspfdirectory)

    # run the simulation

    hspf.hsppy(ucifile, messagepath)

    wdm = WDMUtil()

    wdm.open(wdmfile, 'r')

    dsns = wdm.get_datasets(wdmfile)

    # see the datasets in the WDM file

    #for n in dsns: print(n, wdm.get_attribute(wdmfile, n, 'TSTYPE'))

    # look at the UCI file to get more info on the datasets

    precip = wdm.get_data(wdmfile, 106)
    evap = wdm.get_data(wdmfile, 426)
Beispiel #6
0
    os.chdir(directory)

    # check that the file exists

    if not os.path.isfile(ucifile):
        print('file does not exist')
        raise

    # find the path to the HSPF message file

    pyhspfdirectory = os.path.dirname(hspf.__file__)
    messagepath = '{}/pyhspf/core/hspfmsg.wdm'.format(pyhspfdirectory)

    # run the simulation

    hspf.hsppy(ucifile, messagepath)

    wdm = WDMUtil()

    wdm.open(wdmfile, 'r')

    dsns = wdm.get_datasets(wdmfile)

    # see the datasets in the WDM file

    #for n in dsns: print(n, wdm.get_attribute(wdmfile, n, 'TSTYPE'))

    # look at the UCI file to get more info on the datasets

    precip = wdm.get_data(wdmfile, 106)
    evap   = wdm.get_data(wdmfile, 426)
def run(ucifile):

    print('performing HSPF simulation {}'.format(ucifile))
    hspf.hsppy(ucifile, messagepath)
    print('successfully completed simulation\n')
Beispiel #8
0
def run(ucifile):

    print('performing HSPF simulation {}'.format(ucifile))
    hspf.hsppy(ucifile, messagepath)
    print('successfully completed simulation\n')