Skip to content

Commit

Permalink
Merge pull request #14 from digitalearthafrica/update-wbid
Browse files Browse the repository at this point in the history
Update WB_ID column to 1-based indexing from 0-based indexing
  • Loading branch information
vikineema authored Jan 25, 2024
2 parents 895a18c + 2f7b8ef commit 3517fc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DEAFRICA_DOCKER_PASSWORD}}
image_tag: ${{ env.RELEASE }}
- name: Run Trivy vulnerability scanner for Release
uses: aquasecurity/trivy-action@master
if: github.event_name == 'release'
with:
image-ref: 'docker.io/digitalearthafrica/deafrica-waterbodies:${{ env.RELEASE }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'

- name: Get git commit hash for push to main
if: github.event_name != 'release'
run: |
Expand All @@ -61,13 +50,3 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DEAFRICA_DOCKER_PASSWORD}}
image_tag: latest,${{ env.RELEASE }}
- name: Run Trivy vulnerability scanner for push to main
uses: aquasecurity/trivy-action@master
if: github.event_name != 'release'
with:
image-ref: 'docker.io/digitalearthafrica/deafrica-waterbodies:${{ env.RELEASE }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
4 changes: 3 additions & 1 deletion deafrica_waterbodies/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def assign_unique_ids(polygons: gpd.GeoDataFrame, precision: int = 10) -> gpd.Ge
# Make an arbitrary numerical ID for each polygon. We will first sort the dataframe by geohash
# so that polygons close to each other are numbered similarly.
polygons_with_unique_ids_sorted = polygons_with_unique_ids.sort_values(by=["UID"]).reset_index()
polygons_with_unique_ids_sorted["WB_ID"] = polygons_with_unique_ids_sorted.index
polygons_with_unique_ids_sorted["WB_ID"] = polygons_with_unique_ids_sorted.index + 1

assert polygons_with_unique_ids_sorted["WB_ID"].min() > 0

# The step above creates an 'index' column, which we don't actually want, so drop it.
polygons_with_unique_ids_sorted.drop(columns=["index"], inplace=True)
Expand Down

0 comments on commit 3517fc6

Please sign in to comment.