Skip to content

Commit

Permalink
Remove no land tracts from map (#1894)
Browse files Browse the repository at this point in the history
remove from map
  • Loading branch information
emma-nechamkin authored Sep 8, 2022
1 parent 426328e commit fb4c484
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions data/data-pipeline/data_pipeline/etl/score/etl_score_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(self, data_source: str = None):
field_names.GEOID_TRACT_FIELD
]
self.GEOMETRY_FIELD_NAME = "geometry"
self.LAND_FIELD_NAME = "ALAND10"

# We will adjust this upwards while there is some fractional value
# in the score. This is a starting value.
Expand All @@ -86,13 +87,22 @@ def extract(self) -> None:
)

logger.info("Reading US GeoJSON (~6 minutes)")
self.geojson_usa_df = gpd.read_file(
full_geojson_usa_df = gpd.read_file(
self.CENSUS_USA_GEOJSON,
dtype={self.GEOID_FIELD_NAME: "string"},
usecols=[self.GEOID_FIELD_NAME, self.GEOMETRY_FIELD_NAME],
usecols=[
self.GEOID_FIELD_NAME,
self.GEOMETRY_FIELD_NAME,
self.LAND_FIELD_NAME,
],
low_memory=False,
)

# We only want to keep tracts to visualize that have non-0 land
self.geojson_usa_df = full_geojson_usa_df[
full_geojson_usa_df[self.LAND_FIELD_NAME] > 0
]

logger.info("Reading score CSV")
self.score_usa_df = pd.read_csv(
self.TILE_SCORE_CSV,
Expand Down

0 comments on commit fb4c484

Please sign in to comment.