read_data_set.py 816 B

12345678910111213141516171819202122232425262728293031
  1. """Read selected domains and versions."""
  2. from pathlib import Path
  3. import click
  4. from faostat_data_primap.helper.definitions import domains_and_releases_to_read
  5. from faostat_data_primap.helper.paths import (
  6. extracted_data_path,
  7. )
  8. from faostat_data_primap.read import (
  9. read_data,
  10. )
  11. @click.command()
  12. @click.option("--run_id", default="2024", help="Configuration to run")
  13. @click.option("--save_path", default=None, help="Where to save data in root directory.")
  14. def run(run_id, save_path):
  15. """Prepare and run read data function"""
  16. if not save_path:
  17. save_path = extracted_data_path
  18. else:
  19. save_path = Path(save_path)
  20. read_data(
  21. domains_and_releases_to_read=domains_and_releases_to_read[run_id],
  22. save_path=save_path,
  23. )
  24. if __name__ == "__main__":
  25. run()