Scripting > Reading and Writing to HEC-DSS Files
 

HecDss Class

from hec.heclib.dss import *

 

HecDss.open(string filename)

HecDss.open(string filename, 0/1 fileMustExist)

 

The HecDss class is used to gain access to a HEC-DSS File, as illustrated below.  You must import HecDss from hec.heclib.dss.

 

Note:  Opening and closing files are expensive operations.  HEC-DSS has been designed so that you do not need to close a file, unless you need to explicitly (e.g., to rename it).  If you open a DSS file that is already open, you get a pointer to it and the file is not physically reopened, saving computer time.  Thus, do not close a DSS file unless you need to.  You can call the function done() to release it.  You can close it if no other objects will use it, but the close is not required.

 

Example: Opening and Releasing a DSS File


from hec.heclib.dss import *

 

theFile = HecDss.open(“MyFile.dss”)

or

theFile = HecDss.open(“C:/temp/sample.dss”, 1)

 

//  Finished using the file – release it

theFile.done()