Browse Source

fix to re_read param in CRF reading routines

Johannes Gütschow 2 years ago
parent
commit
29792400ec

+ 1 - 1
code/UNFCCC_CRF_reader/read_new_UNFCCC_CRF_for_year.py

@@ -11,7 +11,7 @@ parser = argparse.ArgumentParser()
 parser.add_argument('--submission_year', help='Submission round to read', type=int)
 parser.add_argument('--submission_date', help='Date of submission to read', default=None)
 parser.add_argument('--re_read', help='Read data also if already read before',
-                    action='store_false')
+                    action='store_true')
 
 args = parser.parse_args()
 

+ 1 - 1
code/UNFCCC_CRF_reader/read_new_UNFCCC_CRF_for_year_datalad.py

@@ -12,7 +12,7 @@ parser = argparse.ArgumentParser()
 #parser.add_argument('--countries', help='List of country codes', default=None)
 parser.add_argument('--submission_year', help='Submission round to read')
 parser.add_argument('--re_read', help='Read data also if already read before',
-                    action='store_false')
+                    action='store_true')
 
 args = parser.parse_args()
 

+ 11 - 7
dodo.py

@@ -181,14 +181,18 @@ read_config_crf = {
 
 def task_read_unfccc_crf_submission():
     """ Read CRF submission for a country (will re-read if data already present)"""
+    actions =  [
+        f"./venv/bin/python code/UNFCCC_CRF_reader/read_UNFCCC_CRF_submission_datalad.py "
+        f"--country={read_config_crf['country']} "
+        f"--submission_year={read_config_crf['submission_year']} "
+        f"--submission_date={read_config_crf['submission_date']} ",
+        f"./venv/bin/python code/UNFCCC_reader/folder_mapping.py "
+        f"--folder=extracted_data/UNFCCC"
+        ],
+    if read_config_crf["re_read"]:
+        actions[0] = actions[0] + " --re_read"
     return {
-        'actions': [f"./venv/bin/python code/UNFCCC_CRF_reader/read_UNFCCC_CRF_submission_datalad.py "
-                    f"--country={read_config_crf['country']} "
-                    f"--submission_year={read_config_crf['submission_year']} "
-                    f"--submission_date={read_config_crf['submission_date']} ",
-                    f"./venv/bin/python code/UNFCCC_reader/folder_mapping.py "
-                    f"--folder=extracted_data/UNFCCC"
-                    ],
+        'actions': actions,
         'verbosity': 2,
         'setup': ['setup_venv'],
     }