Skip to main content

Reads Hydrological Simulation Program - FORTRAN binary output files.

Project description

https://github.com/timcera/hspfbintoolbox/actions/workflows/python-package.yml/badge.svg https://coveralls.io/repos/timcera/hspfbintoolbox/badge.png?branch=master Latest release BSD-3 clause license hspfbintoolbox downloads

Documentation for hspfbintoolbox

The hspfbintoolbox is a Python script and library of functions to read Hydrological Simulation Program Fortran (HSPF) binary files and print to screen. The time series can then be redirected to file, or piped to other command line programs like tstoolbox.

Requirements

  • pandas - on Windows this is part of the Python(x,y), Enthought, or Anaconda distributions

  • mando - command line parser

  • tstoolbox - utilities to process time-series

Installation

Should be as easy as running pip install hspfbintoolbox or easy_install hspfbintoolbox at any command line. Not sure on Windows whether this will bring in pandas but as mentioned above, if you start with Python(x,y) then you won’t have a problem.

Usage - Command Line

Just run ‘hspfbintoolbox’ to get a list of subcommands:

catalog

Prints out a catalog of data sets in the binary file.

dump

Prints out ALL data from a HSPF binary output file.

extract

Prints out data to the screen from a HSPF binary output file.

time_series

DEPRECATED: Use ‘extract’ instead.

The default for all of the subcommands is to accept data from stdin (typically a pipe). If a subcommand accepts an input file for an argument, you can use “–infile=filename”, or to explicitly specify from stdin use “–infile=’-’” .

For the subcommands that output data it is printed to the screen and you can then redirect to a file.

Usage - API

You can use all of the command line subcommands as functions. The function signature is identical to the command line subcommands. The return is always a PANDAS DataFrame. Input can be a CSV or TAB separated file, or a PANDAS DataFrame and is supplied to the function via the ‘input_ts’ keyword.

Simply import hspfbintoolbox:

import hspfbintoolbox

# Then you could call the functions
ntsd = hspfbintoolbox.dump('tests/test.hbn')

# Once you have a PANDAS DataFrame you can use that as input.
ntsd = tstoolbox.aggregate(statistic='mean', agg_interval='daily', input_ts=ntsd)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hspfbintoolbox-7.0.1.tar.gz (354.6 kB view details)

Uploaded Source

File details

Details for the file hspfbintoolbox-7.0.1.tar.gz.

File metadata

  • Download URL: hspfbintoolbox-7.0.1.tar.gz
  • Upload date:
  • Size: 354.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.11

File hashes

Hashes for hspfbintoolbox-7.0.1.tar.gz
Algorithm Hash digest
SHA256 8526a4732e23e7fd0bf9677086ddcb69fa184162337e77c136c3fba8f8869157
MD5 c07fb1c8b2b5f12601d6116bd132b065
BLAKE2b-256 92bf6f496269e528d472d3b93aa1349045c3e48593579e110a7fae81a1c0eea4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page