UW-Hydro / tonic

A pre/post processing toolbox for hydrologic models
MIT License
20 stars 33 forks source link

Read veg_lib veg class descriptions dynamically #38

Closed tbohn closed 8 years ago

tbohn commented 8 years ago

At present, tonic doesn't read the veg class descriptions ("comment" field, which contains a varying number of space-separated strings) from the veg library file. This is because it reads the veg_lib file with numpy.loadtxt(), which (a) can't handle inhomogeneous numbers of columns per row and (b) interprets all fields as the same type. So, it just reads all columns up to but not including the "comment" field and reads them as floats, which is fine for getting the bulk of the information out of the library file.

Perhaps to read the comments we should do a second read of the veg_lib file - at the moment I don't know what the options are for doing this, but presumably there's another way to parse text files that would allow this (albeit not as efficient as loadtxt()).

It's important to get the class names/descriptions into the netcdf file and it would be ideal for tonic to do it.

jhamman commented 8 years ago

We can switch the reader over to pandas.read_table, it handles mixed formats.