Skip to content

Commit 321c05e

Browse files
authored
Merge pull request #52 from PermafrostDiscoveryGateway/develop
Develop
2 parents 6d0aaeb + 55751df commit 321c05e

File tree

10 files changed

+329
-60
lines changed

10 files changed

+329
-60
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,7 @@ dmypy.json
129129
.pyre/
130130

131131
# macOS
132-
.DS_Store
132+
.DS_Store
133+
134+
# Poetry
135+
poetry.lock

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"python.testing.pytestArgs": [
3+
"tests"
4+
],
5+
"python.testing.unittestEnabled": false,
6+
"python.testing.pytestEnabled": true
7+
}

CONTRIBUTING.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# Contributing
2+
3+
:tada: First off, thanks for contributing! :tada:
4+
5+
- [Types of contributions](#types-of-contributions)
6+
- [Pull Requests](#pull-requests)
7+
- [Development Workflow](#development-workflow)
8+
- [Release process](#release-process)
9+
- [Testing](#testing)
10+
- [Code style](#code-style)
11+
- [Contributor license agreement](#contributor-license-agreement)
12+
13+
## Types of contributions
14+
15+
We welcome all types of contributions, including bug fixes, feature enhancements,
16+
bug reports, documentation, graphics, and many others. You might consider contributing by:
17+
18+
- Report a bug or request a new feature in our [issue tracker](https://github.com/PermafrostDiscoveryGateway/viz-staging/issues)
19+
- Fix a bug and contribute the code with a Pull Request
20+
- Write or edit some documentation
21+
- Sharing helpful tips or FAQ-type answers to users or future contributors
22+
- ...
23+
24+
This is an open source project, and we welcome full
25+
participation in the project. Contributions are reviewed and suggestions are
26+
made to increase the value of this software to the community. We strive to
27+
incorporate code, documentation, and other useful contributions quickly and
28+
efficiently while maintaining a high-quality software product.
29+
30+
## Pull Requests
31+
We use the pull-request model for contributions. See [GitHub's help on pull-requests](https://help.github.com/articles/about-pull-requests/).
32+
33+
In short:
34+
35+
- add an [issue](https://github.com/PermafrostDiscoveryGateway/viz-staging/issues) describing your planned changes, or add a comment to an existing issue;
36+
- on GitHub, fork the [repository](https://github.com/PermafrostDiscoveryGateway/viz-staging)
37+
- on your computer, clone your forked copy of the repository
38+
- base your work on the `develop` branch and commit your changes
39+
- push your branch to your forked repository, and submit a pull-request
40+
- our team will be notified of your Pull Request and will review your changes
41+
- our team may request changes before we will approve the Pull Request, or we will make them for you
42+
- once the code is reviewed, our team will merge in your changes to `develop` for the next planned release
43+
44+
## Development Workflow
45+
46+
Development is managed through the git repository at https://github.com/PermafrostDiscoveryGateway/viz-staging. The repository is organized into several branches, each with a specific purpose.
47+
48+
**main**. The `main` branch represents the stable branch that is constantly maintained with the current release. It should generally be safe to install and use the `main` branch the same way as binary releases. The version number in all configuration files and the README on the `main` branch follows [semantic versioning](https://semver.org/) and should always be set to the current stable release, for example `2.8.5`.
49+
50+
**develop**. Development takes place on a single branch for integrated development and testing of the set of features
51+
targeting the next release. Commits should only be pushed to this branch once they are ready to be deployed to
52+
production immediately after being pushed. This keeps the `develop` branch in a state of readiness for the next release.
53+
Any unreleased code changes on the `develop` branch represent changes that have been tested and staged for the next
54+
release.
55+
The tip of the `develop` branch always represents the set of features that are awaiting the next release. The develop
56+
branch represents the opportunity to integrate changes from multiple features for integrated testing before release.
57+
58+
Version numbers on the `develop` branch represent either the planned next release number (e.g., `2.9.0`), or the planned next release number with a `beta` designator or release candidate `rc` designator appended as appropriate. For example, `2.8.6-beta1` or `2.9.0-rc1`.
59+
60+
**feature**. To isolate development on a specific set of capabilities, especially if it may be disruptive to other
61+
developers working on the `develop` branch, feature branches should be created.
62+
63+
Feature branches are named as `feature-` + `{issue}` + `-{short-description}`, with `{issue}` being the GitHub issue number related to that new feature. e.g. `feature-23-refactor-storage`.
64+
65+
All `feature-*` branches should be frequently merged with changes from `develop` to
66+
ensure that the branch stays up to date with other features that have
67+
been tested and are awaiting release. Thus, each `feature-*` branch can be tested on its own before it is merged with other features on develop, and afterwards as well. Once a feature is complete and ready for full integration testing, it is generally merged into the `develop` branch after review through a pull request.
68+
69+
**bugfix**. A final branch type are `bugfix` branches, which work the same as feature branches, but fix bugs rather than adding new functionality. Sometimes it is hard to distinguish features from bug fixes, so some repositories may choose to use `feature` branches for both types of change. Bugfix branches are named similarly, following the pattern: `bugfix-` + `{issue}` + `-{short-description}`, with `{issue}` being the GitHub issue number related to that bug. e.g. `bugfix-83-fix-name-display`.
70+
71+
### Development flow overview
72+
73+
```mermaid
74+
%%{init: { 'theme': 'base',
75+
'gitGraph': {
76+
'rotateCommitLabel': false,
77+
'showCommitLabel': false
78+
},
79+
'themeVariables': {
80+
'commitLabelColor': '#ffffffff',
81+
'commitLabelBackground': '#000000'
82+
}
83+
}}%%
84+
gitGraph
85+
commit id: "1" tag: "v1.0.0"
86+
branch develop
87+
checkout develop
88+
commit id: "2"
89+
branch feature-A
90+
commit id: "3"
91+
commit id: "4"
92+
checkout develop
93+
merge feature-A id: "5"
94+
commit id: "6"
95+
commit id: "7"
96+
branch feature-B
97+
commit id: "8"
98+
commit id: "9"
99+
checkout develop
100+
merge feature-B id: "10" type: NORMAL
101+
checkout main
102+
merge develop id: "11" tag: "v1.1.0"
103+
```
104+
105+
## Release process
106+
107+
1. Our release process starts with integration testing in a `develop` branch. Once all
108+
changes that are desired in a release are merged into the `develop` branch, we run
109+
the full set of tests on a clean checkout of the `develop` branch.
110+
2. After testing, the `develop` branch is merged to main, and the `main` branch is tagged with
111+
the new version number (e.g. `2.11.2`). At this point, the tip of the `main` branch will
112+
reflect the new release and the `develop` branch can be fast-forwarded to sync with `main` to
113+
start work on the next release.
114+
3. Releases can be downloaded from the [GitHub releases page](https://github.com/PermafrostDiscoveryGateway/viz-staging/releases).
115+
116+
## Testing
117+
118+
**Unit and integration tests**. We strive for a full suite of `pytest` tests in the `tests` subdirectory.
119+
Any new code developed should include a robust set of tests for each public
120+
method, as well as integration tests from new feature sets. Tests should fully
121+
exercise the feature to ensure that it responds correctly to both good data inputs
122+
and various classes of corrupt or bad data. All tests should pass before submitting a PR
123+
or merging to `develop`.
124+
125+
Tests are automatically run via GitHub Actions. Check the root `README.md` file
126+
for this GitHub Actions status badge and make sure it says "Passing":
127+
128+
## Code style
129+
130+
Code should be written to professional standards to enable clean, well-documented,
131+
readable, and maintainable software. While there has been significant variability
132+
in the coding styles applied historically, new contributions should strive for
133+
clean code formatting. We generally follow PEP8 guidelines for Python code formatting,
134+
typically enforced through the `black` code formatting package.
135+
136+
## Contributor license agreement
137+
138+
In order to clarify the intellectual property license
139+
granted with Contributions from any person or entity, you agree to
140+
a Contributor License Agreement ("CLA") with the Regents of the University of
141+
California (hereafter, the "Regents").
142+
143+
1. Definitions.
144+
"You" (or "Your") shall mean the copyright owner or legal entity
145+
authorized by the copyright owner that is making this Agreement
146+
with the Regents. For legal entities, the entity making a
147+
Contribution and all other entities that control, are controlled
148+
by, or are under common control with that entity are considered to
149+
be a single Contributor. For the purposes of this definition,
150+
"control" means (i) the power, direct or indirect, to cause the
151+
direction or management of such entity, whether by contract or
152+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
153+
outstanding shares, or (iii) beneficial ownership of such entity.
154+
"Contribution" shall mean any original work of authorship,
155+
including any modifications or additions to an existing work, that
156+
is intentionally submitted by You to the Regents for inclusion
157+
in, or documentation of, any of the products owned or managed by
158+
the Regents (the "Work"). For the purposes of this definition,
159+
"submitted" means any form of electronic, verbal, or written
160+
communication sent to the Regents or its representatives,
161+
including but not limited to communication on electronic mailing
162+
lists, source code control systems, and issue tracking systems that
163+
are managed by, or on behalf of, the Regents for the purpose of
164+
discussing and improving the Work, but excluding communication that
165+
is conspicuously marked or otherwise designated in writing by You
166+
as "Not a Contribution."
167+
2. Grant of Copyright License. Subject to the terms and conditions of
168+
this Agreement, You hereby grant to the Regents and to
169+
recipients of software distributed by the Regents a perpetual,
170+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
171+
copyright license to reproduce, prepare derivative works of,
172+
publicly display, publicly perform, sublicense, and distribute Your
173+
Contributions and such derivative works.
174+
3. Grant of Patent License. Subject to the terms and conditions of
175+
this Agreement, You hereby grant to the Regents and to
176+
recipients of software distributed by the Regents a perpetual,
177+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
178+
(except as stated in this section) patent license to make, have
179+
made, use, offer to sell, sell, import, and otherwise transfer the
180+
Work, where such license applies only to those patent claims
181+
licensable by You that are necessarily infringed by Your
182+
Contribution(s) alone or by combination of Your Contribution(s)
183+
with the Work to which such Contribution(s) was submitted. If any
184+
entity institutes patent litigation against You or any other entity
185+
(including a cross-claim or counterclaim in a lawsuit) alleging
186+
that your Contribution, or the Work to which you have contributed,
187+
constitutes direct or contributory patent infringement, then any
188+
patent licenses granted to that entity under this Agreement for
189+
that Contribution or Work shall terminate as of the date such
190+
litigation is filed.
191+
4. You represent that you are legally entitled to grant the above
192+
license. If your employer(s) has rights to intellectual property
193+
that you create that includes your Contributions, you represent
194+
that you have received permission to make Contributions on behalf
195+
of that employer, that your employer has waived such rights for
196+
your Contributions to the Regents, or that your employer has
197+
executed a separate Corporate CLA with the Regents.
198+
5. You represent that each of Your Contributions is Your original
199+
creation (see section 7 for submissions on behalf of others). You
200+
represent that Your Contribution submissions include complete
201+
details of any third-party license or other restriction (including,
202+
but not limited to, related patents and trademarks) of which you
203+
are personally aware and which are associated with any part of Your
204+
Contributions.

README.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
# PDG Staging
1+
# Viz-staging: vector data tiling for geospatial visualization
22

3-
Divides vector files into tiled vector files according to a specified [OGC Two Dimensional Tile Matrix Set](http://docs.opengeospatial.org/is/17-083r2/17-083r2.html) in preparation for processing into other formats in the PDG workflow.
3+
- **Authors**: Robyn Thiessen-Bock ; Juliet Cohen ; Matthew B. Jones ; Kastan Day ; Lauren Walker
4+
- **DOI**: [10.18739/A2RV0D26C](https://ezid.cdlib.org/id/doi:10.18739/A2RV0D26C)
5+
- **License**: [Apache 2](https://opensource.org/license/apache-2-0/)
6+
- [Package source code on GitHub](https://github.com/PermafrostDiscoveryGateway/viz-staging)
7+
- [Submit bugs and feature requests](https://github.com/PermafrostDiscoveryGateway/viz-staging/issues/new)
8+
9+
The `pdgstaging` package divides vector files into tiled vector files according to a specified [OGC Two Dimensional Tile Matrix Set](http://docs.opengeospatial.org/is/17-083r2/17-083r2.html) in preparation for processing into other formats in the Permafrost Discovery Gateway (PDG) workflow.
410

511
![PDG staging summary](docs/images/staging_tldr.png)
612

13+
## Citation
14+
15+
Cite this software as:
16+
17+
> Robyn Thiessen-Bock, Juliet Cohen, Matt Jones, Kastan Day, Lauren Walker. 2023. Viz-staging: vector data tiling for geospatial visualization (version 0.9.1). Arctic Data Center. doi: 10.18739/A2RV0D26C
18+
719
## Install
820

9-
Requires Python version `3.9` and `libspatialindex` or `libspatialindex-dev`
21+
Requires Python version `3.9` or `3.10` and `libspatialindex` or `libspatialindex-dev`
1022

1123
1. Follow the instructions to install [`libspatialindex`](https://libspatialindex.org/en/latest/) or [`libspatialindex-dev`](https://packages.ubuntu.com/bionic/libspatialindex-dev)
12-
2. Make sure that Python version 3.9 is installed (try `which python3.9`).
24+
2. Make sure that Python version 3.9 or 3.10 is installed (try `which python3.9`).
1325
3. Install `pdgstaging` from GitHub repo using pip: `pip install git+https://github.com/PermafrostDiscoveryGateway/viz-staging.git`
1426

1527
## Usage
@@ -20,6 +32,7 @@ Requires Python version `3.9` and `libspatialindex` or `libspatialindex-dev`
2032
- run: `python -m pdgstaging -c '/path/to/config.json'`
2133

2234
**In python:**
35+
2336
```python
2437
import pdgstaging
2538
stager = pdgstaging.TileStager('/path/to/config.json')
@@ -29,6 +42,8 @@ stager.stage_all()
2942
stager.stage('path/to/input/file.shp')
3043
```
3144

45+
See more example code in [`PermafrostDiscoveryGateway/viz-info/helpful-code`](https://github.com/PermafrostDiscoveryGateway/viz-info/tree/main/helpful-code)
46+
3247
## Vector file staging for the PDG tiling pipeline
3348

3449
This repository contains code that prepares vector data (e.g. shapefiles, geopackages) for subsequent steps in the [PDG](https://permafrost.arcticdata.io/) tiling pipeline (such as [viz-3dtiles](https://github.com/PermafrostDiscoveryGateway/viz-3dtiles) and [viz-raster](https://github.com/PermafrostDiscoveryGateway/viz-raster)). The staging step creates output vector files that conform to a specified [OGC Two Dimensional Tile Matrix Set](http://docs.opengeospatial.org/is/17-083r2/17-083r2.html) ("TMS"). Specifically, for each input file, the staging process:
@@ -78,3 +93,29 @@ The staging process will also output a summary CSV file with one row for each ti
7893
- If the deduplication method specified in the configuration is `footprints`, the footprint file(s) are provided with a structure that follows the [docs](https://github.com/PermafrostDiscoveryGateway/viz-staging/blob/main/docs/footprints.md).
7994
- In order for logging to work properly, the node running the script that uses this package has a `/tmp` directory so the `log.log` file can populate there.
8095

96+
## Development
97+
98+
Build and test using poetry and pytest.
99+
100+
- To build, run `poetry build`
101+
- To test, run `pytest` from the root of the package directory
102+
- VS Code configuration is setup to configure tests as well
103+
104+
## License
105+
106+
```
107+
Copyright [2013] [Regents of the University of California]
108+
109+
Licensed under the Apache License, Version 2.0 (the "License");
110+
you may not use this file except in compliance with the License.
111+
You may obtain a copy of the License at
112+
113+
http://www.apache.org/licenses/LICENSE-2.0
114+
115+
Unless required by applicable law or agreed to in writing, software
116+
distributed under the License is distributed on an "AS IS" BASIS,
117+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
118+
See the License for the specific language governing permissions and
119+
limitations under the License.
120+
```
121+

pdgstaging/ConfigManager.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ class ConfigManager():
275275
the intersecting polygons to be considered a duplicate. If
276276
False, then the overlap_tolerance proportion must be True
277277
for only one of the intersecting polygons to be considered
278-
a duplicate. Default is True. Note that with release 0.9.0,
279-
the 'neighbor' method has been not been thoroughly tested
280-
and should not be applied to input data.
278+
a duplicate. Default is True.
281279
- deduplicate_centroid_tolerance : float, optional
282280
For the 'neighbor' deduplication method only. The maximum
283281
distance between the centroids of two polygons to be
@@ -299,8 +297,8 @@ class ConfigManager():
299297
- deduplicate_clip_to_footprint : bool, optional
300298
For the 'footprints' deduplication method only. If True,
301299
then polygons that fall outside the bounds of the
302-
associated footprint will be removed. Default is True for
303-
release version 0.9.0, but will be false for future releases.
300+
associated footprint will be removed. Default is True for this
301+
release, but will be false for future releases.
304302
- deduplicate_clip_method: str, optional
305303
For the 'footprints' deduplication method only, when
306304
deduplicate_clip_to_footprint is True. The method to use to

pdgstaging/Deduplicator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ def deduplicate_by_footprint(
478478
return_intersections : bool, optional
479479
If true, the polygons that represent the intersections between
480480
footprints will be returned. Default is False. Not currently available
481-
in this release 0.9.0. return_intersections is to be integrated again
482-
in future releases.
481+
in this release. return_intersections is to be integrated again
482+
in a future release.
483483
prop_duplicated : str, optional
484484
Defaults to "staging_duplicated". The column name / property to use to
485485
flag duplicates.
@@ -494,7 +494,7 @@ def deduplicate_by_footprint(
494494
`intersections` represents the polygon area where the footprints overlap.
495495
It has not been integrated into the function again since the deduplication
496496
approach changed from returning a dictionary to returning a labeled GDF.
497-
This will be integrated again in releases after 0.9.0.
497+
This will be integrated again in a future release.
498498
"""
499499

500500
logger.info(f"Executing footprint deduplication.")

0 commit comments

Comments
 (0)