Package: hdgfrom
“hdg-from” is a simple command-line tool that generates HDG files for
the Global Environment Modelling System for Subsurface waters
(GEMSS).Usage ExampleFor instance, if you have data produced by the Storm Water Management
Model (SWMM), say in a text filemy-data.txtin for instance,
where the flow rates are in liters per second (LPS), as follows:Table - Node 1
                            Total Inflow
Days        Hours           (LPS)
0           00:15:00        0.18
0           00:30:00        2.30
0           00:45:00        2.06You can usehdg-fromto obtain the equivalent HDG file by entering.$hdg-frommy-data.txt3 observation(s) loaded from 'my-data.txt'.
'my-data.hdg' successfully generated.In the generated file, named by defaultmy-data.hdg, the flow
values have been convert to cubic meters per day (CMD).$GLLVHTTVDFile, V5.0
$Creation Date: 09/08/2017 08:52
$Waterbody Name: Node 1
$Created by: Unknown
$Start Date: 01/01/2017 12:00
$End Date: 01/01/2017 12:45
$Number of Data Lines: 3
$X, Y, Station Height, Missing value,Profile Format, ExceFormat, Longitude, Latitude, Anemometer Height
$Number of bins, Depth data type, TVD file type
62000,6957300,0,999999999,0,0,0,0,0
1,0,0
1
2,0,4,1.0,0,0.0,0.0,Flow Rate,Flow Rate
$Year,Month,Day,Hour,Minute,Bin1,Flow Rate
2017,1,1,12,15,0,15.55
2017,1,1,12,30,0,198.72
2017,1,1,12,45,0,177.98Below are the options thathdg-fromaccepts:-f<format>,--format<format>The file format of the input file. So far only the SWMM format is
available, but other may be supported in later versions.-n<name>,--user-name<name>The name of the user that creates the HDG file (see HDG FieldCreated By). Should be enclosed in double quotes if it
contains space. By default, the user name is “Unknown”.-o<file>,--output<file>The HDG file to generate. By default, the generated file will have
the same name as the given input file (only its extension will
differ), as in the example above.-s<date>,--start-date<date>The date used as a starting point to convert simulated time into
absolute time (see HDG FieldState Date). Dates must adhere to
theISO 8601standard such as 2017-01-01T12:00:00. By default,
the date used is Jan. 1, 2017 at 12:00 AM.--unit<unit>The flow rate unit that should be used in the HDG file. By
default, HDG files use cubic meter per day (CMD), but the other
options are:“CMS” for cubic meters per seconds“CFS” for cubic feet per seconds“MGD” for millions of gallon per day“GPM” for gallons per minutes“CMD” for cubic meters per day“CMH” for cubic meters per hour-w<name>,--water-body<name>The name of the water body to set in the HDG file (see FieldWaterbody Name). This will override the one read in the SWMM
file, if any. Should be enclosed in double quotes if it contains
spaces. By default, the name of the water body is read from the
input file.-h,--helpShow a similar description of the available options and exit.Installationhdg-fromis a simple Python 3.3+ application (also tested on Python
2.7) with no additional dependency. To install thelatest stable
releasefrom thePypirepository, the simplest way is to usepipas follows:$pipinstallhdgfromAlternatively, you may want to install thelatest version under
development. To this end,pipyou can directly install the last
commit on the Git repository, using:$pipinstallgit+https://github.com/wudi312858/hdg-fromChange LogNext version:Unit conversions from the SWMM file to the HDG file.Warn about conversions that lead to only zero values.Version 0.2.0:Let the user specify the name of the generated HDG file.Let the user specify its name for inclusion in the HDG file.Let the user override the name of the water body.Tell the user how many observations were loaded from the input
file.CatchFileNotFoundErrorproperly.Catch invalid start dates properly.Generate the correct creation date.Compatibility with Python 2.7 and Python 3.3+.Version 0.1.0:Accepts text files generated bySWMMand generates an equivalent
HDG file.Let the user specify the starting date to convert simulated time
into absolute time.Only tested on Python 3.6.