Repository: ARM-DOE/ACT

Issue:
BUG: Fix QC bug in tests
Now CI is failing due to some bug on ubuntu systems

```bash
def test_qc_flag_description():
[32](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:33)
        """
[33](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:34)
        This will check if the cleanup() method will correctly convert convert
[34](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:35)
        flag_#_description to CF flag_masks and flag_meanings.
[35](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:36)
    
[36](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:37)
        """
[37](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:38)
    
[38](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:39)
        ds = read_netcdf(EXAMPLE_CO2FLX4M)
[39](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:40)
        ds.clean.cleanup()
[40](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:41)
        qc_var_name = ds.qcfilter.check_for_ancillary_qc(
[41](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:42)
            'momentum_flux', add_if_missing=False, cleanup=False
[42](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:43)
        )
[43](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:44)
    
[44](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:45)
        assert isinstance(ds[qc_var_name].attrs['flag_masks'], list)
[45](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:46)
        assert isinstance(ds[qc_var_name].attrs['flag_meanings'], list)
[46](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:47)
        assert isinstance(ds[qc_var_name].attrs['flag_assessments'], list)
[47](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:48)
        assert ds[qc_var_name].attrs['standard_name'] == 'quality_flag'
[48](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:49)
    
[49](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:50)
        assert len(ds[qc_var_name].attrs['flag_masks']) == 9
[50](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:51)
        unique_flag_assessments = list({'Acceptable', 'Indeterminate', 'Bad'})
[51](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:52)
>       assert list(set(ds[qc_var_name].attrs['flag_assessments'])) == unique_flag_assessments
[52](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:53)
E       AssertionError: assert ['Indetermina...table', 'Bad'] == ['Indetermina... 'Acceptable']
[53](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:54)
E         At index 1 diff: 'Acceptable' != 'Bad'
[54](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:55)
E         Full diff:
[55](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:56)
E         - ['Indeterminate', 'Bad', 'Acceptable']
[56](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:57)
E         ?                   -------
[57](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:58)
E         + ['Indeterminate', 'Acceptable', 'Bad']
[58](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:59)
E         ?                               +++++++
[59](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:60)

[60](https://github.com/ARM-DOE/ACT/runs/7508339706?check_suite_focus=true#step:6:61)
act/tests/test_qc.py:814: AssertionError
```


Discussion:
I think it has to do with the ARMLive API looking for the same day of data, setting the start and end time to be the same, which results in 0 results... We will need to add a check for this and some logic to see if two times are the same, to set to the beginning and end of the day.

Resolving patch:
diff --git a/act/discovery/get_armfiles.py b/act/discovery/get_armfiles.py
--- a/act/discovery/get_armfiles.py
+++ b/act/discovery/get_armfiles.py
@@ -7,6 +7,7 @@
 import json
 import os
 import sys
+from datetime import timedelta
 
 try:
     from urllib.request import urlopen
@@ -96,10 +97,15 @@ def download_data(username, token, datastream, startdate, enddate, time=None, ou
     # start and end strings for query_url are constructed
     # if the arguments were provided
     if startdate:
-        start = date_parser(startdate, output_format='%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
+        start_datetime = date_parser(startdate, return_datetime=True)
+        start = start_datetime.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
         start = f'&start={start}'
     if enddate:
-        end = date_parser(enddate, output_format='%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
+        end_datetime = date_parser(enddate, return_datetime=True)
+        # If the start and end date are the same, and a day to the end date
+        if start_datetime == end_datetime:
+            end_datetime += timedelta(days=1)
+        end = end_datetime.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
         end = f'&end={end}'
     # build the url to query the web service using the arguments provided
     query_url = (


Test patch: