original_docstring: 
      If the acquisition is part of a `tiled` scene such as Sentinel-2a,
      then we need to average the point measurements gathered from
      all granules.
      
docstring: If the acquisition is part of a `tiled` scene such as Sentinel-2a,
  then we need to average the point measurements gathered from
  all granules.
docstring_tokens: If the acquisition is part of a ` tiled ` scene such as Sentinel - 2a then we need to average the point measurements gathered from all granules .
code: def aggregate_ancillary(granule_groups):
      """
      If the acquisition is part of a `tiled` scene such as Sentinel-2a,
      then we need to average the point measurements gathered from
      all granules.
      """
      # initialise the mean result
      ozone = vapour = aerosol = elevation = 0.0
  
      # number of granules in the scene
      n_tiles = len(granule_groups)
  
      for granule in granule_groups:
          group = granule[GroupName.ANCILLARY_GROUP.value]
  
          ozone += group[DatasetName.OZONE.value][()]
          vapour += group[DatasetName.WATER_VAPOUR.value][()]
          aerosol += group[DatasetName.AEROSOL.value][()]
          elevation += group[DatasetName.ELEVATION.value][()]
  
      # average
      ozone /= n_tiles
      vapour /= n_tiles
      aerosol /= n_tiles
      elevation /= n_tiles
  
      description = ("The {} value is an average from all the {} values "
                     "retreived for each Granule.")
      attrs = {'data_source': 'granule_average'}
  
      # output each average value back into the same granule ancillary group
      group_name = ppjoin(GroupName.ANCILLARY_GROUP.value,
                          GroupName.ANCILLARY_AVG_GROUP.value)
      for granule in granule_groups:
          # for the multifile workflow, we only want to write to one granule
          try:
              group = granule.create_group(group_name)
          except ValueError:
              continue
  
          dset = group.create_dataset(DatasetName.OZONE.value, data=ozone)
          attrs['description'] = description.format(*(2*['Ozone']))
          attach_attributes(dset, attrs)
  
          dset = group.create_dataset(DatasetName.WATER_VAPOUR.value, data=vapour)
          attrs['description'] = description.format(*(2*['Water Vapour']))
          attach_attributes(dset, attrs)
  
          dset = group.create_dataset(DatasetName.AEROSOL.value, data=aerosol)
          attrs['description'] = description.format(*(2*['Aerosol']))
          attach_attributes(dset, attrs)
  
          dset = group.create_dataset(DatasetName.ELEVATION.value, data=elevation)
          attrs['description'] = description.format(*(2*['Elevation']))
          attach_attributes(dset, attrs)
code_tokens: def aggregate_ancillary ( granule_groups ) : ozone = vapour = aerosol = elevation = 0.0 n_tiles = len ( granule_groups ) for granule in granule_groups : group = granule [ GroupName . ANCILLARY_GROUP . value ] ozone += group [ DatasetName . OZONE . value ] [ ( ) ] vapour += group [ DatasetName . WATER_VAPOUR . value ] [ ( ) ] aerosol += group [ DatasetName . AEROSOL . value ] [ ( ) ] elevation += group [ DatasetName . ELEVATION . value ] [ ( ) ] ozone /= n_tiles vapour /= n_tiles aerosol /= n_tiles elevation /= n_tiles description = ( "The {} value is an average from all the {} values " "retreived for each Granule." ) attrs = { 'data_source' : 'granule_average' } group_name = ppjoin ( GroupName . ANCILLARY_GROUP . value , GroupName . ANCILLARY_AVG_GROUP . value ) for granule in granule_groups : try : group = granule . create_group ( group_name ) except ValueError : continue dset = group . create_dataset ( DatasetName . OZONE . value , data = ozone ) attrs [ 'description' ] = description . format ( * ( 2 * [ 'Ozone' ] ) ) attach_attributes ( dset , attrs ) dset = group . create_dataset ( DatasetName . WATER_VAPOUR . value , data = vapour ) attrs [ 'description' ] = description . format ( * ( 2 * [ 'Water Vapour' ] ) ) attach_attributes ( dset , attrs ) dset = group . create_dataset ( DatasetName . AEROSOL . value , data = aerosol ) attrs [ 'description' ] = description . format ( * ( 2 * [ 'Aerosol' ] ) ) attach_attributes ( dset , attrs ) dset = group . create_dataset ( DatasetName . ELEVATION . value , data = elevation ) attrs [ 'description' ] = description . format ( * ( 2 * [ 'Elevation' ] ) ) attach_attributes ( dset , attrs )
short_docstring: If the acquisition is part of a `tiled` scene such as Sentinel-2a,
  then we need to average the point measurements gathered from
  all granules.
short_docstring_tokens: If the acquisition is part of a ` tiled ` scene such as Sentinel - 2a then we need to average the point measurements gathered from all granules .
comment: """
      If the acquisition is part of a `tiled` scene such as Sentinel-2a,
      then we need to average the point measurements gathered from
      all granules.
      """$SEP$# initialise the mean result$SEP$# number of granules in the scene$SEP$# average$SEP$# output each average value back into the same granule ancillary group$SEP$# for the multifile workflow, we only want to write to one granule