Contents:
The script regionalization.py creates a regionalized map. It takes in an excel workbook with information about the whole area and each individual region to produce this map.
The map, a legend, and a list of any overlaps between regions are then saved. A formatted map can also be saved if specified by the user.
Run script using:
python regionalization.py
# or
python3 regionalization.py
- regionalization.py
- main script
- user_inputs.py
- used by 'regionalization.py' to interact with user
- individual_region_files.xlsx
- example of the input excel workbook for Canada
Input file: an excel workbook with the following worksheets:
- '[area_name]' -> one sheet
- One sheet with entire area
- Copy pasted .asc file of entire area
- '[region_name]' -> multiple sheets
- Multiple sheets, each with one individual region
- Copy pasted .asc file of regions
- 'list' -> one sheet (OPTIONAL)
- Alternatively, the command line can be used for this input
- One sheet with the list of regions and their number
(numbers in column 1, names in column 2)
- Note: Region names in column 2 must match the names of their corresponding excel worksheet
The user will have to confirm/enter the following inputs into the command line:
- Input Excel File Name
- Area Name
- Regions
- Output File Names
- CSV File Names
- Excel Workbook File Name
The default input file name is "individual_region_files.xlsx", and the user will be asked to confirm or change this name.
Input for this area name should be the same as the name of the excel worksheet for the entire area. If no sheet by this name can be found, user input will be asked for again.
As mentioned under section Input File, there is an optional worksheet 'list'. If this worksheet exists, then the region numbers and regions will be automatically read in by the script. If not, then all regions can be added using the command line. Additionally, the regions can be edited or deleted before being confirmed.
These are the names of the files to which the information will be saved.
As mentioned above, under section Description, each time the program runs, the regionalized map, a legend, and a list of overlaps will be saved as .csv files. The default names are:
- 'map.csv' for the regionalized map
- 'legend.csv' for the list of region numbers and names
- 'overlaps.csv' for the list of cells with overlaps
When indicated, the user can choose whether to save a formatted regionalized map as an excel workbook as well. If this option is chosen, the file name must also be specified.
The default file name is 'formatted_map.xlsx', and the user will be asked to confirm or change this name. Note that this name must be different than the input excel file name, mentioned under section Input Excel File Name.
- .csv file for the map:
- The same nodata value is used for this file as the area map from the original input file
- .csv file for the legend:
- Contains the region number and names that were used in the regionalization
- .csv file for overlaps:
- Contains cell numbers for any cells that had an overlap of regions
- .xlsx file for the formatted map (if applicable):
- The same content as .csv file for the map
- Formatted with a color scale (red, yellow, green)
- Column width is set to be smaller