From 296de43b657bdd671b5e92ecbda3c30a1f9a7d79 Mon Sep 17 00:00:00 2001 From: YONG WOOK KIM Date: Thu, 1 Feb 2024 11:55:29 -0600 Subject: [PATCH] 158 fix documentation container (#159) * Analysisviz added to documentation * Analysisviz added to documentation * test 1 * Test 2 * Test 3 * Test 4 * Test 4 * Test 5 * Test 6 * Test 7 * Test 8 * Test 9 * Test 10 * Test 11 * Test 12 * Test 12 * Test 13 * Test 14 * Test 15 * fixed documentation * lowdered pytest version * pytest lower than 8 * changed pytest version in environment.yml * tested for pytest error #1 * tested for pytest error #2 * change openssl version * change pytest back * only added openssl * bumped up pytest version * fixed pytest * fixing python package error * changed from camel case to underscore --- CHANGELOG.md | 2 ++ docs/source/conf.py | 4 +++- docs/source/modules.rst | 4 ++++ environment.yml | 1 + pyincore_viz/analysisviz.py | 1 + pyincore_viz/geoutil.py | 20 +++++++++----------- pyincore_viz/tabledatasetlistmap.py | 6 ++++++ setup.py | 3 ++- 8 files changed, 28 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8234d65..98bbf37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed - Refactor tornado and eq visualization due to hazard datasets added to model [#154](https://github.com/IN-CORE/pyincore-viz/issues/154) +### Fixed +- Incorrect documentation rendering has been fixed [#158](https://github.com/IN-CORE/pyincore-viz/issues/158) ## [1.9.0] - 2023-12-13 ### Added diff --git a/docs/source/conf.py b/docs/source/conf.py index c84089f..2aa89af 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -90,7 +90,9 @@ # See also: # http://www.sphinx-doc.org/en/stable/ext/autodoc.html#confval-autodoc_mock_importshttps://github.com/sphinx-doc/sphinx/issues/4182 -autodoc_mock_imports = ['pytest', 'rasterstats'] +autodoc_mock_imports = ['pyincore_viz', 'pytest', 'rasterstats'] + + # This value selects what content will be inserted into the main body of an autoclass directive. # The possible values are: diff --git a/docs/source/modules.rst b/docs/source/modules.rst index e178d79..ecd9d6f 100644 --- a/docs/source/modules.rst +++ b/docs/source/modules.rst @@ -16,3 +16,7 @@ tabledatasetlistmap .. autoclass:: tabledatasetlistmap.TableDatasetListMap :members: +analysisviz +=========== +.. autoclass:: analysisviz.AnalysisViz + :members: diff --git a/environment.yml b/environment.yml index 559f94a..8a52593 100644 --- a/environment.yml +++ b/environment.yml @@ -23,3 +23,4 @@ dependencies: - pytest>=3.9.0 - python-jose>=3.0 - rasterio>=1.3.9 + - openssl<=3.2.0 diff --git a/pyincore_viz/analysisviz.py b/pyincore_viz/analysisviz.py index d517063..3e9b3cf 100644 --- a/pyincore_viz/analysisviz.py +++ b/pyincore_viz/analysisviz.py @@ -7,6 +7,7 @@ class AnalysisViz: + """Methods for visualizing analysis.""" @staticmethod def visualize(dataset, **kwargs): diff --git a/pyincore_viz/geoutil.py b/pyincore_viz/geoutil.py index 6d48faf..63ee057 100644 --- a/pyincore_viz/geoutil.py +++ b/pyincore_viz/geoutil.py @@ -18,7 +18,6 @@ import numpy as np import random import json -import contextily as ctx from deprecated.sphinx import deprecated from matplotlib import cm @@ -31,7 +30,7 @@ from pyincore.hazardservice import HazardService from pyincore import Dataset from pyincore import NetworkDataset -from pyincore_viz import globals +from pyincore_viz import globals as pyincore_viz_globals from base64 import b64encode from io import BytesIO from pyincore_viz.plotutil import PlotUtil @@ -39,7 +38,7 @@ from pyincore_viz.helpers.common import get_period_and_demand_from_str, get_demands_for_dataset_hazards from branca.colormap import linear -logger = globals.LOGGER +logger = pyincore_viz_globals.LOGGER class GeoUtil: @@ -72,7 +71,7 @@ def overlay_gdf_with_raster_hazard(gdf, column, raster, category=False, basemap= Args: gdf (obj): Geopandas DataFrame object. column (obj): A column name of gdf to be plot. - hazard_id (str): A raster hazard dataset id to overlay, such as tif or png dataset + raster (str): A raster hazard dataset id to overlay, such as tif or png dataset category (bool): Turn on/off category option. basemap (bool): Turn on/off base map (e.g. openstreetmap). source(obj): source of the Map to be used. examples, ctx.providers.OpenStreetMap.Mapnik (default), @@ -399,7 +398,7 @@ def get_gdf_map(datasets: list): return m @staticmethod - def get_wms_map(datasets: list, wms_url=globals.INCORE_GEOSERVER_WMS_URL, layer_check=False): + def get_wms_map(datasets: list, wms_url=pyincore_viz_globals.INCORE_GEOSERVER_WMS_URL, layer_check=False): """Get a map with WMS layers from list of datasets. Args: @@ -465,7 +464,7 @@ def get_wms_map(datasets: list, wms_url=globals.INCORE_GEOSERVER_WMS_URL, layer_ return m @staticmethod - def get_gdf_wms_map(datasets, wms_datasets, wms_url=globals.INCORE_GEOSERVER_WMS_URL): + def get_gdf_wms_map(datasets, wms_datasets, wms_url=pyincore_viz_globals.INCORE_GEOSERVER_WMS_URL): """Get a map with WMS layers from list of datasets for geopandas and list of datasets for WMS. Args: @@ -477,7 +476,6 @@ def get_gdf_wms_map(datasets, wms_datasets, wms_url=globals.INCORE_GEOSERVER_WMS obj: An ipyleaflet Map. """ - # TODO: how to add a style for each WMS layers (pre-defined styules on WMS server) and gdf layers # (min_lat, min_lon, max_lat, max_lon) @@ -620,14 +618,14 @@ def join_table_dataset_with_source_dataset(dataset, client): return joined_gdf @staticmethod - def plot_table_dataset_list_from_single_source(client, dataset_list=list, column=str, in_source_dataset_id=None): + def plot_table_dataset_list_from_single_source(client, dataset_list, column, in_source_dataset_id=None): """Creates map window with a list of table dataset and source dataset. Args: client (obj): pyincore service Client Object. dataset_list (list): list of table dataset. column (str): column name to be plot. - in_source_dataset_id (str): source dataset id, the dafault is None. + in_source_dataset_id (str): source dataset id, the default is None. Returns: obj: An ipyleaflet Map, GeoUtil.map (ipyleaflet.Map). @@ -671,7 +669,7 @@ def merge_table_dataset_with_field(dataset_list: list, column=str, in_source_dat Args: dataset_list (list): list of table dataset. column (str): column name to be plot. - source_dataset (str): source dataset id, default is None. + in_source_dataset_id (str): source dataset id, default is None. Returns: obj: Pandas dataframe with all dataset joined together with guid. @@ -1370,7 +1368,7 @@ def plot_choropleth_multiple_dataset(dataset_list, field_list, zoom_level=10): field_list (list): A list of fields in the dataset. The order of the list should be matched with the order of dataset list zoom_level (int): Zoom level - + Returns: obj: An ipyleaflet map. diff --git a/pyincore_viz/tabledatasetlistmap.py b/pyincore_viz/tabledatasetlistmap.py index a8a03ff..573c2fe 100644 --- a/pyincore_viz/tabledatasetlistmap.py +++ b/pyincore_viz/tabledatasetlistmap.py @@ -50,6 +50,8 @@ def create_map_widgets(self, title_list, map, inventory_df): Args: title_list (list): A list of the file names in the folder. + Returns: + """ map_dropdown = ipywgt.Dropdown(description='Outputfile - 1', options=title_list, width=500) file_control1 = ipylft.WidgetControl(widget=map_dropdown, position='bottomleft') @@ -81,6 +83,8 @@ def on_button_clicked(self, b): Args: b (action): A button click action for tablemap. + Returns: + """ print('Loading: ', self.map_dropdown.value) key = self.map_dropdown.value @@ -93,6 +97,8 @@ def create_choropleth_layer(self, key): Args: key (str): A selected value from tablemap's layer selection drop down menu. + Returns: + """ # vmax_val = max(self.bldg_data_df[key]) diff --git a/setup.py b/setup.py index 9d74b55..d5219be 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,8 @@ 'pandas>=2.1.2', 'pillow', 'pyincore>=1.11.0', - 'rasterio>=1.3.9' + 'rasterio>=1.3.9', + 'openssl<=3.2.0' ], extras_require={