in
 ->
group(by: region,
     select: {
          *,
          $aggregate as aggregated,
          bucket_range(pick: hazard,
                       select: {
                          $aggregate as aggregated,
                       },
                       range: $report_depths) as Depth
     }) as regional_total

regional_total
 -> select({ remove_attr(region, 'the_geom').*, aggregated.*, Depth })
 -> sort([Region], direction: ['ASC'])
 -> save(name: 'regional-summary', format: 'csv')

regional_total
 -> select({ region.*, aggregated.*, Depth })
 -> save(name: 'regional-exposure', format: 'geojson')

