mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-07-28 14:21:16 -07:00
Remove USVI and Guam territories from data and include/show on map American Samoa and Mariana Islands (#1248)
This updates the tile data so that guam and usvi do not appear in the tiles csv, from issue 1003
This commit is contained in:
parent
43e005cc10
commit
b86450c72b
2 changed files with 22 additions and 2 deletions
|
@ -63,6 +63,9 @@ SCORE_DOWNLOADABLE_ZIP_FILE_PATH = (
|
|||
# Column subsets
|
||||
CENSUS_COUNTIES_COLUMNS = ["USPS", "GEOID", "NAME"]
|
||||
|
||||
# Drop FIPS codes from map
|
||||
DROP_FIPS_CODES = ["66", "78"]
|
||||
|
||||
# Percent prefixes for rounding
|
||||
PERCENT_PREFIXES_SUFFIXES = [
|
||||
"Percent",
|
||||
|
|
|
@ -195,10 +195,11 @@ class PostScoreETL(ExtractTransformLoad):
|
|||
return de_duplicated_df
|
||||
|
||||
def _create_tile_data(
|
||||
self, score_county_state_merged_df: pd.DataFrame
|
||||
self,
|
||||
score_county_state_merged_df: pd.DataFrame,
|
||||
) -> pd.DataFrame:
|
||||
logger.info("Rounding Decimals")
|
||||
|
||||
logger.info("Rounding Decimals")
|
||||
# grab all the keys from tiles score columns
|
||||
tiles_score_column_titles = list(constants.TILES_SCORE_COLUMNS.keys())
|
||||
|
||||
|
@ -207,6 +208,22 @@ class PostScoreETL(ExtractTransformLoad):
|
|||
tiles_score_column_titles
|
||||
].copy()
|
||||
|
||||
# Currently, we do not want USVI or Guam on the map, so this will drop all
|
||||
# rows with the FIPS codes (first two digits of the census tract)
|
||||
logger.info(
|
||||
f"Dropping specified FIPS codes from tile data: {constants.DROP_FIPS_CODES}"
|
||||
)
|
||||
tracts_to_drop = []
|
||||
for fips_code in constants.DROP_FIPS_CODES:
|
||||
tracts_to_drop += score_tiles[
|
||||
score_tiles[field_names.GEOID_TRACT_FIELD].str.startswith(
|
||||
fips_code
|
||||
)
|
||||
][field_names.GEOID_TRACT_FIELD].to_list()
|
||||
score_tiles = score_tiles[
|
||||
~score_tiles[field_names.GEOID_TRACT_FIELD].isin(tracts_to_drop)
|
||||
]
|
||||
|
||||
score_tiles[constants.TILES_SCORE_FLOAT_COLUMNS] = score_tiles[
|
||||
constants.TILES_SCORE_FLOAT_COLUMNS
|
||||
].apply(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue