@@ -2520,6 +2520,12 @@ def sequence_length(self):
2520
2520
try :
2521
2521
return self .data .attrs ["sequence_length" ]
2522
2522
except KeyError :
2523
+ warnings .warn (
2524
+ "`sequence_length` was not found as an attribute in the dataset, so"
2525
+ " the largest position has been used. It can be set with"
2526
+ " ds.attrs['sequence_length'] = 1337; ds.to_zarr('path/to/store',"
2527
+ " mode='a')"
2528
+ )
2523
2529
return int (np .max (self .data ["variant_position" ])) + 1
2524
2530
2525
2531
@property
@@ -2653,6 +2659,12 @@ def individuals_time(self):
2653
2659
try :
2654
2660
return self .data ["individuals_time" ][:][self .individuals_select ]
2655
2661
except KeyError :
2662
+ warnings .warn (
2663
+ "`individuals_time` was not found as an array in the dataset, so "
2664
+ "tskit.UNKNOWN_TIME has been used. It can be apppended to the dataset "
2665
+ "with data_array.to_zarr('path/to/store', append_dim='samples', "
2666
+ "mode='a')"
2667
+ )
2656
2668
return np .full (self .num_individuals , tskit .UNKNOWN_TIME )
2657
2669
2658
2670
@functools .cached_property
@@ -2696,20 +2708,35 @@ def individuals_location(self):
2696
2708
try :
2697
2709
return self .data ["individuals_location" ][:][self .individuals_select ]
2698
2710
except KeyError :
2711
+ warnings .warn (
2712
+ "`individuals_location` was not found as an array in the dataset, "
2713
+ "so [] has been used. It can be apppended to the dataset with "
2714
+ "data_array.to_zarr('path/to/store', append_dim='samples', mode='a')"
2715
+ )
2699
2716
return np .array ([[]] * self .num_individuals , dtype = float )
2700
2717
2701
2718
@functools .cached_property
2702
2719
def individuals_population (self ):
2703
2720
try :
2704
2721
return self .data ["individuals_population" ][:][self .individuals_select ]
2705
2722
except KeyError :
2723
+ warnings .warn (
2724
+ "`individuals_population` was not found as an array in the dataset, "
2725
+ "so tskit.NULL has been used. It can be apppended to the dataset with "
2726
+ "data_array.to_zarr('path/to/store', append_dim='samples', mode='a')"
2727
+ )
2706
2728
return np .full ((self .num_individuals ), tskit .NULL , dtype = np .int32 )
2707
2729
2708
2730
@functools .cached_property
2709
2731
def individuals_flags (self ):
2710
2732
try :
2711
2733
return self .data ["individuals_flags" ][:][self .individuals_select ]
2712
2734
except KeyError :
2735
+ warnings .warn (
2736
+ "`individuals_flags` was not found as an array in the dataset, so 0 "
2737
+ "has been used. It can be apppended to the dataset with "
2738
+ "data_array.to_zarr('path/to/store', append_dim='samples', mode='a')"
2739
+ )
2713
2740
return np .full ((self .num_individuals ), 0 , dtype = np .int32 )
2714
2741
2715
2742
@staticmethod
0 commit comments