-
Notifications
You must be signed in to change notification settings - Fork 4
Use shapely to match centroid to catchment polygon #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Include all JSON files in the resources directory and its subdirectories | ||
| recursive-include src/pyromb/resources *.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| @echo off | ||
| setlocal | ||
|
|
||
| REM Verify Python and Pip paths | ||
| echo Using Python from: | ||
| where python | ||
| echo Using pip from: | ||
| where pip | ||
|
|
||
| REM Check setuptools version | ||
| python -m pip show setuptools | ||
|
|
||
| REM Upgrade setuptools and wheel | ||
| echo Upgrading setuptools and wheel... | ||
| python -m pip install --upgrade setuptools wheel | ||
|
|
||
| REM Define the directory where the package will be stored | ||
| set "PACKAGE_DIR=%~dp0dist" | ||
| echo Package directory: %PACKAGE_DIR% | ||
|
|
||
| REM Navigate to the directory containing the setup.py script | ||
| cd /d "%~dp0" | ||
|
|
||
| REM Clean previous builds | ||
| if exist "%PACKAGE_DIR%" ( | ||
| echo Cleaning previous builds... | ||
| rmdir /s /q "%PACKAGE_DIR%" | ||
| ) | ||
|
|
||
| REM Build the source distribution and wheel using setuptools | ||
| echo Building the package using setuptools... | ||
| python setup.py sdist bdist_wheel | ||
|
|
||
| REM Check if the build was successful | ||
| if %ERRORLEVEL% neq 0 ( | ||
| echo Build failed. Please check the setup.py and pyproject.toml for errors. | ||
| endlocal | ||
| pause | ||
| goto :EOF | ||
| ) | ||
|
|
||
| REM Create the dist directory if it doesn't exist | ||
| if not exist "%PACKAGE_DIR%" mkdir "%PACKAGE_DIR%" | ||
|
|
||
| REM Move the generated .tar.gz and .whl files to the desired folder | ||
| echo Moving built packages to %PACKAGE_DIR%... | ||
| move /Y "dist\*.tar.gz" "%PACKAGE_DIR%" >nul | ||
| move /Y "dist\*.whl" "%PACKAGE_DIR%" >nul | ||
|
|
||
| REM Check if the move was successful | ||
| if %ERRORLEVEL% neq 0 ( | ||
| echo Failed to move the package to the destination folder. | ||
| endlocal | ||
| pause | ||
| goto :EOF | ||
| ) | ||
|
|
||
| echo Package created and moved to %PACKAGE_DIR% successfully. | ||
| endlocal | ||
| pause | ||
| goto :EOF |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| @echo off | ||
| setlocal | ||
|
|
||
| REM THIS DIDN'T SEEM TO WORK, LIKELY USER ERROR. | ||
|
|
||
| REM Activate OSGeo4W environment | ||
| call "C:\OSGEO4W\bin\o4w_env.bat" | ||
|
|
||
| REM Define the directory where the built package is stored | ||
| set "PACKAGE_DIR=%~dp0dist" | ||
| echo Package directory: %PACKAGE_DIR% | ||
|
|
||
| REM Find the latest version of the package | ||
| for /f "delims=" %%i in ('dir /b /o-n "%PACKAGE_DIR%\pyromb-*.whl"') do ( | ||
| set "LATEST_PACKAGE=%%i" | ||
| goto found | ||
| ) | ||
|
|
||
| :found | ||
| if "%LATEST_PACKAGE%"=="" ( | ||
| echo No package found in the directory. | ||
| pause | ||
| endlocal | ||
| goto :EOF | ||
| ) | ||
|
|
||
| echo Installing or updating "%LATEST_PACKAGE%" | ||
|
|
||
| REM Install or update the package using pip from the OSGeo4W environment | ||
| pip install --upgrade "%PACKAGE_DIR%\%LATEST_PACKAGE%" | ||
|
|
||
| REM Check if the installation was successful | ||
| if %ERRORLEVEL% equ 0 ( | ||
| echo Installation completed successfully. | ||
| ) else ( | ||
| echo Installation failed. Please check the path and try again. | ||
| ) | ||
|
|
||
| endlocal | ||
| pause | ||
| goto :EOF |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,25 @@ | ||
| [build-system] | ||
| requires = ["hatchling"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src/pyromb"] | ||
|
|
||
| [tool.hatch.build] | ||
| only-packages = true | ||
| exclude = [ | ||
| ".conda", | ||
| ] | ||
| requires = ["setuptools>=61.0.0", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "pyromb" | ||
| version = "0.2.0" | ||
| version = "0.2.2" | ||
| authors = [ | ||
| { name="Tom Norman", email="tom@normcosystems.com" } | ||
| { name = "Tom Norman", email = "tom@normcosystems.com" } | ||
| ] | ||
| description = "Runoff Model Builder (Pyromb) is a package used for building RORB and WBNM control files from catchment diagrams built from ESRI shapefiles. Its primary use is in the QGIS plugin Runoff Model: RORB and Runoff Model: WBNM" | ||
| readme = "README.md" | ||
| requires-python = ">=3.9" | ||
|
|
||
| dependencies = [ | ||
| "shapely", | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove Shapely and Pyshp dependency and use GDAL. GDAL is packaged with QGIS so will be one less dependency to install. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently Shapely is also packaged with QGIS, but I figured that out after I got GDAL working. |
||
| "pyshp", | ||
| "matplotlib", | ||
| "numpy", | ||
norman-tom marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Add any additional dependencies here | ||
| ] | ||
|
|
||
| classifiers = [ | ||
| "Programming Language :: Python :: 3", | ||
| "License :: OSI Approved :: MIT License", | ||
|
|
@@ -29,4 +28,4 @@ classifiers = [ | |
|
|
||
| [project.urls] | ||
| "Homepage" = "https://github.com/norman-tom/pyromb" | ||
| "Bug Tracker" = "https://github.com/norman-tom/pyromb/issues" | ||
| "Bug Tracker" = "https://github.com/norman-tom/pyromb/issues" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| from setuptools import setup, find_packages | ||
| import os | ||
|
|
||
| # Read the long description from README.md | ||
| current_dir = os.path.abspath(os.path.dirname(__file__)) | ||
| with open(os.path.join(current_dir, "README.md"), "r", encoding="utf-8") as fh: | ||
| long_description = fh.read() | ||
|
|
||
| setup( | ||
| name="pyromb", | ||
| version="0.2.1", | ||
| packages=find_packages( | ||
| where="src", exclude=["*.tests", "*.tests.*", "tests.*", "tests"] | ||
| ), | ||
| package_dir={"": "src"}, | ||
| author="Tom Norman", | ||
| author_email="tom@normcosystems.com", | ||
| description="Runoff Model Builder (Pyromb) is a package used for building RORB and WBNM control files from catchment diagrams built from ESRI shapefiles. Its primary use is in the QGIS plugin Runoff Model: RORB and Runoff Model: WBNM", | ||
| long_description=long_description, | ||
| long_description_content_type="text/markdown", | ||
| url="https://github.com/norman-tom/pyromb", | ||
| classifiers=[ | ||
| "Programming Language :: Python :: 3", | ||
| "License :: OSI Approved :: MIT License", | ||
| "Operating System :: OS Independent", | ||
| ], | ||
| python_requires=">=3.12", | ||
norman-tom marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| include_package_data=True, # Ensures inclusion of files specified in MANIFEST.in | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.2.1