dodo.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. """
  2. Define tasks to download and read the FAO data set.
  3. """
  4. import datalad.api
  5. def task_download():
  6. """
  7. test datalad target
  8. """
  9. def datalad_run_download():
  10. datalad.api.run(
  11. cmd="python3 scripts/download_all_domains.py",
  12. outputs="downloaded_data",
  13. )
  14. return {"actions": [datalad_run_download]}
  15. def task_read():
  16. """
  17. read data set
  18. """
  19. def read_dataset(save_path, run_id):
  20. print(f"Reading dataset for {save_path=} and {run_id=}")
  21. cmd = (
  22. f"python3 scripts/read_data_set.py "
  23. f"--save_path {save_path} --run_id {run_id}"
  24. )
  25. datalad.api.run(
  26. cmd=cmd,
  27. message="Read data set",
  28. outputs=f"{save_path}",
  29. )
  30. return {
  31. "actions": [read_dataset],
  32. "params": [
  33. {
  34. "name": "save_path",
  35. "short": "s",
  36. "long": "save_path",
  37. "default": "extracted_data",
  38. "help": "Path to save the data.",
  39. },
  40. {
  41. "name": "run_id",
  42. "long": "run_id",
  43. "short": "r",
  44. "default": "2024",
  45. "help": "Run identifier.",
  46. },
  47. ],
  48. "verbosity": 2,
  49. }