Skip to content

Commit

Permalink
Merge branch 'main' into docs_restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
pesekon2 committed Dec 19, 2024
2 parents 9614f1d + 6930424 commit 59e104b
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
coverage html
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
with:
verbose: true
flags: pytest-python-${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
# renovate: datasource=pypi depName=bandit
BANDIT_VERSION: "1.8.0"
# renovate: datasource=pypi depName=ruff
RUFF_VERSION: "0.8.3"
RUFF_VERSION: "0.8.4"

runs-on: ${{ matrix.os }}
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repos:
)
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.3
rev: v0.8.4
hooks:
# Run the linter.
- id: ruff
Expand Down
22 changes: 13 additions & 9 deletions doc/examples/notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@
### Using the notebooks locally

Clone this repository with `git clone` first. Then, locally start the Jupyter
notebook server from the command line in the `doc/examples/notebooks/` directory containing
the `*.ipynb` files with:
`jupyter notebook`
notebook server from the command line in the `doc/examples/notebooks/`
directory containing the `*.ipynb` files with: `jupyter notebook`

This will open a new browser tab or window with a list of the contents of the current
working directory. Clicking on one of the `*.ipynb` files will start the notebook.
This will open a new browser tab or window with a list of the contents of the
current working directory. Clicking on one of the `*.ipynb` files will start
the notebook.

See also the official documentation for [The Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/latest/).
See also the official documentation for
[The Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/latest/).

### Introductory notebooks to GRASS GIS and Jupyter

* GRASS GIS in Jupyter Notebook with Python and grass.jupyter: [jupyter_example.ipynb](jupyter_example.ipynb)
* GRASS GIS in Jupyter Notebook with Python and grass.jupyter:
[jupyter_example.ipynb](jupyter_example.ipynb)
* The grass.jupyter Package: [jupyter_tutorial.ipynb](jupyter_tutorial.ipynb)

## Thematic Jupyter notebooks

