Skip to content

Commit

Permalink
158 fix documentation container (#159)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ywkim312 authored Feb 1, 2024
1 parent d2c3939 commit 296de43
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ tabledatasetlistmap
.. autoclass:: tabledatasetlistmap.TableDatasetListMap
:members:

analysisviz
===========
.. autoclass:: analysisviz.AnalysisViz
:members:
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ dependencies:
- pytest>=3.9.0
- python-jose>=3.0
- rasterio>=1.3.9
- openssl<=3.2.0
1 change: 1 addition & 0 deletions pyincore_viz/analysisviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


class AnalysisViz:
"""Methods for visualizing analysis."""

@staticmethod
def visualize(dataset, **kwargs):
Expand Down
20 changes: 9 additions & 11 deletions pyincore_viz/geoutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,15 +30,15 @@
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
from pyincore_viz.tabledatasetlistmap import TableDatasetListMap as table_list_map
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:
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions pyincore_viz/tabledatasetlistmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -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])
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down

0 comments on commit 296de43

Please sign in to comment.