Skip to content

Commit

Permalink
Remove unnecessary constant from config
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-fred committed Feb 7, 2024
1 parent 897790e commit d11d848
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
3 changes: 0 additions & 3 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ keep_tags:
# Number of slices to cut dataset into -- must be a square number
slice_count: 64

# CRS OSM uses
osm_epsg: 4326

transport:
# if the following data can be sourced/hosted online, remove these config entries and download instead
rehabilitation_costs_path: 'bundled_data/transport/rehabilitation.xlsx'
Expand Down
5 changes: 1 addition & 4 deletions workflow/transport/create_rail_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def get_rehab_costs(row: pd.Series, rehab_costs: pd.DataFrame) -> float:
edges_output_path = snakemake.output["edges"] # type: ignore
slice_number = snakemake.params["slice_number"] # type: ignore
rehabilitation_costs_path = snakemake.config["transport"]["rehabilitation_costs_path"] # type: ignore
osm_epsg = snakemake.config["osm_epsg"] # type: ignore

except NameError:
# If "snakemake" doesn't exist then must be running from the
Expand All @@ -76,7 +75,6 @@ def get_rehab_costs(row: pd.Series, rehab_costs: pd.DataFrame) -> float:
rehabilitation_costs_path,
transport_costs_path,
flow_cost_time_factor,
osm_epsg,
) = sys.argv[1:]

# osm_edges_path = ../../results/geoparquet/tanzania-latest_filter-rail/slice-0_edges.geoparquet
Expand All @@ -86,10 +84,9 @@ def get_rehab_costs(row: pd.Series, rehab_costs: pd.DataFrame) -> float:
# edges_output_path = ../../results/geoparquet/tanzania-latest_filter-rail/slice-0_edges.geoparquet
# slice_number = 0
# rehabilitation_costs_path = ../../bundled_data/rehabilitation.xlsx
# osm_epsg = 4326

slice_number = int(slice_number)
osm_epsg = int(osm_epsg)
osm_epsg = 4326

logging.basicConfig(format="%(asctime)s %(process)d %(filename)s %(message)s", level=logging.INFO)

Expand Down
5 changes: 1 addition & 4 deletions workflow/transport/create_road_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ def get_rehab_costs(row: pd.Series, rehab_costs: pd.DataFrame) -> float:
default_shoulder_width_metres = snakemake.config["transport"]["road"]["default_shoulder_width_metres"] # type: ignore
default_lane_width_metres = snakemake.config["transport"]["road"]["default_lane_width_metres"] # type: ignore
flow_cost_time_factor = snakemake.config["transport"]["road"]["flow_cost_time_factor"] # type: ignore
osm_epsg = snakemake.config["osm_epsg"] # type: ignore

except NameError:
# If "snakemake" doesn't exist then must be running from the
Expand All @@ -382,7 +381,6 @@ def get_rehab_costs(row: pd.Series, rehab_costs: pd.DataFrame) -> float:
default_shoulder_width_metres,
default_lane_width_metres,
flow_cost_time_factor,
osm_epsg,
) = sys.argv[1:]

# osm_edges_path = ../../results/geoparquet/tanzania-latest_filter-road/slice-0.geoparquet
Expand All @@ -397,14 +395,13 @@ def get_rehab_costs(row: pd.Series, rehab_costs: pd.DataFrame) -> float:
# default_shoulder_width_metres = 1.5
# default_lane_width_metres = 3.25
# flow_cost_time_factor = 0.49
# osm_epsg = 4326

# cast script arguments to relevant types where necessary
default_shoulder_width_metres = float(default_shoulder_width_metres)
default_lane_width_metres = float(default_lane_width_metres)
flow_cost_time_factor = float(flow_cost_time_factor)
slice_number = int(slice_number)
osm_epsg = int(osm_epsg)
osm_epsg = 4326

logging.basicConfig(format="%(asctime)s %(process)d %(filename)s %(message)s", level=logging.INFO)

Expand Down

0 comments on commit d11d848

Please sign in to comment.