Handling NetCDF enums as julia enums - #316
Conversation
|
Using The solution is to use A drop-in alternative is to define a custom struct for enums (similarity for compound types): struct NCEnum{T,typename,names,values}
data::T # T is the base type of the enum
endIn my benchmark, it is as fast and memory efficient as regular enums. They have also the same memory layout for the C code and can be used as a drop-in replacement. The user will still be able to use its own julia enum if it registered before hand with the function: NCDatasets.typemap!(ds,"cloud_class_t" => Clouds.cloud_class_t); # or similar APIAs we own the type |
This is an alternative way to implement netCDF/HDF5 enum types in NCDatasets as julia enum.
Reference to PR using
CategoricalArrays:What is works so far:
[ ] Enum types displayed in show(doing it later with changes in CommonDataModel)CC:
@lupemba @tiemvanderdeure @evetion