The aggregator Module

API to aggregate data over shapes

The Aggregator class expects a netCDF dataset, containing 3 variables: value, latitude and longitude

class Aggregator(infile: str, variable: str, outfile: str, strategy: RasterizationStrategy, shapefile: str, geography: Geography, extra_columns: Optional[Tuple[List[str], List[str]]] = None, ram=0)[source]
Parameters
  • infile – Path to file with raster data to be aggregated. Can be either NetCDF or GeoTiff file

  • variable – Name of variable or variables that need to be aggregated

  • outfile – Path to the output “csv.gz” file

  • strategy – Rasterization strategy

  • shapefile – Path to shapefile with polygons

  • geography – What kind of geography: US Counties or ZIP/ZCTA codes

  • extra_columns – if we need to add any extra columns to the CSV

  • ram – Runtime memory available to the process

set_strategy(strategy: RasterizationStrategy)[source]
on_set_strategy(ram: int, set_factor: bool)[source]
prepare()[source]
abstract open()[source]
abstract get_dataset_variables() Set[str][source]
abstract get_layer(var)[source]
get_header() List[str][source]
write_header()[source]
get_registry(domain_name: str, table_name: str, description: Optional[str] = None)[source]
execute(mode: str = 'wt')[source]

Executes computational task

Parameters

mode (str) – mode to use opening result file

Returns

collect_data(collector: Collector)[source]
downscale(layer)[source]
compute(writer: Collector, layers)[source]
class NetCDFAggregator(infile: str, variable: str, outfile: str, strategy: RasterizationStrategy, shapefile: str, geography: Geography, extra_columns: Optional[Tuple[List[str], List[str]]] = None, ram=0)[source]
Parameters
  • infile – Path to file with raster data to be aggregated. Can be either NetCDF or GeoTiff file

  • variable – Name of variable or variables that need to be aggregated

  • outfile – Path to the output “csv.gz” file

  • strategy – Rasterization strategy

  • shapefile – Path to shapefile with polygons

  • geography – What kind of geography: US Counties or ZIP/ZCTA codes

  • extra_columns – if we need to add any extra columns to the CSV

  • ram – Runtime memory available to the process

open()[source]
get_dataset_variables() Set[str][source]
get_layer(var)[source]
on_set_strategy(ram: int, set_factor)[source]
class GeoTiffAggregator(infile: str, variable: str, outfile: str, strategy: RasterizationStrategy, shapefile: str, geography: Geography, extra_columns: Optional[Tuple[List[str], List[str]]] = None, ram: int = 0)[source]
Parameters
  • infile – Path to file with raster data to be aggregated. Can be either NetCDF or GeoTiff file

  • variable – Name of variable or variables that need to be aggregated

  • outfile – Path to the output “csv.gz” file

  • strategy – Rasterization strategy

  • shapefile – Path to shapefile with polygons

  • geography – What kind of geography: US Counties or ZIP/ZCTA codes

  • extra_columns – if we need to add any extra columns to the CSV

  • ram – Runtime memory available to the process

open()[source]
get_dataset_variables() Set[str][source]
get_layer(var)[source]
on_set_strategy(ram: int, set_factor)[source]