dodo.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # define tasks for Climate TRACE data repository
  2. from doit import get_var
  3. # create virtual environment
  4. def task_setup_venv():
  5. """Create virtual environment"""
  6. return {
  7. 'file_dep': ['code/requirements.txt'],
  8. 'actions': ['python3 -m venv venv',
  9. './venv/bin/pip install --upgrade pip',
  10. './venv/bin/pip install -Ur code/requirements.txt',
  11. 'touch venv',],
  12. 'targets': ['venv'],
  13. 'verbosity': 2,
  14. }
  15. # convert inventory
  16. def task_convert_2021():
  17. """
  18. Convert the 2021 inventory to PRIMAP2 format
  19. """
  20. return {
  21. 'targets': [f"data_primap2/2021/ClimateTRACE_Inventory_2021.csv",
  22. f"data_primap2/2021/ClimateTRACE_Inventory_2021.yaml",
  23. f"data_primap2/2021/ClimateTRACE_Inventory_2021.nc"],
  24. 'actions': [f"datalad run -m 'Convert 2021 inventory to PRIMAP2 format' "
  25. "--explicit "
  26. f"-o data_primap2/2021/ClimateTRACE_Inventory_2021.* "
  27. f"./venv/bin/python code/convert_CT_data_2021.py "],
  28. 'verbosity': 2,
  29. 'setup': ['setup_venv'],
  30. }