VIC icon indicating copy to clipboard operation
VIC copied to clipboard

add udunits support

Open wietsefranssen opened this issue 9 years ago • 1 comments

In order to avoid conversion errors (eg to double conversion) while reading forcing data, but also to make it easier for the user to prepair forcing data with different units, I suggest to add support for the udunits2 library. This library can later also be used to choose the preferred output units of the variables.

I suggest to start to add lines to read the units attribute of the forcing variables from the netcdf file. Then make a conversion function like float convert(char from, char to, float data) and use this function directly after reading the data from the file to convert the the standard units vic uses for its calculations.

Later we can extend this with more functionality, error handling, vic output etc.

@bartnijssen @jhamman what do you thing about this idea?

wietsefranssen avatar Mar 31 '16 13:03 wietsefranssen

I see now that my previous message appeared just a few seconds ago. In the meanwhile I made a working example. I will make a pull request in order to give you insight of what I did. (in case you want an other way of comparing/sharing in stead of making a pull request, just let me know.

wietsefranssen avatar Mar 31 '16 13:03 wietsefranssen