Skip to content

Commit

Permalink
grass.jupyter: Update __init__.py to only necessary modules (#2312)
Browse files Browse the repository at this point in the history
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
  • Loading branch information
chaedri and wenzeslaus committed Apr 26, 2022
1 parent 5190da3 commit 7a0780c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
12 changes: 5 additions & 7 deletions python/grass/jupyter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@
.. _GitHub: https://github.com/OSGeo/grass/blob/main/doc/notebooks/basic_example.ipynb
"""

from .interactivemap import *
from .map import *
from .map3d import *
from .reprojection_renderer import *
from .setup import *
from .timeseriesmap import *
from .utils import *
from .interactivemap import InteractiveMap, Raster, Vector
from .map import Map
from .map3d import Map3D
from .setup import init
from .timeseriesmap import TimeSeriesMap
4 changes: 2 additions & 2 deletions python/grass/jupyter/interactivemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# PURPOSE: This module contains functions for interactive visualizations
# in Jupyter Notebooks.
#
# COPYRIGHT: (C) 2021 Caitlin Haedrich, and by the GRASS Development Team
# COPYRIGHT: (C) 2021-2022 Caitlin Haedrich, and by the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand Down Expand Up @@ -135,7 +135,7 @@ def add_to(self, folium_map):


class InteractiveMap:
"""This class creates interative GRASS maps with folium.
"""This class creates interactive GRASS maps with folium.
Basic Usage:
Expand Down
2 changes: 1 addition & 1 deletion python/grass/jupyter/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# PURPOSE: This module contains functions for non-interactive display
# in Jupyter Notebooks
#
# COPYRIGHT: (C) 2021 Caitlin Haedrich, and by the GRASS Development Team
# COPYRIGHT: (C) 2021-2022 Caitlin Haedrich, and by the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand Down
2 changes: 1 addition & 1 deletion python/grass/jupyter/map3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# PURPOSE: This module contains functions for non-interactive display
# in Jupyter Notebooks
#
# COPYRIGHT: (C) 2021 Vaclav Petras, and by the GRASS Development Team
# COPYRIGHT: (C) 2021-2022 Vaclav Petras, and by the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand Down
8 changes: 4 additions & 4 deletions python/grass/jupyter/tests/reprojection_renderer_test.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
"""Test ReprojectionRenderer functions"""

from pathlib import Path
import grass.jupyter as gj
from grass.jupyter.reprojection_renderer import ReprojectionRenderer


# check get_bbox
def test_get_bbox(simple_dataset):
"""Test that get_bbox returns correct bounding box"""
renderer = gj.ReprojectionRenderer()
renderer = ReprojectionRenderer()
bbox = renderer.get_bbox()
assert bbox == [[90, 180], [-90, -180]]


# render_raster produces filename and new_bounds
def test_render_raster(simple_dataset):
"""Check render_raster returns image and bbox"""
renderer = gj.ReprojectionRenderer()
renderer = ReprojectionRenderer()
filename, bbox = renderer.render_raster(simple_dataset.raster_name)
assert Path(filename).exists()
# Test bounding box is correct
Expand All @@ -26,6 +26,6 @@ def test_render_raster(simple_dataset):
# render_vector produces json
def test_render_vector(simple_dataset):
"""Check render_vector returns file"""
renderer = gj.ReprojectionRenderer()
renderer = ReprojectionRenderer()
filename = renderer.render_vector(simple_dataset.vector_name)
assert Path(filename).exists()
5 changes: 3 additions & 2 deletions python/grass/jupyter/tests/timeseriesmap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
ipywidgets = None

import grass.jupyter as gj
from grass.jupyter.timeseriesmap import collect_layers, fill_none_values


def test_fill_none_values():
"""Test that fill_none_values replaces None with previous value in list"""
names = ["r1", "None", "r3"]
fill_names = gj.fill_none_values(names)
fill_names = fill_none_values(names)
assert fill_names == ["r1", "r1", "r3"]


def test_collect_layers(space_time_raster_dataset):
"""Check that collect layers returns list of layers and dates"""
names, dates = gj.collect_layers(
names, dates = collect_layers(
space_time_raster_dataset.name, fill_gaps=False, element_type="strds"
)
# Test fill_gaps=False at empty time step
Expand Down
2 changes: 1 addition & 1 deletion python/grass/jupyter/timeseriesmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# PURPOSE: This module contains functions for visualizing raster and vector
# space-time datasets in Jupyter Notebooks
#
# COPYRIGHT: (C) 2021 Caitlin Haedrich, and by the GRASS Development Team
# COPYRIGHT: (C) 2022 Caitlin Haedrich, and by the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand Down

0 comments on commit 7a0780c

Please sign in to comment.