Skip to content

Commit

Permalink
avoiding double downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
frederique-hub committed Dec 8, 2023
1 parent c43e5a4 commit bf101c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions hydromt_fiat/workflows/equity_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ def set_up_state_code(self, state_abbreviation: List[str]):
state_abbreviation : str
Abbreviation of the state for which you want to set up the census data download
"""
states_done = []
for state in state_abbreviation:
self.logger.info(f"The state abbreviation specified is: {state}")
state_obj = getattr(states, state)
self.state_fips.append(state_obj.fips)
if state not in states_done:
self.logger.info(f"The state abbreviation specified is: {state}")
state_obj = getattr(states, state)
self.state_fips.append(state_obj.fips)
states_done.append(state)

def variables_to_download(self):
self.download_variables = ['B01003_001E', 'B19301_001E', 'NAME', 'GEO_ID'] # TODO: later make this a user input?
Expand Down
9 changes: 6 additions & 3 deletions hydromt_fiat/workflows/social_vulnerability_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,13 @@ def set_up_state_code(self, state_abbreviation: List[str]):
state_abbreviation : str
Abbreviation of the state for which you want to set up the census data download
"""
states_done = []
for state in state_abbreviation:
self.logger.info(f"The state abbreviation specified is: {state}")
state_obj = getattr(states, state)
self.state_fips.append(state_obj.fips)
if state not in states_done:
self.logger.info(f"The state abbreviation specified is: {state}")
state_obj = getattr(states, state)
self.state_fips.append(state_obj.fips)
states_done.append(state)


def download_census_data(self, year_data):
Expand Down

0 comments on commit bf101c8

Please sign in to comment.