Open tinsmcl1 opened 3 months ago
Possible solution: Use float data type instead of int
Which dataset has type int and fill of NaN? This is an error. An int data type should have an int fill value.
It's not that a dataset has type int and fill of NaN. It's that when merging two datasets we may introduce NaNs into the data e.g. when merging datasets with different times and parameters, not all parameter data will exist for every time. With that, an integer parameter in the hapi ndarray may end up having some NaN values which doesn't appear to be allowed by numpy.
I need to clarify - Are NaNs allowed as elements in a hapi ndarray or are those elements always set to the fill value?
The spec says, " For integers, string fill values must correspond to an integer value that is small enough to fit into a 4-byte signed integer.", so they are technically not allowed, but I suspect there are cases where fill was set to NaN in the HAPI metadata for an integer type. It seems the verifier does not check this. This will probably cause hapiclient
to throw an error - I have not encountered it, however.
merge_hapi() throws an error when the resulting dataframe contains a column of ints and NaNs because Python does not allow converting NaN to int.
Reproduce error: