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

fix IndexError #326

Merged
merged 6 commits into from
Jul 4, 2024
Merged

fix IndexError #326

merged 6 commits into from
Jul 4, 2024

Conversation

doneachh
Copy link
Collaborator

@doneachh doneachh commented Jun 1, 2024

Closes # (if applicable).

Changes proposed in this Pull Request

Checklist

  • I tested my contribution locally and it seems to work fine.
  • Code and workflow changes are sufficiently documented.
  • Newly introduced dependencies are added to envs/environment.yaml and envs/environment.docs.yaml.
  • Changes in configuration options are added in all of config.default.yaml, config.tutorial.yaml, and test/config.test1.yaml.
  • Changes in configuration options are also documented in doc/configtables/*.csv and line references are adjusted in doc/configuration.rst and doc/tutorial.rst.
  • A note for the release notes doc/release_notes.rst is amended in the format of previous release notes, including reference to the requested PR.

@doneachh doneachh linked an issue Jun 1, 2024 that may be closed by this pull request
2 tasks
@doneachh doneachh requested a review from davide-f June 1, 2024 06:00
@doneachh
Copy link
Collaborator Author

doneachh commented Jun 1, 2024

Hi @davide-f ! :)
another bugfix to review. I am not sure, whether we have to set the "." for the cases len(x) <=3 - if not maybe we should check len(x)>3 in the else part as well.

@doneachh
Copy link
Collaborator Author

doneachh commented Jun 2, 2024

decided to check it in the else part as well, as two-digit-codes followed by a dot without anything else are looking pretty wierd ^^

@davide-f
Copy link
Member

davide-f commented Jun 5, 2024

Wow interesting @doneachh, can you explain when that happens? The GADM is 3 code by definition and it has been a bit tested; when running Africa I have not encountered this

@doneachh
Copy link
Collaborator Author

doneachh commented Jun 6, 2024

@davide-f I recieved this error when running Africa - the two config settings which are different to the default config and could probably lead to this are:

  • gadm_level (i tooked 2 instead of 1)
  • hydrogen [network_routes] (i tooked greenfield instead of gas)

@doneachh
Copy link
Collaborator Author

doneachh commented Jun 9, 2024

@davide-f fixed it as discussed - do you have a solution for iterating in case of multiple entries for a country (if thats possible)?
Anyway solving this like that right there, havent fixed #328

Copy link
Member

@davide-f davide-f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies @doneachh , a little comment.

Morever, in this case with layer 0, is the GID_0 column a 3 letter code country or just 2?
Because if it is 2, than we could reverse to 3 letter code here and then the other PR should not be needed. What do you think?

scripts/prepare_gas_network.py Outdated Show resolved Hide resolved
@doneachh
Copy link
Collaborator Author

Apologies @doneachh , a little comment.

Morever, in this case with layer 0, is the GID_0 column a 3 letter code country or just 2? Because if it is 2, than we could reverse to 3 letter code here and then the other PR should not be needed. What do you think?

Its 2 letter code countries - agree! Will change it next week :)

@davide-f
Copy link
Member

davide-f commented Jul 1, 2024

Hello @doneachh , this PR seems pending.
Has this solved the other issue as well? To me it looks good.
If it fixes the other issue as well and you agree, I'd squash and merge it

@doneachh
Copy link
Collaborator Author

doneachh commented Jul 2, 2024

Apologies @doneachh , a little comment.

Morever, in this case with layer 0, is the GID_0 column a 3 letter code country or just 2? Because if it is 2, than we could reverse to 3 letter code here and then the other PR should not be needed. What do you think?

Hi @davide-f !
Still had to integrate the reverse to 3 letter code - but now its integrated.
Received the following error: #354, but i guess this is not due to this PR and a extra error with missing data for mauretania.

@davide-f davide-f merged commit 2b643f4 into main Jul 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IndexError in prepare_gas_network
2 participants