Skip to content

Commit

Permalink
Update functionality to include 2022 data
Browse files Browse the repository at this point in the history
  • Loading branch information
mdp0023 committed Jul 1, 2024
1 parent 5eb5feb commit 15bd2e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Binary file modified Travis_County/SVIs/Travis_County_2013_bg_SVI_svi.gpkg
Binary file not shown.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "svinsight"
version = "1.1.0"
version = "1.1.1"
description = "Create social vulnerability index"
authors = ["Matthew Preisser <mattpreisser@gmail.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion svinsight/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__= "1.1.0"
__version__= "1.1.1"

from svinsight.svi import SVInsight
18 changes: 9 additions & 9 deletions svinsight/svi.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ def boundaries_data(self, boundary: str = 'bg', year: int = 2019, overwrite: boo
:return: The boundary data as a GeoDataFrame.
:rtype: gpd.GeoDataFrame
:raises ValueError: If the boundary type is invalid, the year is not between 2013 and 2021, or geoids not properly formatted.
:raises ValueError: If the boundary type is invalid, the year is not between 2013 and 2022, or geoids not properly formatted.
"""

# Validate Variables
self._validate_value(boundary, ['bg', 'tract'], 'boundary')
self._validate_value(year, [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021], 'year')
self._validate_value(year, [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022], 'year')
self._validate_format(boundary, str, 'boundary')
self._validate_format(year, int, 'year')

Expand Down Expand Up @@ -312,15 +312,15 @@ def census_data(self, boundary: str = 'bg', year: int = 2019, interpolate: bool
:param overwrite: Whether to overwrite existing data. Defaults to False.
:type overwrite: bool, optional
:raises ValueError: If the boundary type is invalid or the year is not between 2013 and 2021.
:raises ValueError: If the boundary type is invalid or the year is not between 2013 and 2022.
:raises FileNotFoundError: If the shapefile for the specified boundary and year does not exist.
:return: None
:rtype: None
"""
# Validate Variables
self._validate_value(boundary, ['bg', 'tract'], 'boundary')
self._validate_value(year, [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021], 'year')
self._validate_value(year, [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022], 'year')
self._validate_format(boundary, str, 'boundary')
self._validate_format(year, int, 'year')

Expand Down Expand Up @@ -409,7 +409,7 @@ def add_variable(self, boundary: str, year: int, name:str, num: list, den: list
:type description: str, optional
:raises ValueError: If the variable name already exists.
:raises ValueError: If the boundary type is invalid or the year is not between 2013 and 2021.
:raises ValueError: If the boundary type is invalid or the year is not between 2013 and 2022.
:raises FileNotFoundError: If the raw data file doesn't exist. Run the census_data method first.
:return: None
Expand All @@ -418,7 +418,7 @@ def add_variable(self, boundary: str, year: int, name:str, num: list, den: list

# Validate Variables
self._validate_value(boundary, ['bg', 'tract'], 'boundary')
self._validate_value(year, [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021], 'year')
self._validate_value(year, [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022], 'year')

# if name of variable already exists, raise error
if name in self.all_vars_eqs:
Expand Down Expand Up @@ -530,7 +530,7 @@ def calculate_svi(self, config_file: str, boundary: str = 'bg', year: int = 2019
:type year: int
:returns: None
:raises ValueError: If the boundary type is invalid or the year is not between 2013 and 2021,
:raises ValueError: If the boundary type is invalid or the year is not between 2013 and 2022,
This method reads a configuration file in YAML format, loads the raw data as a dataframe,
calculates the SVI using two different methods, and saves the results to output files.
Expand All @@ -556,7 +556,7 @@ def calculate_svi(self, config_file: str, boundary: str = 'bg', year: int = 2019
"""
# validate inputs
self._validate_value(boundary, ['bg', 'tract'], 'boundary')
self._validate_value(year, [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021], 'year')
self._validate_value(year, [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022], 'year')

# open the configuration file
with open(os.path.join(self.variables, f"{config_file}.yaml")) as stream:
Expand Down Expand Up @@ -773,7 +773,7 @@ def plot_svi(self, plot_option: int, geopackages: list):
:returns: matplotlib figure object
:raises ValueError: If the boundary type is invalid or the year is not between 2013 and 2021,
:raises ValueError: If the boundary type is invalid or the year is not between 2013 and 2022,
This method quickly creates an example SVI plot either by itself or in a comparative format. The plot options and their required information can be found below.
Expand Down

0 comments on commit 15bd2e9

Please sign in to comment.