예제 #1
0
파일: intro02.py 프로젝트: djibi2/PyHSPF
# build the input wdm file

hspfmodel.build_wdminfile()

# tell HSPF to keep track of the outflow volume from the reach, which
# has a Fortran name "ROVOL" and a PyHSPF name "reach_outvolume"

targets = ['reach_outvolume']

# create the UCI for the simulation period to provide the targets

hspfmodel.build_uci(targets, start, end, hydrology = True)

# run it

hspfmodel.run(verbose = True)

# pull up the results; this output wdmfile is created automatically
# and has the same name as the "filename" plus "_out.wdm"

wdmoutfile = 'example02_out.wdm'

wdm.open(wdmoutfile, 'r')

# get the dataset numbers

dsns = wdm.get_datasets(wdmoutfile)

# get the constituent ids for the datasets 

idconss = [wdm.get_attribute(wdmoutfile, n, 'IDCONS') for n in dsns]
예제 #2
0
    'snowpack',
    'snowfall',
]

# build the UCI and output WDM files

simplified.build_uci(targets,
                     start,
                     end,
                     atemp=True,
                     snow=True,
                     hydrology=True)

# run it

simplified.run(verbose=True)

# use the Postprocessor to analyze and save the results to the folder

dates = start + datetime.timedelta(days=warmup), end

postprocessor = Postprocessor(simplified, dates, comid=comid)

postprocessor.get_hspexp_parameters(verbose=False)
postprocessor.plot_hydrograph(tstep='monthly',
                              show=False,
                              output='{}/hydrography'.format(output))
postprocessor.plot_calibration(output='{}/statistics'.format(output),
                               show=False)
postprocessor.plot_runoff(tstep='daily',
                          show=False,
예제 #3
0
# tell HSPF to run hydrology and assign default parameters

hspfmodel.add_hydrology()

# build the wdm input file using the timeseries

hspfmodel.build_wdminfile()

# external targets

targets = ['reach_outvolume', 'evaporation', 'reach_volume', 'runoff']

# build the input files and run

hspfmodel.build_uci(targets, start, end, hydrology=True, verbose=False)
hspfmodel.run(verbose=True)

# retrieve results using WDMUtil

wdm = WDMUtil()

# open the file for read access

wdm.open(wdmoutfile, 'r')

# pull up the flow at the outlet and plot it along with the precipitation
# and evapotranspiration

dsns = wdm.get_datasets(wdmoutfile)
idconss = [wdm.get_attribute(wdmoutfile, n, 'IDCONS') for n in dsns]
staids = [wdm.get_attribute(wdmoutfile, n, 'STAID ') for n in dsns]
예제 #4
0
           'evaporation', 
           'runoff', 
           'groundwater',
           'snow_state', 
           'snowpack', 
           'snowfall',
           ]

# build the UCI and output WDM files

simplified.build_uci(targets, start, end, atemp = True, snow = True,
                     hydrology = True)

# run it

simplified.run(verbose = True)

# use the Postprocessor to analyze and save the results to the folder

dates = start + datetime.timedelta(days = warmup), end

postprocessor = Postprocessor(simplified, dates, comid = comid)

postprocessor.get_hspexp_parameters(verbose = False)
postprocessor.plot_hydrograph(tstep = 'monthly', show = False,
                              output = '{}/hydrography'.format(output))
postprocessor.plot_calibration(output = '{}/statistics'.format(output),
                               show = False)
postprocessor.plot_runoff(tstep = 'daily', show = False,
                          output = '{}/runoff'.format(output))
report = '{}/output_report.csv'.format(output)