You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Float32 converted Float64 during reference creation #532
Kerchunk Verison: 0.2.7
I am using kerchunk to convert my netcdf files on s3 to json references. The original netcdf files are composed of variables of mixed data type of float32 and float64. After converted to json and read through xarray, all float data are converted to float64. I wonder is it an expected behaviour?
Hi @martindurant, thanks for the reply. Sorry for the confusion. The netcdf files contain several variables and they are int, float and double. In the reference created, variables with float precision in the original netcdf are converted to double somehow.
OK, that's probably not supposed to happen. It would be worthwhile to see what h5py thinks the data type is when you get to here. I'm not sure if there is any configuration we can pass to h5py or if the upcasting is happening elsewhere.
Activity
martindurant commentedon Dec 4, 2024
The output type must be consistent everywhere within a variable, sorry.
yuanjianz commentedon Dec 4, 2024
Hi @martindurant, thanks for the reply. Sorry for the confusion. The netcdf files contain several variables and they are int, float and double. In the reference created, variables with float precision in the original netcdf are converted to double somehow.
Input netcdf:
output json and read through xarray:
martindurant commentedon Dec 4, 2024
OK, that's probably not supposed to happen. It would be worthwhile to see what h5py thinks the data type is when you get to here. I'm not sure if there is any configuration we can pass to h5py or if the upcasting is happening elsewhere.