Skip to content

Instantly share code, notes, and snippets.

@Spaxe
Created March 30, 2016 00:17
Show Gist options
  • Save Spaxe/042b2d7f5c5b0a11d0d6315f4008cad7 to your computer and use it in GitHub Desktop.
Save Spaxe/042b2d7f5c5b0a11d0d6315f4008cad7 to your computer and use it in GitHub Desktop.
./check-code.sh
+ pep8 tests integration_tests --max-line-length 120
+ pylint -j 2 --reports no datacube examples/band_stats.py
+ py.test -r sx --cov datacube --durations=5 datacube examples tests
============================================ test session starts ============================================
platform darwin -- Python 2.7.11, pytest-2.9.0, py-1.4.31, pluggy-0.3.1
rootdir: /Users/ho03b/dev/agdc-v2, inifile: pytest.ini
plugins: cov-2.2.1
collected 98 items
datacube/model.py ....
datacube/index/fields.py ..
datacube/index/postgres/_api.py .
datacube/index/postgres/tables/_core.py .
datacube/storage/access/indexing.py ...
datacube/ui/click.py .
datacube/ui/common.py .
tests/test_api.py FFFFF......
tests/test_common.py ..
tests/test_config.py ...
tests/test_model.py ....
tests/analytics_execution_engine/test_analyics_execution_engine.py .......x....
tests/analytics_execution_engine/test_ndexpr.py ...
tests/index/test_api_index_dataset.py ....
tests/index/test_fields.py .
tests/index/test_query.py ....
tests/index/test_validate_storage_type.py .........................
tests/scripts/test_search_tool.py ..
tests/storage/test_access.py ......
tests/storage/test_netcdfwriter.py .......
tests/storage/test_storage.py .
----------------------------- coverage: platform darwin, python 2.7.11-final-0 ------------------------------
Name Stmts Miss Cover
------------------------------------------------------------------
datacube/__init__.py 3 0 100%
datacube/analytics/__init__.py 0 0 100%
datacube/analytics/analytics_engine.py 229 49 79%
datacube/analytics/utils/__init__.py 0 0 100%
datacube/analytics/utils/analytics_utils.py 96 75 22%
datacube/api/__init__.py 4 0 100%
datacube/api/_api.py 239 152 36%
datacube/api/_conversion.py 159 49 69%
datacube/api/_dask.py 52 1 98%
datacube/api/_storage.py 108 49 55%
datacube/api/_stratify.py 76 10 87%
datacube/api/geo_xarray.py 96 79 18%
datacube/compat.py 42 22 48%
datacube/config.py 38 11 71%
datacube/execution/__init__.py 0 0 100%
datacube/execution/execution_engine.py 138 11 92%
datacube/executor.py 62 43 31%
datacube/index/__init__.py 4 0 100%
datacube/index/_api.py 29 13 55%
datacube/index/_datasets.py 139 75 46%
datacube/index/_storage.py 108 63 42%
datacube/index/fields.py 55 8 85%
datacube/index/postgres/__init__.py 4 0 100%
datacube/index/postgres/_api.py 255 174 32%
datacube/index/postgres/_fields.py 114 34 70%
datacube/index/postgres/tables/__init__.py 6 0 100%
datacube/index/postgres/tables/_core.py 36 12 67%
datacube/index/postgres/tables/_dataset.py 14 0 100%
datacube/index/postgres/tables/_storage.py 11 0 100%
datacube/ingest.py 58 40 31%
datacube/model.py 294 114 61%
datacube/ndexpr/__init__.py 337 44 87%
datacube/scripts/__init__.py 0 0 100%
datacube/scripts/config_tool.py 66 34 48%
datacube/scripts/ingest_storage_units.py 52 30 42%
datacube/scripts/run_ingest.py 90 57 37%
datacube/scripts/search_tool.py 62 6 90%
datacube/storage/__init__.py 4 0 100%
datacube/storage/access/__init__.py 1 0 100%
datacube/storage/access/backends/__init__.py 10 4 60%
datacube/storage/access/backends/faux.py 17 0 100%
datacube/storage/access/backends/geobox.py 27 0 100%
datacube/storage/access/backends/geotif.py 29 1 97%
datacube/storage/access/backends/netcdf.py 90 18 80%
datacube/storage/access/core.py 169 28 83%
datacube/storage/access/ghetto.py 17 10 41%
datacube/storage/access/indexing.py 30 2 93%
datacube/storage/netcdf_safestrings.py 38 2 95%
datacube/storage/netcdf_writer.py 121 5 96%
datacube/storage/storage.py 177 113 36%
datacube/storage/tiling.py 42 33 21%
datacube/ui/__init__.py 5 0 100%
datacube/ui/click.py 58 28 52%
datacube/ui/common.py 47 13 72%
datacube/ui/expression.py 66 8 88%
datacube/utils.py 13 2 85%
datacube/version.py 48 14 71%
------------------------------------------------------------------
TOTAL 4085 1536 62%
========================================== short test summary info ==========================================
XFAIL tests/analytics_execution_engine/test_analyics_execution_engine.py::test_perform_ndvi_mask_old_version
Unknown error, mask ending up as float32, needs further research
========================================= slowest 5 test durations ==========================================
0.59s call tests/analytics_execution_engine/test_ndexpr.py::test_2
0.29s call tests/analytics_execution_engine/test_analyics_execution_engine.py::test_bit_of_everything
0.09s call tests/analytics_execution_engine/test_analyics_execution_engine.py::test_perform_ndvi_mask
0.06s call tests/storage/test_access.py::test_netcdf_storage_unit
0.05s call tests/analytics_execution_engine/test_analyics_execution_engine.py::test_perform_ndvi
================================================= FAILURES ==================================================
_______________________________ test_convert_descriptor_query_to_search_query _______________________________
def test_convert_descriptor_query_to_search_query():
descriptor_query = {
'dimensions': {
'latitude': {
'range': (-35.5, -36.5),
},
'longitude': {
'range': (148.3, 149.9)
},
'time': {
'range': (datetime.datetime(2001, 5, 7), datetime.datetime(2002, 3, 9))
}
}
}
descriptor_query_dimensions = descriptor_query.get('dimensions', {})
search_query = convert_descriptor_dims_to_search_dims(descriptor_query_dimensions)
> assert len(search_query) == len(descriptor_query_dimensions)
E assert 1 == 3
E + where 1 = len({'time': Range(begin=datetime.datetime(2001, 5, 7, 0, 0, tzinfo=tzutc()), end=datetime.datetime(2002, 3, 9, 0, 0, tzinfo=tzutc()))})
E + and 3 = len({'latitude': {'range': (-35.5, -36.5)}, 'longitude': {'range': (148.3, 149.9)}, 'time': {'range': (datetime.datetime(2001, 5, 7, 0, 0), datetime.datetime(2002, 3, 9, 0, 0))}})
tests/test_api.py:52: AssertionError
------------------------------------------- Captured stderr call --------------------------------------------
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
No handlers could be found for logger "datacube.api._conversion"
_____________________ test_convert_descriptor_query_to_search_query_with_crs_conversion _____________________
def test_convert_descriptor_query_to_search_query_with_crs_conversion():
descriptor_query = {
'dimensions': {
'latitude': {
'range': (-3971790.0737348166, -4101004.3359463234),
'crs': 'EPSG:3577',
},
'longitude': {
'range': (1458629.8414059384, 1616407.8831088375),
'crs': 'EPSG:3577',
}
}
}
expected_result = {
'lat': Range(-36.67155581104, -35.3276406574),
'lon': Range(148.1454080502, 150.070966205676),
}
descriptor_query_dimensions = descriptor_query.get('dimensions', {})
search_query = convert_descriptor_dims_to_search_dims(descriptor_query_dimensions)
> assert all(map(isclose, search_query['lat'], expected_result['lat']))
E KeyError: 'lat'
tests/test_api.py:80: KeyError
------------------------------------------- Captured stderr call --------------------------------------------
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
______________________ test_convert_descriptor_query_to_search_query_with_single_value ______________________
def test_convert_descriptor_query_to_search_query_with_single_value():
descriptor_query = {
'dimensions': {
'latitude': {
'range': -3971790.0737348166,
'crs': 'EPSG:3577',
},
'longitude': {
'range': 1458629.8414059384,
'crs': 'EPSG:3577',
}
}
}
expected_lat = -35.5160917746369
expected_lon = 148.145408285529885
descriptor_query_dimensions = descriptor_query.get('dimensions', {})
search_query = convert_descriptor_dims_to_search_dims(descriptor_query_dimensions)
> assert min(*search_query['lat']) <= expected_lat <= max(*search_query['lat'])
E KeyError: 'lat'
tests/test_api.py:101: KeyError
------------------------------------------- Captured stderr call --------------------------------------------
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
_______________________________ test_convert_descriptor_dims_to_selector_dims _______________________________
def test_convert_descriptor_dims_to_selector_dims():
storage_crs = 'EPSG:3577'
descriptor_query = {
'dimensions': {
'x': {
'range': (148.3, 149.9),
},
'y': {
'range': (-35.5, -36.5),
}
}
}
storage_selector = {
'y': {
'range': (-3971790.0737348166, -4101004.3359463234)
},
'x': {
'range': (1458629.8414059384, 1616407.8831088375)
}
}
descriptor_query_dimensions = descriptor_query.get('dimensions', {})
selector_dims = convert_descriptor_dims_to_selector_dims(descriptor_query_dimensions, storage_crs)
assert len(selector_dims) == len(descriptor_query_dimensions)
> assert isclose(selector_dims['x']['range'][0], storage_selector['x']['range'][0])
E KeyError: 'range'
tests/test_api.py:130: KeyError
------------------------------------------- Captured stderr call --------------------------------------------
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
______________________ test_convert_descriptor_dims_to_selector_dims_with_single_value ______________________
def test_convert_descriptor_dims_to_selector_dims_with_single_value():
storage_crs = 'EPSG:3577'
descriptor_query = {
'dimensions': {
'x': {
'range': 148.3,
},
'y': {
'range': -35.5,
}
}
}
descriptor_query_dimensions = descriptor_query.get('dimensions', {})
selector_dims = convert_descriptor_dims_to_selector_dims(descriptor_query_dimensions, storage_crs)
> assert isclose(selector_dims['x']['range'], 1472748.1820625546)
E KeyError: 'range'
tests/test_api.py:150: KeyError
------------------------------------------- Captured stderr call --------------------------------------------
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
============================== 5 failed, 92 passed, 1 xfailed in 5.46 seconds ===============================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment