atra.preprocess package

Submodules

atra.preprocess.combine_roads module

Get Argentina shapefiles and combine them into a single file

main()[source]

atra.preprocess.convert_hazard_data module

Pre-process hazard data

Purpose

Convert GeoTiff raster hazard datasets to shapefiles based on masking and selecting values from
  • Single-band raster files

Input data requirements

  1. Correct paths to all hazard datasets
  2. Single-band GeoTiff hazard raster files with:
    • values - between 0 and 1000
    • raster grid geometry
    • projection systems: Default assumed = EPSG:4326

Results

  1. Shapefiles whose names show the hazard models and their selected range of values
    • ID - equal to 1
    • geometry - Shapely Polygon outline of selected hazard
convert(threshold, infile, tmpfile_1, outfile)[source]

Convert GeoTiff raster file to Shapefile with geometries based on raster threshold less that 999

Parameters
  • threshold - Float value of lower bound of GeoTiff threshold value to be selected
  • infile - String name of input GeoTff file path
  • tmpfile_1 - Stirng name of tmp file 1
  • outfile - Stirng name of output shapefile
Outputs
Shapefile with Polygon geometries of rasters based on raster values above a threshold
convert_geotiff_to_vector_with_multibands(band_colors, infile, infile_epsg, tmpfile_1, tmpfile_2, outfile)[source]

Convert multi-band GeoTiff raster file to Shapefile with geometries based on raster band color values

Parameters
  • band_colors - Tuple with 3-values each corresponding to the values in raster bands
  • infile - String name of input GeoTff file path
  • infile_epsg - Integer value of EPSG Projection number of raster
  • tmpfile_1 - Stirng name of tmp file 1
  • tmpfile_2 - Stirng name of tmp file 2
  • outfile - Stirng name of output shapefile
Outputs
Shapefile with Polygon geometries of rasters based on raster band values
convert_geotiff_to_vector_with_threshold(from_threshold, to_threshold, infile, infile_epsg, tmpfile_1, tmpfile_2, outfile)[source]

Convert GeoTiff raster file to Shapefile with geometries based on raster threshold ranges

Parameters
  • from_threshold - Float value of lower bound of GeoTiff threshold value to be selected
  • to_threshold - Float value of upper bound of GeoTiff threshold value to be selected
  • infile - String name of input GeoTff file path
  • infile_epsg - Integer value of EPSG Projection number of raster
  • tmpfile_1 - Stirng name of tmp file 1
  • tmpfile_2 - Stirng name of tmp file 2
  • outfile - Stirng name of output shapefile
Outputs
Shapefile with Polygon geometries of rasters based on raster threshold ranges
glofris_data_details(file_name, root_dir)[source]

Read names of GLOFRIS files and create attributes

Parameters
  • file_name - String name of GeoTff file
  • root_dir - String path to directory of file
Outputs
df - Pandas DataFrame written to csv file with columns:
  • file_name - String
  • hazard_type - String
  • year - Integer: 2016 or 2030
  • climate_scenario - String: RCP4.5 or RCP8.5 or none
  • probability - Float: 1/(return period)
  • banded - Boolean: True or False
  • bands - Integer
main()[source]

Process hazard data

  1. Specify the paths from where to read and write:
    • Input data
    • Hazard data
  2. Supply input data and parameters
    • Thresholds of flood hazards
    • Values of bands to be selected
    • Color code of multi-band rasters
    • Specific file names that might require some specific operations
raster_projections_and_databands(file_path)[source]

Extract projection, data bands numbers and valuees from raster

Parameters
  • file_path - String name of input GeoTff file path
Outputs
  • counts - Number of bans in raster
  • crs - Projection system of raster
  • data_vals - Numpy array of raster values
raster_rewrite(in_raster, out_raster, nodata)[source]

Rewrite a raster to reproject and change no data value

Parameters
  • in_raster - String name of input GeoTff file path
  • out_raster - String name of output GeoTff file path
  • nodata - Float value of data that is treated as no data
Outputs
Reproject and replace raster with nodata = -1

atra.preprocess.multi_modal_network_creation module

atra.preprocess.network_air module

Create air network and passenger usage data for Argentina

main(config)[source]

atra.preprocess.network_road_topology module

atra.preprocess.od_combine module

atra.preprocess.port_od_flows module

atra.preprocess.rail_od_flows module

atra.preprocess.road_bridge_matches module

atra.preprocess.road_network_creation module

atra.preprocess.road_od_flows module

atra.preprocess.scrape_wfs module