Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
push:
branches:
- main
- feature/grid

# Allow the workflow to be manually triggered from the Actions tab.
workflow_dispatch:
Expand Down Expand Up @@ -142,7 +141,9 @@ jobs:
runs-on: ubuntu-latest

# Require a tag push to publish a release distribution.
if: startsWith(github.ref, 'refs/tags/')
# if: >
# startsWith(github.ref, 'refs/tags/')
# || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != '')

# The distribution will only be published if the tests have passed.
needs:
Expand Down Expand Up @@ -173,7 +174,9 @@ jobs:
runs-on: ubuntu-latest

# GitHub releases are only uploaded for release (tagged) distributions.
needs: [deploy-release]
needs:
- deploy-release
- build

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: update-version

# The deployment workflow should only run when changes are merged into the `main` branch.
# Since a branch protection rule prevents directly pushing to `main` this workflow will
# only run on a successful merge request.
on:
# Allow the workflow to be manually triggered from the Actions tab.
workflow_dispatch:
inputs:
tag_name:
description: 'If you want to update the version and release, type an existing or new version tag (eg. 1.2.0)'
required: false
default: ''

jobs:

update-version:
name: Update Version
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != '' }}
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Update version in pyproject.toml
run: |
sed -i "s/^version = .*/version = \"${{ github.event.inputs.tag_name }}\"/" pyproject.toml

- name: Update version in setup.cfg
run: |
sed -i "s/^version = .*/version = ${{ github.event.inputs.tag_name }}/" setup.cfg

- name: Commit and push version update
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pyproject.toml setup.cfg
git commit -m "chore: update version to ${{ github.event.inputs.tag_name }}"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 6 additions & 6 deletions src/hecdss/gridded_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ def range_limit_table(self, minval, maxval, range_, bins, datasize, data):
self.rangeLimitTable[i] = minval + step * i

self.rangeLimitTable[bins - 1] = maxval

# Exceedance
for idx in range(datasize):
for jdx in range(bins):
if data[idx] >= self.rangeLimitTable[jdx]:
self.numberEqualOrExceedingRangeLimit[jdx] += 1
sorted_data = np.sort(data)
n = len(sorted_data)
for jdx in range(bins):
idx = np.searchsorted(sorted_data, self.rangeLimitTable[jdx], side="left")
self.numberEqualOrExceedingRangeLimit[jdx] = n - idx

def update_grid_info(self):
"""
Expand All @@ -135,7 +135,7 @@ def update_grid_info(self):

self.data = np.nan_to_num(self.data, nan=NULL_INT)
self.numberOfRanges = math.floor(1 + 3.322 * math.log10(n) + 1)
flat_data = self.data.flatten()
flat_data = self.data.ravel()
self.range_limit_table(self.minDataValue, self.maxDataValue, bin_range, self.numberOfRanges, n, flat_data)

@staticmethod
Expand Down