Skip to content

Commit bf101c8

Browse files
avoiding double downloading
1 parent c43e5a4 commit bf101c8

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

hydromt_fiat/workflows/equity_data.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ def set_up_state_code(self, state_abbreviation: List[str]):
5252
state_abbreviation : str
5353
Abbreviation of the state for which you want to set up the census data download
5454
"""
55+
states_done = []
5556
for state in state_abbreviation:
56-
self.logger.info(f"The state abbreviation specified is: {state}")
57-
state_obj = getattr(states, state)
58-
self.state_fips.append(state_obj.fips)
57+
if state not in states_done:
58+
self.logger.info(f"The state abbreviation specified is: {state}")
59+
state_obj = getattr(states, state)
60+
self.state_fips.append(state_obj.fips)
61+
states_done.append(state)
5962

6063
def variables_to_download(self):
6164
self.download_variables = ['B01003_001E', 'B19301_001E', 'NAME', 'GEO_ID'] # TODO: later make this a user input?

hydromt_fiat/workflows/social_vulnerability_index.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,13 @@ def set_up_state_code(self, state_abbreviation: List[str]):
141141
state_abbreviation : str
142142
Abbreviation of the state for which you want to set up the census data download
143143
"""
144+
states_done = []
144145
for state in state_abbreviation:
145-
self.logger.info(f"The state abbreviation specified is: {state}")
146-
state_obj = getattr(states, state)
147-
self.state_fips.append(state_obj.fips)
146+
if state not in states_done:
147+
self.logger.info(f"The state abbreviation specified is: {state}")
148+
state_obj = getattr(states, state)
149+
self.state_fips.append(state_obj.fips)
150+
states_done.append(state)
148151

149152

150153
def download_census_data(self, year_data):

0 commit comments

Comments
 (0)