* Viewshed Analysis: [viewshed_analysis.ipynb](viewshed_analysis.ipynb)
* Spatio-Temporal Analysis with grass.jupyter: [temporal.ipynb](temporal.ipynb)
* Solar Energy Potential Analysis: [solar_potential.ipynb](solar_potential.ipynb)
* GRASS GIS Scripting with Python: [scripting_example.ipynb](scripting_example.ipynb)
* Solar Energy Potential Analysis:
[solar_potential.ipynb](solar_potential.ipynb)
* GRASS GIS Scripting with Python:
[scripting_example.ipynb](scripting_example.ipynb)
* Hydrology with GRASS GIS: [hydrology.ipynb](hydrology.ipynb)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ ignore = [
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
# Declare a custom aliases, checked with rule ICN001
"grass.script" = "gs"
"grass.temporal" = "tgis"

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
2 changes: 1 addition & 1 deletion python/grass/temporal/datetime_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ def string_to_datetime(time_string: str) -> datetime | None:
return time_object


def datetime_to_grass_datetime_string(dt: datetime) -> str:
def datetime_to_grass_datetime_string(dt: datetime | None) -> str:
"""Convert a python datetime object into a GRASS datetime string
.. code-block:: python
Expand Down
3 changes: 2 additions & 1 deletion python/grass/temporal/gui_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import grass.script as gs
from grass.exceptions import ScriptError

from .core import get_available_temporal_mapsets, init_dbif
from .factory import dataset_factory
Expand Down Expand Up @@ -45,7 +46,7 @@ def tlist_grouped(type, group_type: bool = False, dbif=None):
for type_ in types:
try:
tlist_result = tlist(type=type_, dbif=dbif)
except gs.ScriptError as e:
except ScriptError as e:
gs.warning(e)
continue

Expand Down
53 changes: 24 additions & 29 deletions python/grass/temporal/testsuite/test_temporal_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import grass.gunittest.case
import grass.gunittest.main
import grass.gunittest.utils

import grass.temporal
import grass.temporal as tgis

doctest.DocFileCase = type(
"DocFileCase", (grass.gunittest.case.TestCase,), dict(doctest.DocFileCase.__dict__)
Expand All @@ -23,35 +22,31 @@

def load_tests(loader, tests, ignore):
grass.gunittest.utils.do_doctest_gettext_workaround()
tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_dataset))
tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_map_dataset))
tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_space_time_dataset))
tests.addTests(doctest.DocTestSuite(grass.temporal.base))
tests.addTests(doctest.DocTestSuite(grass.temporal.core))
tests.addTests(doctest.DocTestSuite(grass.temporal.datetime_math))
tests.addTests(doctest.DocTestSuite(tgis.abstract_dataset))
tests.addTests(doctest.DocTestSuite(tgis.abstract_map_dataset))
tests.addTests(doctest.DocTestSuite(tgis.abstract_space_time_dataset))
tests.addTests(doctest.DocTestSuite(tgis.base))
tests.addTests(doctest.DocTestSuite(tgis.core))
tests.addTests(doctest.DocTestSuite(tgis.datetime_math))
# Unexpected error here
# tests.addTests(doctest.DocTestSuite(grass.temporal.list_stds))
tests.addTests(doctest.DocTestSuite(grass.temporal.metadata))
tests.addTests(doctest.DocTestSuite(grass.temporal.register))
tests.addTests(doctest.DocTestSuite(grass.temporal.space_time_datasets))
tests.addTests(doctest.DocTestSuite(grass.temporal.spatial_extent))
tests.addTests(
doctest.DocTestSuite(grass.temporal.spatial_topology_dataset_connector)
)
tests.addTests(doctest.DocTestSuite(grass.temporal.spatio_temporal_relationships))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_extent))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_granularity))
tests.addTests(
doctest.DocTestSuite(grass.temporal.temporal_topology_dataset_connector)
)
# tests.addTests(doctest.DocTestSuite(tgis.list_stds))
tests.addTests(doctest.DocTestSuite(tgis.metadata))
tests.addTests(doctest.DocTestSuite(tgis.register))
tests.addTests(doctest.DocTestSuite(tgis.space_time_datasets))
tests.addTests(doctest.DocTestSuite(tgis.spatial_extent))
tests.addTests(doctest.DocTestSuite(tgis.spatial_topology_dataset_connector))
tests.addTests(doctest.DocTestSuite(tgis.spatio_temporal_relationships))
tests.addTests(doctest.DocTestSuite(tgis.temporal_extent))
tests.addTests(doctest.DocTestSuite(tgis.temporal_granularity))
tests.addTests(doctest.DocTestSuite(tgis.temporal_topology_dataset_connector))
# Algebra is still very experimental
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_raster3d_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_raster_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_raster_base_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_operator))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_vector_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.c_libraries_interface))
tests.addTests(doctest.DocTestSuite(tgis.temporal_algebra))
tests.addTests(doctest.DocTestSuite(tgis.temporal_raster3d_algebra))
tests.addTests(doctest.DocTestSuite(tgis.temporal_raster_algebra))
tests.addTests(doctest.DocTestSuite(tgis.temporal_raster_base_algebra))
tests.addTests(doctest.DocTestSuite(tgis.temporal_operator))
tests.addTests(doctest.DocTestSuite(tgis.temporal_vector_algebra))
tests.addTests(doctest.DocTestSuite(tgis.c_libraries_interface))
return tests


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ def test_map_function2(self) -> None:
self.assertEqual(D.check_temporal_topology(), True)
self.assertEqual(D.get_granularity(), "1 day")

def test_temporal_select(self) -> None:
"""Testing the temporal select operator."""
def test_temporal_select_same_left_right(self) -> None:
"""Testing the temporal select operator with the same map for left and right."""
tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
tra.parse(expression="R = A : A", basename="r", overwrite=True)

Expand Down

0 comments on commit 59e104b

Please sign in to comment.