generated from fastai/nbdev_template
-
Notifications
You must be signed in to change notification settings - Fork 76
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 #117 from chris-s-bowden/v7-improvements
v3.0 update
- Loading branch information
Showing
23 changed files
with
1,763 additions
and
2,724 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 |
---|---|---|
@@ -1,26 +1,26 @@ | ||
name: Test library with unittest. | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9, '3.10'] | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up all python version | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Run Test | ||
run: python -m unittest | ||
name: Test library with unittest. | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: [3.8, 3.9, '3.10'] | ||
os: [ubuntu-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up all python version | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Run Test | ||
run: python -m unittest |
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 |
---|---|---|
|
@@ -571,3 +571,5 @@ v7_final_tidying.pptx | |
*.xlsx | ||
|
||
outputs/ | ||
|
||
test_test.py |
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 |
---|---|---|
@@ -1,14 +1,23 @@ | ||
{ | ||
"python.linting.enabled": true, | ||
"python.linting.flake8Enabled": false, | ||
"python.linting.mypyEnabled": true, | ||
"python.linting.flake8Args": [ | ||
"--max-line-length=200", | ||
], | ||
"python.linting.pylintEnabled": true, | ||
"python.linting.pylintArgs": [ | ||
"--disable=used-before-assignment" | ||
], | ||
"python.formatting.provider": "black", | ||
|
||
{ | ||
"python.linting.enabled": true, | ||
"python.linting.flake8Enabled": false, | ||
"python.linting.mypyEnabled": true, | ||
"python.linting.flake8Args": [ | ||
"--max-line-length=200", | ||
], | ||
"python.linting.pylintEnabled": true, | ||
"python.linting.pylintArgs": [ | ||
"--disable=used-before-assignment" | ||
], | ||
"python.formatting.provider": "black", | ||
"python.testing.unittestArgs": [ | ||
"-v", | ||
"-s", | ||
"./tests", | ||
"-p", | ||
"test_*.py" | ||
], | ||
"python.testing.pytestEnabled": false, | ||
"python.testing.unittestEnabled": true, | ||
|
||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
[metadata] | ||
name = aquacrop | ||
version = 2.2.3 | ||
author = Thomas Kelly | ||
author_email = thomas.kelly-2@manchester.ac.uk | ||
description = Soil-Crop-Water model based on AquaCrop-OS. | ||
long_description = file: README.md | ||
long_description_content_type= text/markdown | ||
keywords = aquacrop, aquacropos, aquacrop-ospy, python | ||
url = https://github.com/aquacropos/aquacrop | ||
project_urls = | ||
Bug Tracker = https://github.com/aquacropos/aquacrop/issues | ||
classifiers = | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
License :: OSI Approved :: MIT License | ||
Operating System :: MacOS | ||
Operating System :: Microsoft | ||
Operating System :: POSIX :: Linux | ||
Natural Language :: English | ||
|
||
[options] | ||
install_requires = | ||
numba>=0.56.0 | ||
numpy>=1.18.0,<1.22.0 | ||
pandas>=1.3.5 | ||
tqdm>=4.64.0 | ||
cffi==1.15.0 | ||
setup_requires = | ||
numba>=0.56.0 | ||
numpy>=1.18.0,<1.22.0 | ||
pandas>=1.3.5 | ||
tqdm>=4.64.0 | ||
cffi==1.15.0 | ||
include_package_data = True | ||
packages = find: | ||
python_requires = >=3.7 | ||
|
||
[options.packages.find] | ||
exclude = | ||
examples* | ||
tools* | ||
docs* | ||
aquacrop.tests* | ||
test* | ||
scripts* | ||
venv* | ||
|
||
[metadata] | ||
name = aquacrop | ||
version = 3.0 | ||
author = Tim Foster | ||
author_email = timothy.foster@manchester.ac.uk | ||
description = Soil-Crop-Water model based on AquaCrop-OS. | ||
long_description = file: README.md | ||
long_description_content_type= text/markdown | ||
keywords = aquacrop, aquacropos, aquacrop-ospy, python | ||
url = https://github.com/aquacropos/aquacrop | ||
project_urls = | ||
Bug Tracker = https://github.com/aquacropos/aquacrop/issues | ||
classifiers = | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
License :: OSI Approved :: MIT License | ||
Operating System :: MacOS | ||
Operating System :: Microsoft | ||
Operating System :: POSIX :: Linux | ||
Natural Language :: English | ||
|
||
[options] | ||
install_requires = | ||
numba>=0.56.0 | ||
numpy==1.22.0 | ||
pandas>=1.3.5 | ||
tqdm>=4.64.0 | ||
cffi==1.15.0 | ||
setup_requires = | ||
numba>=0.56.0 | ||
numpy==1.22.0 | ||
pandas>=1.3.5 | ||
tqdm>=4.64.0 | ||
cffi==1.15.0 | ||
include_package_data = True | ||
packages = find: | ||
python_requires = >=3.7 | ||
|
||
[options.packages.find] | ||
exclude = | ||
examples* | ||
tools* | ||
docs* | ||
aquacrop.tests* | ||
test* | ||
scripts* | ||
venv* | ||
|
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,46 @@ | ||
import pandas as pd | ||
|
||
import os | ||
os.environ['DEVELOPMENT'] = 'True' | ||
|
||
from aquacrop import ( | ||
AquaCropModel, | ||
Soil, | ||
Crop, | ||
InitialWaterContent, | ||
IrrigationManagement, | ||
) | ||
from aquacrop.utils import prepare_weather, get_filepath | ||
|
||
|
||
_sim_start = "1982/05/01" | ||
_sim_end = "1983/10/30" | ||
|
||
weather_file_path = get_filepath("champion_climate.txt") | ||
|
||
_weather_data = prepare_weather(weather_file_path) | ||
|
||
_sandy_loam = Soil(soil_type="SandyLoam") | ||
_wheat = Crop("Maize", planting_date="05/01") | ||
_initial_water_content = InitialWaterContent(value=["FC"]) | ||
|
||
irrigation = IrrigationManagement(irrigation_method=0) | ||
|
||
model_os = AquaCropModel( | ||
sim_start_time=_sim_start, | ||
sim_end_time=_sim_end, | ||
weather_df=_weather_data, | ||
soil=_sandy_loam, | ||
crop=_wheat, | ||
initial_water_content=_initial_water_content, | ||
irrigation_management=irrigation, | ||
) | ||
# run model till termination | ||
model_os.run_model(till_termination=True) | ||
|
||
final_statistics = model_os.get_simulation_results().head(10) | ||
yield_expected = 10.78 | ||
yield_returned = round(final_statistics["Dry yield (tonne/ha)"][0], 2) | ||
|
||
print(yield_expected) | ||
print(yield_returned) |
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 |
---|---|---|
@@ -1,47 +1,50 @@ | ||
""" | ||
This test is for bug testing | ||
""" | ||
import unittest | ||
|
||
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent, GroundWater | ||
from aquacrop.utils import prepare_weather, get_filepath | ||
|
||
|
||
class TestModelExceptions(unittest.TestCase): | ||
""" | ||
Test of what happens if the model does not run. | ||
""" | ||
|
||
_weather_file_path = get_filepath("tunis_climate.txt") | ||
|
||
_weather_data = prepare_weather(_weather_file_path) | ||
|
||
_weather_data["Precipitation"] = ( | ||
_weather_data["Precipitation"] / 10 | ||
) # too much rain for ground water effect in the original | ||
|
||
_sandy_loam = Soil(soil_type="SandyLoam") | ||
_wheat = Crop("Wheat", planting_date="10/01") | ||
_initial_water_content = InitialWaterContent(value=["FC"]) | ||
_model_os = AquaCropModel( | ||
sim_start_time=f"{1979}/10/01", | ||
sim_end_time=f"{1981}/05/30", | ||
weather_df=_weather_data, | ||
soil=_sandy_loam, | ||
crop=_wheat, | ||
initial_water_content=_initial_water_content, | ||
groundwater=GroundWater( | ||
water_table="Y", dates=[f"{1979}/10/01"], values=[2.66] | ||
), | ||
) | ||
_model_os.run_model(till_termination=True) | ||
|
||
def test_anything(self): | ||
""" | ||
Test any variable | ||
""" | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
""" | ||
This test is for bug testing | ||
""" | ||
import unittest | ||
|
||
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent, GroundWater | ||
from aquacrop.utils import prepare_weather, get_filepath | ||
|
||
import os | ||
os.environ['DEVELOPMENT'] = 'True' | ||
|
||
|
||
class TestModelExceptions(unittest.TestCase): | ||
""" | ||
Test of what happens if the model does not run. | ||
""" | ||
|
||
_weather_file_path = get_filepath("tunis_climate.txt") | ||
|
||
_weather_data = prepare_weather(_weather_file_path) | ||
|
||
_weather_data["Precipitation"] = ( | ||
_weather_data["Precipitation"] / 10 | ||
) # too much rain for ground water effect in the original | ||
|
||
_sandy_loam = Soil(soil_type="SandyLoam") | ||
_wheat = Crop("Wheat", planting_date="10/01") | ||
_initial_water_content = InitialWaterContent(value=["FC"]) | ||
_model_os = AquaCropModel( | ||
sim_start_time=f"{1979}/10/01", | ||
sim_end_time=f"{1981}/05/30", | ||
weather_df=_weather_data, | ||
soil=_sandy_loam, | ||
crop=_wheat, | ||
initial_water_content=_initial_water_content, | ||
groundwater=GroundWater( | ||
water_table="Y", dates=[f"{1979}/10/01"], values=[2.66] | ||
), | ||
) | ||
_model_os.run_model(till_termination=True) | ||
|
||
def test_anything(self): | ||
""" | ||
Test any variable | ||
""" | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Oops, something went wrong.