diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8850430..ceec429 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,9 +67,8 @@ jobs: pip3 install -r requirements-dev.txt pip3 install -r requirements-provider.txt python3 setup.py install + pip3 install --upgrade numpy #pip3 install --upgrade rasterio==1.1.8 - - name: run flake8 ⚙️ - run: find . -type f -name "*.py" | xargs flake8 - name: setup test data ⚙️ run: | python3 tests/load_es_data.py tests/data/ne_110m_populated_places_simple.geojson geonameid @@ -106,6 +105,8 @@ jobs: pytest tests/test_util.py pytest tests/test_xarray_netcdf_provider.py pytest tests/test_xarray_zarr_provider.py + - name: run flake8 ⚙️ + run: find . -type f -name "*.py" | xargs flake8 - name: build docs 🏗️ run: cd docs && make html - name: failed tests 🚩 diff --git a/pygeoapi/provider/xarray_.py b/pygeoapi/provider/xarray_.py index 64b1cc1..e80a353 100644 --- a/pygeoapi/provider/xarray_.py +++ b/pygeoapi/provider/xarray_.py @@ -556,9 +556,15 @@ def _to_datetime_string(datetime_obj): try: value = np.datetime_as_string(datetime_obj) + except TypeError as err: + LOGGER.warning(err) + if datetime_obj.microsecond != 0: + value = datetime_obj.strftime('%Y-%m-%dT%H:%M:%S.%fZ') + else: + value = datetime_obj.strftime('%Y-%m-%dT%H:%M:%SZ') except Exception as err: LOGGER.warning(err) - value = datetime_obj.strftime('%Y-%m-%dT%H:%M:%S.%fZ') + raise RuntimeError(err) return value