@@ -483,8 +483,10 @@ def _create_cfa_data(self, ncvar, ncdimensions, data, cfvar):
483
483
484
484
# Location
485
485
term = "location"
486
+ data = cfa [term ]
487
+ self .implementation .nc_set_hdf5_chunksizes (data , data .shape )
486
488
term_ncvar = self ._cfa_write_term_variable (
487
- cfa [ term ] ,
489
+ data ,
488
490
aggregated_data .get (term , f"cfa_{ term } " ),
489
491
location_ncdimensions ,
490
492
)
@@ -502,8 +504,10 @@ def _create_cfa_data(self, ncvar, ncdimensions, data, cfvar):
502
504
else :
503
505
attributes = None
504
506
507
+ data = cfa [term ]
508
+ self .implementation .nc_set_hdf5_chunksizes (data , data .shape )
505
509
term_ncvar = self ._cfa_write_term_variable (
506
- cfa [ term ] ,
510
+ data ,
507
511
aggregated_data .get (term , f"cfa_{ term } " ),
508
512
fragment_ncdimensions ,
509
513
attributes = attributes ,
@@ -521,8 +525,10 @@ def _create_cfa_data(self, ncvar, ncdimensions, data, cfvar):
521
525
else :
522
526
dimensions = fragment_ncdimensions
523
527
528
+ data = cfa [term ]
529
+ self .implementation .nc_set_hdf5_chunksizes (data , data .shape )
524
530
term_ncvar = self ._cfa_write_term_variable (
525
- cfa [ term ] ,
531
+ data ,
526
532
aggregated_data .get (term , f"cfa_{ term } " ),
527
533
dimensions ,
528
534
)
@@ -539,8 +545,10 @@ def _create_cfa_data(self, ncvar, ncdimensions, data, cfvar):
539
545
else :
540
546
dimensions = fragment_ncdimensions
541
547
548
+ data = cfa [term ]
549
+ self .implementation .nc_set_hdf5_chunksizes (data , data .shape )
542
550
term_ncvar = self ._cfa_write_term_variable (
543
- cfa [ term ] ,
551
+ data ,
544
552
aggregated_data .get (term , f"cfa_{ term } " ),
545
553
dimensions ,
546
554
)
@@ -809,8 +817,10 @@ def _cfa_write_non_standard_terms(
809
817
terms .append (term )
810
818
811
819
# Create the new CFA term variable
820
+ data = type (data )(dx )
821
+ self .implementation .nc_set_hdf5_chunksizes (data , data .shape )
812
822
term_ncvar = self ._cfa_write_term_variable (
813
- data = type ( data )( dx ) ,
823
+ data = data ,
814
824
ncvar = aggregated_data .get (term , f"cfa_{ term } " ),
815
825
ncdimensions = fragment_ncdimensions ,
816
826
)
@@ -904,6 +914,7 @@ def _cfa_aggregation_instructions(self, data, cfvar):
904
914
aggregation_format = []
905
915
for indices in data .chunk_indices ():
906
916
file_details = self ._cfa_get_file_details (data [indices ])
917
+
907
918
if len (file_details ) != 1 :
908
919
if file_details :
909
920
raise ValueError (
@@ -962,6 +973,8 @@ def _cfa_aggregation_instructions(self, data, cfvar):
962
973
):
963
974
n = n_trailing - len (filenames )
964
975
if n :
976
+ # This chunk has fewer fragment files than some
977
+ # others, so some padding is required.
965
978
pad = ("" ,) * n
966
979
aggregation_file [i ] = filenames + pad
967
980
aggregation_format [i ] = formats + pad
@@ -1055,13 +1068,14 @@ def _cfa_get_file_details(self, data):
1055
1068
{(('/home/file.pp',), (34556,), ('um',))}
1056
1069
1057
1070
"""
1058
- out = set ()
1071
+ out = []
1072
+ out_append = out .append
1059
1073
for a in data .todict ().values ():
1060
1074
try :
1061
- out . update (
1062
- (( a .get_filenames (), a .get_addresses (), a .get_formats ()), )
1075
+ out_append (
1076
+ (a .get_filenames (), a .get_addresses (), a .get_formats ())
1063
1077
)
1064
1078
except AttributeError :
1065
1079
pass
1066
1080
1067
- return out
1081
+ return set ( out )
0 commit comments