From 07efb3a092b59a068dbcbb030dbc713e0eb19fe1 Mon Sep 17 00:00:00 2001 From: Carl Higgs Date: Tue, 4 Jul 2023 11:34:54 +1000 Subject: [PATCH] updated docker file (and associated version numbers, incremented to 4.4.5, and Docker image) to address #336 and updated test.py to address #337 --- .ghsci_version | 2 +- .test-compose.yml | 2 +- docker-compose.yml | 2 +- docker/Dockerfile | 3 ++- docker/environment.yml | 6 ++---- docker/requirements.txt | 31 ++++++++++++++++--------------- process/tests/tests.py | 37 ++++++++++++++++++++++++++++++++++++- 7 files changed, 59 insertions(+), 24 deletions(-) diff --git a/.ghsci_version b/.ghsci_version index 9e3a9335..fa1ba045 100644 --- a/.ghsci_version +++ b/.ghsci_version @@ -1 +1 @@ -4.4.3 +4.4.5 diff --git a/.test-compose.yml b/.test-compose.yml index 1e1185b8..f58c925a 100644 --- a/.test-compose.yml +++ b/.test-compose.yml @@ -1,7 +1,7 @@ version: "3" services: ghsci: - image: globalhealthyliveablecities/global-indicators:v4.4.2 + image: globalhealthyliveablecities/global-indicators:v4.4.5 container_name: ghsci shm_size: 2g stdin_open: true # docker run -i diff --git a/docker-compose.yml b/docker-compose.yml index 16f90ce0..89fa8c74 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3" services: ghsci: - image: globalhealthyliveablecities/global-indicators:v4.4.2 + image: globalhealthyliveablecities/global-indicators:v4.4.5 container_name: ghsci shm_size: 2g stdin_open: true # docker run -i diff --git a/docker/Dockerfile b/docker/Dockerfile index 7325cbe4..688ae9ee 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -54,7 +54,8 @@ RUN mkdir /env && \ ENV PATH="/env/bin/:$PATH" ENV PROJ_LIB="/env/share/proj" -RUN echo 'alias configure="python configure.py"' >> ~/.bashrc && \ +RUN pip install -e git+https://github.com/wklumpen/gtfs-lite.git#egg=gtfs-lite && \ + echo 'alias configure="python configure.py"' >> ~/.bashrc && \ echo 'alias analysis="python analysis.py"' >> ~/.bashrc && \ echo 'alias generate="python generate.py"' >> ~/.bashrc && \ echo 'alias compare="python compare.py"' >> ~/.bashrc && \ diff --git a/docker/environment.yml b/docker/environment.yml index 8c262553..7ec2d9be 100644 --- a/docker/environment.yml +++ b/docker/environment.yml @@ -3,10 +3,10 @@ channels: - conda-forge dependencies: - python - - osmnx=1.4.* # for constructing network graph from OpenStreetMap using Overpass API + - osmnx=1.5.* # for constructing network graph from OpenStreetMap using Overpass API - fpdf2=2.7.* - sqlalchemy=1.4.* - - nicegui=1.2.23 + - nicegui>=1.2.24 - cryptography=41.0.* - requests=2.31.* - tornado>=6.3.2 @@ -27,5 +27,3 @@ dependencies: - pyyaml - websockets - pip - - pip: - - gtfs-lite diff --git a/docker/requirements.txt b/docker/requirements.txt index b40e3b41..68d84ca9 100644 --- a/docker/requirements.txt +++ b/docker/requirements.txt @@ -13,6 +13,7 @@ beautifulsoup4==4.12.2 bidict==0.22.1 bleach==6.0.0 branca==0.6.0 +Brotli==1.0.9 Cartopy==0.21.1 certifi==2023.5.7 cffi==1.15.1 @@ -34,7 +35,7 @@ decorator==5.1.1 defusedxml==0.7.1 entrypoints==0.4 et-xmlfile==1.1.0 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 executing==1.2.0 fastapi==0.92.0 fastapi-socketio==0.0.10 @@ -55,14 +56,14 @@ h11==0.14.0 idna==3.4 importlib-metadata==6.7.0 importlib-resources==5.12.0 -ipykernel==6.23.3 +ipykernel==6.24.0 ipython==8.14.0 ipywidgets==8.0.6 itsdangerous==2.1.2 jedi==0.18.2 Jinja2==3.1.2 -joblib==1.2.0 -json5==0.9.5 +joblib==1.3.0 +json5==0.9.14 jsonschema==4.17.3 jupyter_client==8.3.0 jupyter_core==5.3.1 @@ -78,14 +79,14 @@ kiwisolver==1.4.4 libpysal==4.7.0 lxml==4.9.2 mapclassify==2.5.0 -markdown2==2.4.8 +markdown2==2.4.9 MarkupSafe==2.1.3 matplotlib==3.7.1 matplotlib-inline==0.1.6 mercantile==1.2.1 mistune==3.0.0 momepy==0.0.0 -munch==3.0.0 +munch==4.0.0 munkres==1.1.4 nbclient==0.8.0 nbconvert==7.6.0 @@ -98,17 +99,17 @@ numexpr==2.8.4 numpy==1.25.0 openpyxl==3.1.2 orjson==3.8.14 -osmnx==1.4.0 +osmnx==1.5.0 overrides==7.3.1 OWSLib==0.29.2 packaging==23.1 pandana==0.6.1 -pandas==2.0.2 +pandas==2.0.3 pandocfilters==1.5.0 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 -Pillow==9.5.0 +Pillow==10.0.0 pip==23.1.2 pkgutil_resolve_name==1.3.10 platformdirs==3.8.0 @@ -123,7 +124,7 @@ ptyprocess==0.7.0 pure-eval==0.2.2 py-cpuinfo==9.0.0 pycparser==2.21 -pydantic==1.10.9 +pydantic==1.10.10 pygeometa==0.15.0 pygeos==0.14 Pygments==2.15.1 @@ -143,13 +144,13 @@ python-socketio==5.8.0 pytz==2023.3 PyYAML==6.0 pyzmq==25.1.0 -rasterio==1.3.7 +rasterio==1.3.8 requests==2.31.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 Rtree==1.0.1 -scikit-learn==1.2.2 -scipy==1.11.0 +scikit-learn==1.3.0 +scipy==1.11.1 Send2Trash==1.8.2 setuptools==68.0.0 shapely==2.0.1 @@ -157,7 +158,7 @@ six==1.16.0 sniffio==1.3.0 snuggs==1.4.7 soupsieve==2.3.2.post1 -SQLAlchemy==1.4.46 +SQLAlchemy==1.4.48 stack-data==0.6.2 starlette==0.25.0 tables==3.8.0 @@ -169,7 +170,7 @@ tomli==2.0.1 tornado==6.3.2 tqdm==4.65.0 traitlets==5.9.0 -typing_extensions==4.6.3 +typing_extensions==4.7.1 typing-utils==0.1.0 tzdata==2023.3 unicodedata2==15.0.0 diff --git a/process/tests/tests.py b/process/tests/tests.py index 34ee09d6..0bc73c26 100644 --- a/process/tests/tests.py +++ b/process/tests/tests.py @@ -25,7 +25,7 @@ import unittest try: - import subprocesses.ghsci + from subprocesses import ghsci project_setup = True except ImportError as e: @@ -45,6 +45,41 @@ def test_project_setup(self): """Check if _project_setup.py imported successfully.""" self.assertTrue(project_setup) + def test_load_example_region(self): + """Load example region.""" + codename = 'example_ES_Las_Palmas_2023' + r = ghsci.Region(codename) + + def test_example_analysis(self): + """Analyse example region.""" + codename = 'example_ES_Las_Palmas_2023' + r = ghsci.Region(codename) + r.analysis() + + def test_example_generate(self): + """Generate resources for example region.""" + codename = 'example_ES_Las_Palmas_2023' + r = ghsci.Region(codename) + r.generate() + + def test_sensitivity(self): + """Test sensitivity analysis of urban intersection parameter.""" + reference = 'example_ES_Las_Palmas_2023' + comparison = 'ES_Las_Palmas_2023_test_not_urbanx' + # create modified version of reference configuration + with open(f'./configuration/regions/{reference}.yml') as file: + configuration = file.read() + configuration = configuration.replace( + 'ghsl_urban_intersection: true', + 'ghsl_urban_intersection: false', + ) + with open(f'./configuration/regions/{comparison}.yml', 'w') as file: + file.write(configuration) + r = ghsci.Region(comparison) + r.analysis() + r.generate() + r.compare(reference, comparison) + def calculate_line_endings(path): """