Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demand: raise error so that it is caught #12

Merged
merged 6 commits into from
Sep 2, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
demand: fix writing header
  • Loading branch information
petrasovaa committed Jul 22, 2020
commit 69f5ac026b34322c63e102cbb493fe3db4d6da26
4 changes: 2 additions & 2 deletions r.futures/r.futures.demand/r.futures.demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,15 @@ def main():
# write demand
with open(options['demand'], 'w') as f:
header = observed_popul.dtype.names # the order is kept here
header = [sub for sub in header[1:] if sub in subregionIds]
header = [header[0]] + [sub for sub in header[1:] if sub in subregionIds]
f.write(sep.join(header))
f.write('\n')
i = 0
for time in simulation_times[1:]:
f.write(str(int(time)))
f.write(sep)
# put 0 where there are more counties but are not in region
for sub in header: # to keep order of subregions
for sub in header[1:]: # to keep order of subregions
f.write(str(int(demand[sub][i])))
if sub != header[-1]:
f.write(sep)
Expand Down