File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,8 @@ def populate_non_dim_coordinates(
229229    """Populate the xarray dataset with coordinate variables.""" 
230230    not_null  =  grid .map [:] !=  UINT32_MAX 
231231    for  c_name , c_values  in  coordinates .items ():
232+         # Since we haven't serialized the dataset yet, if we don't explicitly capture the encoding 
233+         # we will lose it. 
232234        encodings  =  dataset [c_name ].encoding 
233235        tmp_coords  =  np .full (
234236            not_null .shape , dtype = dataset [c_name ].dtype , fill_value = _get_fill_value (dataset [c_name ].dtype )
@@ -239,7 +241,7 @@ def populate_non_dim_coordinates(
239241            dataset [c_name ].dims ,
240242            tmp_coords ,
241243            attrs = dataset [c_name ].attrs ,
242-             encoding = encodings ,   # Ensure we preserve all of the encodings. 
244+             encoding = encodings ,
243245        )
244246        drop_vars_delayed .append (c_name )
245247    return  dataset , drop_vars_delayed 
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ def trace_worker(  # noqa: PLR0913
134134            ds_to_write [hdr_key ].dims ,
135135            tmp_headers ,
136136            attrs = ds_to_write [hdr_key ].attrs ,
137+             encoding = ds_to_write [hdr_key ].encoding ,  # Not strictly necessary, but safer than not doing it. 
137138        )
138139
139140    # Get the sample dimension size from the data variable itself 
@@ -153,6 +154,7 @@ def trace_worker(  # noqa: PLR0913
153154        ds_to_write [data_variable_name ].dims ,
154155        tmp_samples ,
155156        attrs = ds_to_write [data_variable_name ].attrs ,
157+         encoding = ds_to_write [data_variable_name ].encoding ,  # Not strictly necessary, but safer than not doing it. 
156158    )
157159
158160    out_path  =  output_location .uri 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments