stcorp / harp

Data harmonization toolset for scientific earth observation data
http://stcorp.github.io/harp/doc/html/index.html
BSD 3-Clause "New" or "Revised" License
55 stars 18 forks source link

Python interface shows invalid type for integer variable #263

Closed svniemeijer closed 2 years ago

svniemeijer commented 2 years ago

See #262 for details.

When showing the type of a variable in __str__() this should be the same type as would be used in an export. This means that for integers it should take the size of the valid_min/valid_max into account as well (as is done in _export_variable()).

srepmub commented 2 years ago

pushed a patch, please review.

srepmub commented 2 years ago

btw, note this case, which I also think I fixed with the same patch:

p.foo = harp.Variable(-1000) p.foo.valid_min = -5000 p.foo.valid_max = 1 # less wide type, overrides valid_min type!? test_export(p)

this led to a crash, because in the code valid_max check overrides the valid_min check (I now take the maximum/widest type):

'''

svniemeijer commented 2 years ago

That was indeed also an issue. Things work as expected now.