File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 4343
4444DEFAULT_DTYPE  =  "float64" 
4545
46+ # Keep in sync with _replace_special_floats 
47+ SPECIAL_FLOATS_ENCODED  =  {
48+     "Infinity" : np .inf ,
49+     "-Infinity" : - np .inf ,
50+     "NaN" : np .nan ,
51+ }
52+ 
4653
4754def  parse_zarr_format (data : object ) ->  Literal [3 ]:
4855    if  data  ==  3 :
@@ -447,8 +454,11 @@ def parse_fill_value(
447454    if  isinstance (fill_value , Sequence ) and  not  isinstance (fill_value , str ):
448455        if  data_type  in  (DataType .complex64 , DataType .complex128 ):
449456            if  len (fill_value ) ==  2 :
457+                 decoded_fill_value  =  tuple (
458+                     SPECIAL_FLOATS_ENCODED .get (value , value ) for  value  in  fill_value 
459+                 )
450460                # complex datatypes serialize to JSON arrays with two elements 
451-                 return  np_dtype .type (complex (* fill_value ))
461+                 return  np_dtype .type (complex (* decoded_fill_value ))
452462            else :
453463                msg  =  (
454464                    f"Got an invalid fill value for complex data type { data_type .value }  ." 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments