diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index aa3a034..7f32462 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -36,10 +36,10 @@ jobs: echo "TOKEN=${{ secrets.TEST_PYPI_API_TOKEN }}" >> $GITHUB_ENV fi - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: 3.9 - name: Install dependencies run: | diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index f5a0cab..ed57ed6 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -15,8 +15,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - vars: [ { python-version: '3.8', sleep: '0s' }, { python-version: '3.9', sleep: '60s' } ] -# { python-version: '3.10', sleep: '120s' }, { python-version: '3.11', sleep: '180s' } ] + vars: [ { python-version: '3.9', sleep: '0s' }, { python-version: '3.10', sleep: '60s' }, + { python-version: '3.11', sleep: '120s' }, { python-version: '3.12', sleep: '180s' } ] name: Python ${{ matrix.vars.python-version }} Test steps: - name: Checkout source code diff --git a/.gitignore b/.gitignore index 45558f2..9e2726e 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ tests/.incorepw # incore download data or test data tests/data/ +tests/pyincore_viz/data/ cache_data/ original/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b5f00a..7120217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.9.0] - 2023-12-13 +### Added +- Local hazard visualization [#143](https://github.com/IN-CORE/pyincore-viz/issues/143) + +### Changed +- Clean dependencies [#145](https://github.com/IN-CORE/pyincore-viz/issues/145) + ## [1.8.4] - 2023-11-08 ### Updated - Basemap api updated to use open street map [#138](https://github.com/IN-CORE/pyincore-viz/issues/138) diff --git a/docs/README.md b/docs/README.md index 37bb70b..cf89873 100644 --- a/docs/README.md +++ b/docs/README.md @@ -40,7 +40,7 @@ In case of `conda`, the package management and deployment tool is called `anaconda`. Create the environment from the terminal at the project folder (called `pyincore_viz` here) and activate it: ``` - conda create -n pyincore_viz python=3.7 + conda create -n pyincore_viz python=3.9 conda activate pyincore_viz ``` or diff --git a/docs/source/conf.py b/docs/source/conf.py index 43ad713..c84089f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -31,9 +31,9 @@ author = 'Yong Wook Kim' # The short X.Y version -version = '1.8' +version = '1.9' # The full version, including alpha/beta/rc tags -release = '1.8.4' +release = '1.9.0' # -- General configuration --------------------------------------------------- diff --git a/environment.yml b/environment.yml index f20c310..559f94a 100644 --- a/environment.yml +++ b/environment.yml @@ -8,18 +8,18 @@ dependencies: - branca>=0.3.0 - contextily>=1.0.0 - deprecated - - geopandas>=0.6.1 + - geopandas>=0.14.0 - ipyleaflet>=0.16.0 - ipywidgets>=7.6.0 - lxml>=4.6.3 - - matplotlib>=2.1.0 - - networkx>=2.2 - - numpy>=1.16.1 + - matplotlib>=3.8.0 + - networkx>=3.2.1 + - numpy>=1.26.0,<2.0a0 - owslib>=0.17.1 - - pandas>=0.24.1 + - pandas>=2.1.2 - pillow - pycodestyle>=2.6.0 - pyincore>=1.11.0 - pytest>=3.9.0 - python-jose>=3.0 - - rasterio>=1.3.3 + - rasterio>=1.3.9 diff --git a/pyincore_viz/geoutil.py b/pyincore_viz/geoutil.py index 688375e..fcfe3c2 100644 --- a/pyincore_viz/geoutil.py +++ b/pyincore_viz/geoutil.py @@ -1140,6 +1140,99 @@ def get_ipyleaflet_heatmap(locations=None, radius=10, blur=10, max=1, name=""): return heatmap + @staticmethod + def plot_local_earthquake(eq_dataset): + """ + Plot local earthquake data on the map + """ + demand_type = eq_dataset.demand_type + demand_units = eq_dataset.demand_units + hazard_type = eq_dataset.hazard_type + period = eq_dataset.period + title = "Demand Type: " + demand_type.upper() + ", Demand Units: " + demand_units + ", Period: " + \ + str(period) + ", Hazard Type: " + hazard_type + raster_file_path = eq_dataset.dataset.local_file_path + + GeoUtil.plot_raster_file_with_legend(raster_file_path, title) + + @staticmethod + def plot_local_tsunami(tsu_dataset): + """ + Plot local tsunami data on the map + + args: + tsu_dataset (obj): pyincore TsunamiDataset object + + returns: + none + """ + demand_type = tsu_dataset.demand_type + demand_units = tsu_dataset.demand_units + hazard_type = tsu_dataset.hazard_type + title = "Demand Type: " + demand_type.upper() + ", Demand Units: " + str(demand_units) + \ + ", Hazard Type: " + hazard_type + raster_file_path = tsu_dataset.dataset.local_file_path + + GeoUtil.plot_raster_file_with_legend(raster_file_path, title) + + @staticmethod + def plot_local_flood(flood_dataset): + """ + Plot local tsunami data on the map + + args: + tsu_dataset (obj): pyincore TsunamiDataset object + + returns: + none + """ + demand_type = flood_dataset.demand_type + demand_units = flood_dataset.demand_units + hazard_type = flood_dataset.hazard_type + title = "Demand Type: " + demand_type.upper() + ", Demand Units: " + str(demand_units) + \ + ", Hazard Type: " + hazard_type + raster_file_path = flood_dataset.dataset.local_file_path + + GeoUtil.plot_raster_file_with_legend(raster_file_path, title) + + @staticmethod + def plot_local_hurricane(hur_dataset): + """ + Plot local hurricane data on the map + + args: + hur_dataset (obj): pyincore HurricaneDataset object + + returns: + none + """ + demand_type = hur_dataset.demand_type + demand_units = hur_dataset.demand_units + hazard_type = hur_dataset.hazard_type + title = "Demand Type: " + demand_type.upper() + ", Demand Units: " + str(demand_units) + \ + ", Hazard Type: " + hazard_type + raster_file_path = hur_dataset.dataset.local_file_path + + GeoUtil.plot_raster_file_with_legend(raster_file_path, title) + + @staticmethod + def plot_local_tornado(tornado): + """ + Plot local tornado data on the map + + args: + dataset (obj): pyincore TornadoDataset object + + returns: + outmap (obj): ipyleaflet map object + """ + gdf = tornado.hazardDatasets[0].dataset.get_dataframe_from_shapefile() + id_field = tornado.EF_RATING_FIELD + + outmap = GeoUtil.plot_gdf_map(gdf, id_field) + + return outmap + @staticmethod def plot_multiple_vector_dataset(dataset_list): """Plot multiple vector datasets on the same map. diff --git a/pyincore_viz/globals.py b/pyincore_viz/globals.py index aa8270c..b2d2714 100644 --- a/pyincore_viz/globals.py +++ b/pyincore_viz/globals.py @@ -8,7 +8,7 @@ import logging from logging import config as logging_config -PACKAGE_VERSION = "1.8.4" +PACKAGE_VERSION = "1.9.0" INCORE_GEOSERVER_WMS_URL = "https://incore.ncsa.illinois.edu/geoserver/incore/wms" INCORE_GEOSERVER_DEV_WMS_URL = "https://incore-dev.ncsa.illinois.edu/geoserver/incore/wms" diff --git a/recipes/meta.yaml b/recipes/meta.yaml index fffacb0..3dc4698 100644 --- a/recipes/meta.yaml +++ b/recipes/meta.yaml @@ -1,5 +1,5 @@ {% set name = "pyincore-viz" %} -{% set version = "1.8.4" %} +{% set version = "1.9.0" %} package: name: {{ name|lower }} @@ -22,33 +22,33 @@ build: requirements: build: - - python>=3.6 + - python>=3.9 - pip - - numpy>=1.16.1 + - numpy>=1.26.0,<2.0a0 host: - - python>=3.6 + - python>=3.9 - pip - - numpy>=1.16.1 + - numpy>=1.26.0,<2.0a0 run: - - python>=3.6 + - python>=3.9 - {{ pin_compatible('numpy') }} - gdal - branca>=0.3.0 - contextily>=1.0.0 - deprecated - - geopandas>=0.6.1 + - geopandas>=0.14.0 - ipyleaflet>=0.16.0 - ipywidgets>=7.6.0 - lxml>=4.6.3 - - matplotlib>=2.1.0 - - networkx>=2.2 + - matplotlib>=3.8.0 + - networkx>=3.2.1 - owslib>=0.17.1 - - pandas>=0.24.1 + - pandas>=2.1.2 - pillow - pyincore>=1.11.0 - - rasterio>=1.3.3 + - rasterio>=1.3.9 test: # Python imports diff --git a/requirements.min b/requirements.min index ce79a55..82f572c 100644 --- a/requirements.min +++ b/requirements.min @@ -2,18 +2,18 @@ branca>=0.3.0 contextily>=1.0.0 descartes>=1.1.0 deprecated -geopandas>=0.6.1 +geopandas>=0.14.0 ipyleaflet>=0.16.0 ipywidgets>=7.6.0 lxml>=4.6.3 -matplotlib>=2.1.0 -networkx>=2.2 -numpy>=1.16.1 +matplotlib>=3.8.0 +networkx>=3.2.1 +numpy>=1.26.0,<2.0a0 owslib>=0.17.1 -pandas>=0.24.1 +pandas>=2.1.2 pillow pycodestyle>=2.6.0 pyincore>=1.11.0 pytest>=3.9.0 python-jose>=3.0 -rasterio>=1.3.3 +rasterio>=1.3.9 diff --git a/requirements.txt b/requirements.txt index 31d2d55..3ccfe10 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,18 +2,18 @@ branca>=0.3.0 contextily>=1.0.0 deprecated -geopandas>=0.6.1 +geopandas>=0.14.0 ipyleaflet>=0.16.0 ipywidgets>=7.6.0 lxml>=4.6.3 -matplotlib>=2.1.0 -networkx>=2.2 -numpy>=1.16.1 +matplotlib>=3.8.0 +networkx>=3.2.1 +numpy>=1.26.0,<2.0a0 owslib>=0.17.1 -pandas>=0.24.1 +pandas>=2.1.2 pillow pycodestyle>=2.6.0 pyincore>=1.11.0 pytest>=3.9.0 python-jose>=3.0 -rasterio>=1.3.3 +rasterio>=1.3.9 diff --git a/setup.py b/setup.py index df9988b..9d74b55 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from setuptools import setup, find_packages # version number of pyincore -version = '1.8.4' +version = '1.9.0' with open("README.rst", encoding="utf-8") as f: readme = f.read() @@ -56,18 +56,18 @@ 'branca>=0.3.0', 'contextily>=1.0.0', 'deprecated', - 'geopandas>=0.6.1', + 'geopandas>=0.14.0', 'ipyleaflet>=0.16.0', 'ipywidgets>=7.6.0', 'lxml>=4.6.3', - 'matplotlib>=2.1.0', - 'networkx>=2.2', - 'numpy>=1.16.1', + 'matplotlib>=3.8.0', + 'networkx>=3.2.1', + 'numpy>=1.26.0,<2.0a0', 'owslib>=0.17.1', - 'pandas>=0.24.1', + 'pandas>=2.1.2', 'pillow', 'pyincore>=1.11.0', - 'rasterio>=1.3.3' + 'rasterio>=1.3.9' ], extras_require={