Skip to content

Commit

Permalink
Merge pull request #52 from aquacropos/update-docs
Browse files Browse the repository at this point in the history
update docs in line with newest mkdocs version
  • Loading branch information
thomasdkelly authored Jun 27, 2022
2 parents ec9b2d9 + 7b698f1 commit 6f6b93d
Show file tree
Hide file tree
Showing 70 changed files with 1,639 additions and 867 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Enabled": false,
"python.linting.mypyEnabled": true,
"python.linting.flake8Args": [
"--max-line-length=200",
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Soil-Crop-Water model based on AquaCrop-OS.
![last-commit](https://badgen.net/github/last-commit/aquacropos/aquacrop)
![license](https://badgen.net/pypi/license/aquacrop)
![python-version](https://badgen.net/pypi/python/aquacrop)
[![image](https://pepy.tech/badge/aquacrop)](https://pepy.tech/project/aquacrop)
[![Downloads](https://pepy.tech/badge/aquacrop/month)](https://pepy.tech/project/aquacrop)


```python
Expand All @@ -27,7 +29,7 @@ model_results = model_os.get_simulation_results().head()
print(model_results)
```

## ABOUT
## About

AquaCrop-OSPy is a python implementation of the popular crop-water model AquaCrop, built from the AquaCrop-OS source code.

Expand Down
2 changes: 1 addition & 1 deletion aquacrop/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AquaCropModel:
This is the main class of the AquaCrop-OSPy model.
It is in charge of executing all the operations.
Arguments:
Parameters:
sim_start_time (str): YYYY/MM/DD, Simulation start date
Expand Down
36 changes: 16 additions & 20 deletions aquacrop/entities/clockStruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,37 @@ class ClockStruct:
"""
Contains model information regarding dates and step times etc.
Atributes:\n
Attributes:
`time_step_counter` : `int`: Keeps track of current timestep
time_step_counter (int): Keeps track of current timestep
`model_is_finished` : `Bool`: False unless model has finished
model_is_finished (Bool): False unless model has finished
`simulation_start_date` : `np.Datetime64`: Date of simulation start
simulation_start_date (np.Datetime64): Date of simulation start
`simulation_end_date` : `np.Datetime64`: Date of simulation end
simulation_end_date (np.Datetime64): Date of simulation end
`time_step` : `int`: time step (evaluation needed)
time_step (int): time step (evaluation needed
`n_steps` : `int`: total number of days of simulation
n_steps (int): total number of days of simulation
`time_span` : `np.array`: all dates (np.Datetime64) that
lie within the start and end dates of simulation
time_span (np.array): all dates that lie within the start and end dates of simulation
`step_start_time` : `np.Datetime64`: Date at start of timestep
step_start_time (np.Datetime64): Date at start of timestep
`step_end_time` : `np.Datetime64`: Date at end of timestep
step_end_time (np.Datetime64): Date at end of timestep
`evap_time_steps` : `int`: Number of time-steps (per day) for soil
evaporation calculation
evap_time_steps (int): Number of time-steps (per day) for soil evaporation calculation
`sim_off_season` : `str`: 'Y' if you want to simulate the off season,
'N' otherwise
sim_off_season (str): 'Y' if you want to simulate the off season,'N' otherwise
`planting_dates` : `list-like`: list of planting dates in datetime format
planting_dates (list-like): list of planting dates in datetime format
`harvest_dates` : `list-like`: list of harvest dates in datetime format
harvest_dates (list-like): list of harvest dates in datetime format
`n_seasons` : `int`: Total number of seasons to be simulated
n_seasons (int): Total number of seasons to be simulated
`season_counter` : `int`: counter to keep track of which season we are
currenlty simulating
season_counter (int): counter to keep track of which season we are currenlty simulating
"""
Expand Down
7 changes: 3 additions & 4 deletions aquacrop/entities/co2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ class CO2(object):

"""
**Attributes:**\n
Attributes:
ref_concentration (float): reference CO2 concentration
`ref_concentration` : `float` : reference CO2 concentration
`current_concentration` : `float` : current CO2 concentration
current_concentration (float): current CO2 concentration
"""

Expand Down
40 changes: 14 additions & 26 deletions aquacrop/entities/crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,26 @@

class Crop:
"""
The Crop Class contains Paramaters and variables of the crop used in the simulation
The Crop Class contains paramaters and variables of the crop used in the simulation
Most Crop attributes can be found in the `crops.crop_params.py` file
A number of default program properties of type float are also specified during initialisation
**Attributes**:\n
```
Initialization example:
crop = Crop('Maize', planting_date='05/01')
```
`c_name`: `str`: crop name ('custom' or one of built in defaults e.g. 'Maize')
Attributes:
`planting_date` : `str` : Planting Date (mm/dd)
c_name (str): crop name ('custom' or one of built in defaults e.g. 'Maize')
`harvest_date` : `str` : Latest Harvest Date (mm/dd)
planting_date (str): Planting Date (mm/dd)
`CropType` : `int` : Crop Type (1 = Leafy vegetable, 2 = Root/tuber, 3 = Fruit/grain)
harvest_date (str): Latest Harvest Date (mm/dd)
`PlantMethod` : `int` : Planting method (0 = Transplanted, 1 = Sown)
`CalendarType` : `int` : Calendar Type (1 = Calendar days, 2 = Growing degree days)
`SwitchGDD` : `int` : Convert calendar to gdd mode if inputs are given in calendar days (0 = No; 1 = Yes)
`IrrMngt`: `dict` : dictionary containting irrigation management information
`IrrSchd` : `pandas.DataFrame` : pandas DataFrame containing the Irrigation Schedule if predefined
`FieldMngt` : `dict` : Dictionary containing field management variables for the growing season of the crop
A number of default program properties of type float are also specified during initialisation
"""

Expand Down Expand Up @@ -336,11 +328,7 @@ def calculate_additional_params(

class CropStruct(object):
"""
The Crop Class contains Paramaters and variables of the crop used in the simulation
**Attributes**:\n
Duplicate crop object for Jit compilation
"""
Expand Down
26 changes: 11 additions & 15 deletions aquacrop/entities/fieldManagement.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@

from numba import float64, int64, boolean, types


class FieldMngt:
"""
Field Management Class
**Attributes:**\n
`mulches` : `bool` : Soil surface covered by mulches (yield_ or N)
Field Management Class containing mulches and bunds parameters
`bunds` : `bool` : Surface bunds present (yield_ or N)
Attributes:
`curve_number_adj` : `bool` : Field conditions affect curve number (yield_ or N)
mulches (bool): Soil surface covered by mulches (yield_ or N)
`sr_inhb` : `bool` : Management practices fully inhibit surface runoff (yield_ or N)
bunds (bool): Surface bunds present (yield_ or N)
curve_number_adj (bool): Field conditions affect curve number (yield_ or N)
sr_inhb (bool): Management practices fully inhibit surface runoff (yield_ or N)
`mulch_pct` : `float` : Area of soil surface covered by mulches (%)
mulch_pct (float): Area of soil surface covered by mulches (%)
`f_mulch` : `float` : Soil evaporation adjustment factor due to effect of mulches
f_mulch (float): Soil evaporation adjustment factor due to effect of mulches
`z_bund` : `float` : Bund height (m)
z_bund (float): Bund height (m)
`bund_water` : `float` : Initial water height in surface bunds (mm)
bund_water (float): Initial water height in surface bunds (mm)
`curve_number_adj_pct` : `float` : Percentage change in curve number (positive or negative)
curve_number_adj_pct (float): Percentage change in curve number (positive or negative)
"""

Expand Down
11 changes: 5 additions & 6 deletions aquacrop/entities/groundWater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ class GroundWater:
"""
Ground Water Class stores information on water table params
**Attributes:**\n
Attributes:
water_table (str): Water table considered (yield_ or N)
`water_table` : `str` : Water table considered (yield_ or N)
method (str): Water table input data ('Constant' or 'Variable')
`method` : `str` : Water table input data ('Constant' or 'Variable')
dates (list): water table observation dates
`dates` : `list` : water table observation dates
`values` : `list` : water table observation depths
values (list): water table observation depths
"""

Expand Down
10 changes: 5 additions & 5 deletions aquacrop/entities/inititalWaterContent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ class InitialWaterContent:
"""
Initial water content Class defines water content at start of sim
**Attributes:**\n
Attributes:
`wc_type` : `str` : Type of value ('Prop' = 'WP'/'FC'/'SAT'; 'Num' = XXX m3/m3; 'Pct' = % taw))
wc_type (str): Type of value ('Prop' = 'WP'/'FC'/'SAT'; 'Num' = XXX m3/m3; 'Pct' = % taw))
`method` : `str` : method ('Depth' = Interpolate depth points; 'Layer' = Constant value for each soil layer)
method (str): method ('Depth' = Interpolate depth points; 'Layer' = Constant value for each soil layer)
`depth_layer` : `list` : location in soil profile (soil layer or depth)
depth_layer (list): location in soil profile (soil layer or depth)
`value` : `list` : value at that location
value (list): value at each location given in depth_layer
"""

Expand Down
26 changes: 12 additions & 14 deletions aquacrop/entities/irrigationManagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,29 @@
class IrrigationManagement:

"""
Farmer Class defines irrigation strategy
IrrigationManagement Class defines irrigation strategy
**Attributes:**\n
Attributes:
`Name` : `str` : name
irrigation_method (int): Irrigation method {0: rainfed, 1: soil moisture targets, 2: set time interval,
3: predifined schedule, 4: net irrigation, 5: constant depth }
`irrigation_method` : `int` : Irrigation method {0: rainfed, 1: soil moisture targets, 2: set time interval,
3: predifined schedule, 4: net irrigation, 5: constant depth }
WetSurf (int): Soil surface wetted by irrigation (%)
`WetSurf` : `int` : Soil surface wetted by irrigation (%)
AppEff (int): Irrigation application efficiency (%)
`AppEff` : `int` : Irrigation application efficiency (%)
MaxIrr (float): Maximum depth (mm) that can be applied each day
`MaxIrr` : `float` : Maximum depth (mm) that can be applied each day
SMT (list): Soil moisture targets (%taw) to maintain in each growth stage (only used if irrigation method is equal to 1)
`SMT` : `list` : Soil moisture targets (%taw) to maintain in each growth stage (only used if irrigation method is equal to 1)
IrrInterval (int): Irrigation interval in days (only used if irrigation method is equal to 2)
`IrrInterval` : `int` : Irrigation interval in days (only used if irrigation method is equal to 2)
Schedule (pandas.DataFrame): DataFrame containing dates and depths
`Schedule` : `pandas.DataFrame` : DataFrame containing dates and depths
NetIrrSMT (float): Net irrigation threshold moisture level (% of taw that will be maintained, for irrigation_method=4)
`NetIrrSMT` : `float` : Net irrigation threshold moisture level (% of taw that will be maintained, for irrigation_method=4)
`Depth` : `float` : constant depth to apply on each day
Depth (float): constant depth to apply on each day
"""

Expand Down
8 changes: 4 additions & 4 deletions aquacrop/entities/moistureDepletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@


class Dr:

"""
Depletion class to hold the rootzone and topsoil depletion
**Attributes:**\n
Attributes:
`Rz` : `float` : .
Rz (float): Root zone soil-water depletion
`Zt` : `float` : .
Zt (float): Top soil depletion
"""
Expand Down
14 changes: 8 additions & 6 deletions aquacrop/entities/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ class Output:
"""
Class to hold output data
**Atributes**:\n
During Simulation these are numpy arrays and are converted to pandas dataframes
at the end of the simulation
`water_storage` : `numpy` : Water storage in soil. TODO: it is numpy or pandas?
Atributes:
water_flux (pandas.DataFrame, numpy.array): Daily water flux changes
TODO: water_flux and crop_growth are numpy arrays during simulation. I think it should be clearer
`water_flux` : `pandas.DataFrame` : Water flux
water_storage (pandas.DataFrame, numpy array): daily water content of each soil compartment
`crop_growth` : `pandas.DataFrame` : crop growth
crop_growth (pandas.DataFrame, numpy array): daily crop growth variables
`final_stats` : `pandas.DataFrame` : final stats
final_stats (pandas.DataFrame, numpy array): final stats at end of each season
"""

Expand Down
Loading

0 comments on commit 6f6b93d

Please sign in to comment.