Explorar o código

Add pydoit configuration, venv etc

Johannes Gütschow %!s(int64=3) %!d(string=hai) anos
pai
achega
48db83754c
Modificáronse 3 ficheiros con 45 adicións e 0 borrados
  1. 5 0
      .gitignore
  2. 3 0
      code/requirements.txt
  3. 37 0
      dodo.py

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+.idea
+venv
+__pycache__
+.doit.db
+

+ 3 - 0
code/requirements.txt

@@ -0,0 +1,3 @@
+pandas
+primap2
+datalad

+ 37 - 0
dodo.py

@@ -0,0 +1,37 @@
+# define tasks for Climate TRACE data repository
+from doit import get_var
+
+
+# create virtual environment
+def task_setup_venv():
+    """Create virtual environment"""
+    return {
+        'file_dep': ['code/requirements.txt'],
+        'actions': ['python3 -m venv venv',
+                    './venv/bin/pip install --upgrade pip',
+                    './venv/bin/pip install -Ur code/requirements.txt',
+                    'touch venv',],
+        'targets': ['venv'],
+        'verbosity': 2,
+    }
+
+
+# convert inventory
+
+def task_convert_2021():
+    """
+    Convert the 2021 inventory to PRIMAP2 format
+    """
+    return {
+        'targets': [f"data_primap2/2021/ClimateTRACE_Inventory_2021.csv",
+                    f"data_primap2/2021/ClimateTRACE_Inventory_2021.yaml",
+                    f"data_primap2/2021/ClimateTRACE_Inventory_2021.nc"],
+        'actions': [f"datalad run -m 'Convert 2021 inventory to PRIMAP2 format' "
+                    "--explicit "
+                    f"-o data_primap2/2021/ClimateTRACE_Inventory_2021.* "
+                    f"./venv/bin/python code/convert_CT_data_2021.py "],
+        'verbosity': 2,
+        'setup': ['setup_venv'],
+    }
+
+