-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from CIAT-DAPA/develop
Develop
- Loading branch information
Showing
8 changed files
with
231 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Devops WRF Postprocessing | ||
|
||
on: | ||
push: | ||
branches: [ "stage" ] | ||
tags: | ||
- 'v*' | ||
|
||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
|
||
# ------- START Scripts PROCCESS -------- # | ||
|
||
TestScripts: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.9" | ||
- name: Create environment | ||
run: | | ||
python -m venv venv | ||
- name: Active environment | ||
run: | | ||
source venv/bin/activate | ||
- name: Install dependencies | ||
run: | | ||
pip install -r ./requirements.txt | ||
# - name: Run Tests | ||
# run: | | ||
# python -m unittest discover -s ./test/ | ||
|
||
|
||
# ------- END Scripts PROCCESS -------- # | ||
|
||
# ------- START MERGE PROCCESS -------- # | ||
|
||
MergeMainScripts: | ||
needs: TestScripts | ||
name: Merge Stage with main | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Merge stage -> main | ||
uses: devmasx/merge-branch@master | ||
with: | ||
type: now | ||
head_to_merge: ${{ github.ref }} | ||
target_branch: main | ||
github_token: ${{ github.token }} | ||
|
||
# ------- END MERGE PROCCESS -------- # | ||
|
||
# ------- START RELEASE PROCCESS -------- # | ||
|
||
PostRelease: | ||
needs: MergeMainScripts | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: '0' | ||
# Scripts Zip | ||
- name: Zip artifact for deployment | ||
run: zip releaseScripts.zip ./src/* -r | ||
# Upload Artifacts | ||
- name: Upload Scripts artifact for deployment job | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Scripts | ||
path: releaseScripts.zip | ||
# Generate Tagname | ||
- name: Generate Tagname for release | ||
id: taggerDryRun | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: true | ||
DRY_RUN: true | ||
DEFAULT_BUMP: patch | ||
RELEASE_BRANCHES : stage,main | ||
BRANCH_HISTORY: last | ||
# Create release | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
tag_name: ${{ steps.taggerDryRun.outputs.new_tag }} | ||
release_name: Release ${{ steps.taggerDryRun.outputs.new_tag }} | ||
#body_path: ./body.md | ||
body: ${{ github.event.head_commit.message }} | ||
draft: false | ||
prerelease: false | ||
# Upload Assets to release | ||
- name: Upload Release Asset Scripts | ||
id: upload-scripts-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./releaseScripts.zip | ||
asset_name: releaseScripts.zip | ||
asset_content_type: application/zip | ||
# update version setup.py | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
- name: Update version | ||
run: | | ||
sed -i "s/version='.*'/version='${{ steps.taggerDryRun.outputs.new_tag }}'/" setup.py | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: "Update version to ${{ steps.taggerDryRun.outputs.new_tag }}" | ||
|
||
# ------- END RELEASE PROCCESS -------- # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name="agrilac_wrf_postprocessing", | ||
version='v0.0.1', | ||
author="stevensotelo", | ||
author_email="[email protected]", | ||
description="Postprocessing wrf outputs", | ||
url="https://github.com/CIAT-DAPA/agrilac_wrf_postprocessing", | ||
download_url="https://github.com/CIAT-DAPA/agrilac_wrf_postprocessing", | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
keywords='postprocessing wrf rasters', | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires=">=3.9", | ||
entry_points={ | ||
'console_scripts': [ | ||
'wrf_postprocessing=postprocessing.main:main', | ||
], | ||
}, | ||
install_requires=[ | ||
"certifi==2024.6.2", | ||
"cftime==1.6.4", | ||
"click==8.1.7", | ||
"click-plugins==1.1.1", | ||
"cligj==0.7.2", | ||
"colorama==0.4.6", | ||
"contourpy==1.2.1", | ||
"cycler==0.12.1", | ||
"fiona==1.9.6", | ||
"fonttools==4.53.0", | ||
"geopandas==0.14.4", | ||
"kiwisolver==1.4.5", | ||
"matplotlib==3.9.0", | ||
"netCDF4==1.7.1", | ||
"numpy==2.0.0", | ||
"packaging==24.1", | ||
"pandas==2.2.2", | ||
"pillow==10.3.0", | ||
"pyparsing==3.1.2", | ||
"pyproj==3.6.1", | ||
"python-dateutil==2.9.0.post0", | ||
"pytz==2024.1", | ||
"rasterio==1.3.10", | ||
"shapely==2.0.4", | ||
"six==1.16.0", | ||
"snuggs==1.4.7", | ||
"tzdata==2024.1" | ||
] | ||
) |
Empty file.
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import argparse | ||
|
||
from extract_data import extract_data | ||
|
||
def main(): | ||
|
||
parser = argparse.ArgumentParser(description="Resampling script") | ||
|
||
parser.add_argument("-i", "--inputs", help="Inputs path", required=True) | ||
parser.add_argument("-o", "--outputs", help="Outputs path", required=True) | ||
|
||
|
||
args = parser.parse_args() | ||
|
||
print("Reading inputs") | ||
print(args) | ||
|
||
input_path = args.inputs | ||
output_path = args.outputs | ||
|
||
postp = extract_data(input_path, output_path) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
|
||
#python resampling.py "ETHIOPIA" "D:\\CIAT\\Code\\USAID\\aclimate_resampling\\data\\" "-1" 2 2023 |