HydrologicEngineeringCenter / hec-dss

source code for HEC-DSS (Data Storage System)
MIT License
27 stars 8 forks source link

VBA throws Overflow error when writing doubles #240

Closed mjbarryfb closed 5 months ago

mjbarryfb commented 5 months ago

There is an issue writing regular time series as doubles, VBA throws an Overflow error. Using the hec_dss_tsStoreRegular call, I set the saveAsFloat argument to 0 and an Overflow error is thrown. If I set the saveAsFloat to 1, the time series stores without a problem. Please let me know if there is workaround.

ktarbet commented 5 months ago

@mjbarryfb

I tested with the python library and was able to write doubles.

        dss = HecDss(self.test_files.get_copy("sample7.dss"))
        print("record count = " + str(dss.record_count()))

        t1 = datetime(2005, 1, 1)
        t2 = datetime(2005, 1, 4)
        tsc = dss.get("//SACRAMENTO/PRECIP-INC//1Day/OBS/", t1, t2) # read as float
        tsc.print_to_console()

        tsc.id="//SACRAMENTO/PRECIP-INC//1Day/OBS-double/"
        dss.put(tsc)# save as double
        dss.close()

Please provide some more details, such as example code, so we can try to reproduce.

ref: https://github.com/HydrologicEngineeringCenter/hec-dss-python

mjbarryfb commented 5 months ago

I was not able to repeat the issue with a test dataset. So, I deleted the records from the original DSS file I was using and I tried storing as Double again and it worked. I think the problem was the original records were stored as Single. Since the original records where Single, the hecdss.dll threw an overflow error.

That said, is there a way to check if the record exits and what data type the record was stored as?

You can close the ticket.

ktarbet commented 5 months ago

When you read the catalog of pathnames, you also get the recordTypes array.

HECDSS_API int hec_dss_catalog(dss_file dss, char pathBuffer, int recordTypes, const char pathFilter, const int count, const int pathBufferItemSize) {