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

Features/#325 import status2019 #326

Merged
merged 10 commits into from
Oct 23, 2024
Merged

Conversation

CarlosEpia
Copy link

Fixes #325

@CarlosEpia CarlosEpia self-assigned this Oct 1, 2024
@CarlosEpia CarlosEpia marked this pull request as ready for review October 1, 2024 08:43
cts_demand_buildings,
emobility_mit,
]
)

Choose a reason for hiding this comment

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

Why do you need all these dependencies?

Copy link
Author

Choose a reason for hiding this comment

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

These were the dependencies used for the low and medium flexibility scenarios. Since the creation concept of our new scenarios is the same, it makes sense to me to use the same dependencies. Now that you mentioned this, I think it is better to have this import status2019 and the task that creates the new scenarios in the same dataset.

Choose a reason for hiding this comment

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

I am sorry but I don't really get what you want to change.
I think it is fine like this, it might help to make a comment in the code why these dependencies are set.

Copy link
Author

Choose a reason for hiding this comment

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

I meant these changes: 723295a

)

my_env = os.environ.copy()
my_env["PGPASSWORD"] = "data"

Choose a reason for hiding this comment

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

Is there an option to get the password from somewhere else?

Copy link
Author

Choose a reason for hiding this comment

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

Now we can retrieve the password from datasets.yml a83ca47

"-a",
"--single-transaction",
f"--table={table}",
"data_bundle_powerd_data/PoWerD_status2019-v2.backup",

Choose a reason for hiding this comment

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

Can you refer to the already uploaded backup? This way we would upload the same data again, right?

Copy link
Author

Choose a reason for hiding this comment

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

There is a new version of status2019 in Zenodo. Now it is downloaded and used in the same dataset: 2bb1ae0 and 95495d2

database = config_data["--database-name"]
host = config_data["--database-host"]
port = config_data["--database-port"]
user = config_data["--database-user"]

Choose a reason for hiding this comment

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

The password is stored in config_data as well, isn't it? At least it is listed in my config files.

Copy link
Author

Choose a reason for hiding this comment

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

As you mentioned, a parameter called database-password is in the configuration file. But it can be modified anytime by the user, and then it would not match the fixed password that the status2019 has.

Choose a reason for hiding this comment

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

But that is the same for all parameters, isn't it?
Other functions also access the password from there, so it would be a problem anyhow.

Copy link
Author

Choose a reason for hiding this comment

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

If that is the case, shouldn't we take database-password out from the configuration file?

Copy link
Author

Choose a reason for hiding this comment

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

Since I would like to merge this branch before proceeding with the scenario path creation, I will retrieve the password using the database-password parameter in the configuration file, as you suggested.

Copy link
Author

Choose a reason for hiding this comment

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

Change applied in: a7cd357

Choose a reason for hiding this comment

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

Sorry, I completely forgot to reply. Looks good to me!

"""
# Get parameters from config and set download URL
url = sources["url_status2019"]
status2019_path = Path(".") / "PoWerD_status2019.backup"

Choose a reason for hiding this comment

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

Is it okay to have different filenames than in the url? It is called PoWerD_status2019_V2.backup" there. (btw: It is not needed to call the versions of files in zenodo differently. We also don't do that for the other zenodo-uploads to reduce the code-wise changes. It is not possible to change this in your repo, I just mention it for future updates.)

Copy link
Author

Choose a reason for hiding this comment

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

It is not a problem. The file is stored using the provided name.

@CarlosEpia CarlosEpia merged commit b4c5131 into dev Oct 23, 2024
2 checks passed
@CarlosEpia CarlosEpia deleted the features/#325-import-status2019 branch October 23, 2024 13:52
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.

import status2019 from a backup file
2 participants