From 48f0a9564533ae52b3c7ee5dcdc8ae4139be29e3 Mon Sep 17 00:00:00 2001 From: sbastiangarzon Date: Tue, 11 May 2021 01:17:10 +0200 Subject: [PATCH 1/4] Documentation and rectangular bbox in export --- CITATION.cff | 14 ++++++++++---- README.md | 2 +- codemeta.json | 17 ++++++++++++++--- docs/source/index.rst | 2 +- geoextent/lib/helpfunctions.py | 2 +- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 907e8133..bc71c418 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -7,18 +7,24 @@ authors: affiliation: Opening Reproducible Research, University of Münster, Münster, Germany email: daniel.nuest@uni-muenster.de website: https://nuest.staff.ifgi.de/ + - family-names: Garzón + given-names: Sebastian + orcid: https://orcid.org/0000-0002-8335-9312 + affiliation: Opening Reproducible Research, University of Münster, Münster, Germany + email: jgarzon@uni-muenster.de + - family-names: Qamaz given-names: Yousef title: "geoextent" -version: 0.3.0 +version: 0.7.1 doi: 10.5281/zenodo.3925693 -date-released: 2020-07-01 +date-released: 2020-05-11 license: MIT url: https://o2r.info/geoextent/ -commit: baf299f304d7ad16533fbb3d74e8ffc0b63cadfa +commit: #todo abstract: "Python library for extracting geospatial extent of files and directories with multiple data formats. This project is developed as part of the DFG-funded research project Opening Reproducible Research (o2r, https://o2r.info)." repository-artifact: https://pypi.org/project/geoextent/0.3.0/ repository-code: https://github.com/o2r-project/geoextent/releases/tag/v0.3.0 identifiers: - type: "swh" - value: "swh:1:rev:6aca93956d5cd6742318fd3ab27bb176b5f8c24b" \ No newline at end of file + value: "swh:1:rev:#todo" diff --git a/README.md b/README.md index 56b8e9d3..e63d6343 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ See [CONTRIBUTING.md](https://github.com/o2r-project/geoextent/blob/master/CONTR ## How to cite -> Nüst, Daniel and Qamaz, Yousef. (2020, July 1). o2r-project/geoextent (Version v0.3.0). Zenodo. https://doi.org/10.5281/zenodo.3925693 +> Nüst, Daniel; Garzón, Sebastian and Qamaz, Yousef. (2021, May 11). o2r-project/geoextent (Version v0.7.1). Zenodo. https://doi.org/10.5281/zenodo.3925693 See also the `CITATION.cff` and `codemeta.json` files in this repository, which can possibly be imported in the reference manager of your choice. diff --git a/codemeta.json b/codemeta.json index 6d4a2d13..44d9ca65 100644 --- a/codemeta.json +++ b/codemeta.json @@ -6,11 +6,11 @@ "contIntegration": "https://travis-ci.org/github/o2r-project/geoextent", "dateCreated": "2019-08-16", "datePublished": "2020-03-25", - "dateModified": "2020-07-01", - "downloadUrl": "https://pypi.org/project/geoextent/0.3.0/", + "dateModified": "2020-05-11", + "downloadUrl": "https://pypi.org/project/geoextent/0.7.1/", "issueTracker": "https://github.com/o2r-project/geoextent/issues", "name": "geoextent", - "version": "0.3.0", + "version": "0.7.1", "identifier": "https://doi.org/10.5281/zenodo.3925693", "description": "Python library for extracting geospatial extent of files and directories with multiple data formats. This project is developed as part of the DFG-funded research project Opening Reproducible Research (o2r, https://o2r.info).", "applicationCategory": "Geoinformatics", @@ -47,6 +47,17 @@ "name": "Opening Reproducible Research, University of Münster, Münster, Germany" } }, + { + "@type": "Person", + "@id": "https://orcid.org/0000-0002-8335-9312", + "givenName": "Sebastian", + "familyName": "Garzón", + "email": "jgarzon@uni-muenster.de", + "affiliation": { + "@type": "Organization", + "name": "Opening Reproducible Research, University of Münster, Münster, Germany" + } + }, { "@type": "Person", "givenName": "Yousef", diff --git a/docs/source/index.rst b/docs/source/index.rst index 23328092..203b52c7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -26,7 +26,7 @@ How to cite :: - Nüst, Daniel and Qamaz, Yousef. (2020, July 1). o2r-project/geoextent (Version v0.3.0). Zenodo. https://doi.org/10.5281/zenodo.3925693 + Nüst, Daniel; Garzón, Sebastian and Qamaz, Yousef. (2021, May 11). o2r-project/geoextent (Version v0.7.1). Zenodo. https://doi.org/10.5281/zenodo.3925693 ------ diff --git a/geoextent/lib/helpfunctions.py b/geoextent/lib/helpfunctions.py index 02eea51f..d150ff49 100644 --- a/geoextent/lib/helpfunctions.py +++ b/geoextent/lib/helpfunctions.py @@ -389,8 +389,8 @@ def transform_bbox(x): ring = ogr.Geometry(ogr.wkbLinearRing) ring.AddPoint(x[0], x[1]) ring.AddPoint(x[2], x[1]) - ring.AddPoint(x[0], x[3]) ring.AddPoint(x[2], x[3]) + ring.AddPoint(x[0], x[3]) ring.CloseRings() # Create polygon poly = ogr.Geometry(ogr.wkbPolygon) From 9f9f22e6c60b4f71ce79d7cb37e09c6789a26e61 Mon Sep 17 00:00:00 2001 From: sbastiangarzon Date: Tue, 11 May 2021 01:47:59 +0200 Subject: [PATCH 2/4] Bump version and add requirements --- geoextent/__init__.py | 2 +- setup.py | 7 ++++++- tests/test_cli.py | 30 +++++++++++++++++++----------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/geoextent/__init__.py b/geoextent/__init__.py index afb0d8cf..9c8f4173 100644 --- a/geoextent/__init__.py +++ b/geoextent/__init__.py @@ -1,3 +1,3 @@ name = "geoextent" -__version__ = '0.7.0' +__version__ = '0.7.1' diff --git a/setup.py b/setup.py index 8944dd3f..39d55238 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,12 @@ 'pygeoj', 'pyshp', 'pygdal', - 'python-dateutil' + 'python-dateutil', + 'pandas', + 'numpy', + 'request', + 'traitlets', + 'wheel' ], entry_points={ "console_scripts": [ diff --git a/tests/test_cli.py b/tests/test_cli.py index 9a67a529..0875dde0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -3,7 +3,7 @@ import sys import pytest import tempfile - +import geoextent from help_functions_test import create_zip, parse_coordinates, tolerance from osgeo import gdal @@ -375,7 +375,7 @@ def test_zenodo_valid_but_removed_repository(script_runner): assert "does not exist" in ret.stderr -def test_zenodo_invalid_DOI_but_removed_repository(script_runner): +def test_zenodo_invalid_doi_but_removed_repository(script_runner): ret = script_runner.run('geoextent', '-b', '-t', 'https://doi.org/10.5281/zenodo.not.exist') assert not ret.success assert "Geoextent can not handle this repository identifier" in ret.stderr @@ -394,14 +394,22 @@ def test_zenodo_valid_but_not_open_access(script_runner): def test_export_relative_path(script_runner): - with tempfile.TemporaryDirectory() as tmp: - relative = "geoextent_output.gpkg" - script_runner.run('geoextent', '-b', '-t', '--output', relative, 'tests/testdata/folders/folder_two_files') - datasource = ogr.Open(relative) - layer = datasource.GetLayer(0) - ext = layer.GetExtent() - bbox = [ext[0], ext[2], ext[1], ext[3]] - os.remove(relative) + relative = "geoextent_output.gpkg" + geo_version = geoextent.__version__ + script_runner.run('geoextent', '-b', '-t', '--output', relative, 'tests/testdata/folders/folder_two_files') + datasource = ogr.Open(relative) + layer = datasource.GetLayer(0) + + for feature in layer: + if feature.GetField("handler") == "geoextent:" + geo_version: + bbox_geom = feature.geometry() + + ext = bbox_geom.GetEnvelope() + is_valid = bbox_geom.IsValid() + bbox = [ext[0], ext[2], ext[1], ext[3]] + os.remove(relative) + + assert is_valid, 'Check that the figure is valid ()' assert bbox == pytest.approx([2.052333, 41.317038, 7.647256, 51.974624], abs=tolerance) @@ -419,7 +427,7 @@ def test_zenodo_valid_doi_repository_wrong_geopackage_extension(script_runner): with pytest.warns(ResourceWarning): with tempfile.NamedTemporaryFile(suffix=".abc") as tmp: ret = script_runner.run('geoextent', '-b', '-t', '--output', tmp.name, - 'https://doi.org/10.5281/zenodo.820562' + 'https://doi.org/10.5281/zenodo.820562' ) assert ret.success, "process should return success" From 8c3af3dad1a533c0af0e159838705ea40ac58457 Mon Sep 17 00:00:00 2001 From: sbastiangarzon Date: Tue, 11 May 2021 12:41:57 +0200 Subject: [PATCH 3/4] Fix intallation --- requirements.txt | 1 - setup.py | 1 - 2 files changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6506f71e..9f4725dd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,5 @@ pyshp python-dateutil pandas numpy -requests traitlets wheel diff --git a/setup.py b/setup.py index 39d55238..9c9ca9ac 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,6 @@ 'python-dateutil', 'pandas', 'numpy', - 'request', 'traitlets', 'wheel' ], From 34e4564f2ac4d583bcaf8ed356d9a30744c7a40f Mon Sep 17 00:00:00 2001 From: sbastiangarzon Date: Tue, 11 May 2021 13:54:32 +0200 Subject: [PATCH 4/4] Add requests --- requirements.txt | 1 + setup.py | 1 + 2 files changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index 9f4725dd..6506f71e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,6 @@ pyshp python-dateutil pandas numpy +requests traitlets wheel diff --git a/setup.py b/setup.py index 9c9ca9ac..e7e30a14 100644 --- a/setup.py +++ b/setup.py @@ -28,6 +28,7 @@ 'pygdal', 'python-dateutil', 'pandas', + 'requests', 'numpy', 'traitlets', 'wheel'