RadAgro software was created as a QGIS Python plug-in. The reason for this approach was the possibility to use a QGIS tools and simplicity of installation for users. In this context usage QGIS as a platform for RadAgro can increase the power of the software.
The SW RadAgro itself is a tool for prediction of a temporal development of radioactive contamination of the area of interest.
RadAgro calculates a temporal changes of radioactivity on basis of crops rotation (e.i. sowing procedure, agronomy), soil erosion and radioactivity decay. The radioactivity contamination development in particular fields and patches is predicted in early phase (approx. 48 hours or days) after radiation accident including possible effect of countermeasures (removing plants/crops above-ground biomass) and as well as in long term period. The step of the prediction is one month.
Program structure¶
The RadAgro software has the following structure:
.
├── help
│ ├── build
│ ├── source
│ ├── make.bat
│ └── Makefile
├── i18n
│ └── RadAgro_en.ts
├── modules
│ ├── activity_decay.py
│ ├── hydrIO.py
│ ├── __init__.py
│ ├── mdaylight.py
│ ├── overlap_clip.py
│ ├── SARCA_lib.py
│ ├── sowing_proc.py
│ ├── usle.py
│ ├── waterflow.py
│ └── zonal_stats.py
├── params
│ ├── crops_params_cs.csv
│ ├── crops_params_en.csv
│ ├── IMPORTANT-READ.txt
│ └── Soil_hydr_cat.csv
├── __init__.py
├── icon.png
├── LICENSE
├── metadata.txt
├── pylintrc
├── RadAgro_dialog_base.ui
├── RadAgro_dialog.py
├── RadAgro.py
├── README.md
├── resources.py
└── resources.qrc
The functional overview and structure is described in technical documentation of RadAgro. The main modules of the RadAgro are described and documented here.
Folders¶
- help: contains Sphinx source data and exported html documentation
- i18n: contains data for translation
- modules: contains python modules described below
- params: contains LUTs with parameters for crops growth model, hydrological model, erosion model and radiotransfer.
Files¶
The files included in the RadAgro folder are described below:
- icon.png: Icon
- LICENSE: Text of GNU-GPL v.3 license
- metadata.txt: Metadata of RadAgro which are needed for extension reading by QGIS. The file contains information about RadAgro.
- pylintrc: Configuration file
- RadAgro.py: The main python module providing UI communication and calculation
- RadAgro_dialog.py: Contains an information about reading UI from QT source
- RadAgro_dialog_base.ui: Source file of user interface. Qt5 is used.
- README.md: GitHub readme file
- resources.py: Module for icon configuration
- resources.qrc: Metadata for icon configuration
Module RadAgro¶
Module RadAgro is main module of the SW, containing all methods used for connection and usage of user interface by users and furthermore methods providing calculation of the radioactive contamination temporal changes of the area of interest. The methods for communication with user are also included in the module.
-
class
RadAgro.
RadAgro
(iface)[zdroj]¶ QGIS Plugin Implementation.
-
add_action
(icon_path, text, callback, enabled_flag=True, add_to_menu=True, add_to_toolbar=True, status_tip=None, whats_this=None, parent=None)[zdroj]¶ Add a toolbar icon to the toolbar.
Parametry: - icon_path (str) – Path to the icon for this action. Can be a resource path (e.g. ‚:/plugins/foo/bar.png‘) or a normal file system path.
- text (str) – Text that should be shown in menu items for this action.
- callback (function) – Function to be called when the action is triggered.
- enabled_flag (bool) – A flag indicating if the action should be enabled by default. Defaults to True.
- add_to_menu (bool) – Flag indicating whether the action should also be added to the menu. Defaults to True.
- add_to_toolbar (bool) – Flag indicating whether the action should also be added to the toolbar. Defaults to True.
- status_tip (str) – Optional text to show in a popup when mouse pointer hovers over the action.
- parent (QWidget) – Parent widget for the new action. Defaults None.
- whats_this – Optional text to show in the status bar when the mouse pointer hovers over the action.
Vrací: The action that was created. Note that the action is also added to self.actions list.
Typ návratové hodnoty: QAction
-
calculateGowthCurveCoefs
()[zdroj]¶ Calculate default coefficients (slope and intercept of growth curves for the particular crops and add them to the tw_growth_params table
-
calculateRadioactiveContamination
(df_transf_coefs, df_crops_rotation_all, df_crops_harvest, df_crops_dw_all, k_factor, ls_factor, c_factor_tab, r_perc)[zdroj]¶ Calculation of total radioactive contamination of particular fields
Parametry: - df_transf_coefs – Dataframe with transfer coefficient extracted from UI
- df_crops_rotation_all – Dataframe with crops rotation time series
- df_crops_harvest – Dataframe with harvests time series
- df_crops_dw_all – Dataframe with dry weight of biomass time series
- k_factor – Dataframe with K factor of USLE values
- ls_factor – Dataframe with LS factor of USLE values
- c_factor_tab – Dataframe with C factor of USLE values
- r_perc – Percentage of R factor during the year
-
createCropsHarvestTS
(df_crops_init, df_crops_rotation, df_meadows)[zdroj]¶ Create time series of the harvest time for the area of interest :param df_meadows: Dataframe with meadows mowing time series :param df_crops_rotation: Dataframe with crops rotation time series :param df_crops_init: Initial crops rotation dataframe
-
createCropsInitDf
(crops_path)[zdroj]¶ Read indices of crops corresponding to original crops from tw_crops_orig table and write them to the initial vector layer
Parametry: crops_path – path to crops vector layer Vrací: initial dataframe for crops and following calculation results
-
createCropsRotationTS
(df_crops_init, df_crops_rotation, df_meadows)[zdroj]¶ Create time series for crops and meadows rotation for the area of interest.
Parametry: - df_crops_init – Initial dataframe for crops
- df_crops_rotation – Dataframe with crops rotation
- df_meadows – Dataframe with rotation of meadows mowing
-
createDryMassTS
(df_crops_init, df_growth_model_params, df_crops_rotation, df_meadows)[zdroj]¶ Create time series table for dry weight of the crops for the area of interest
Parametry: - df_meadows – Dataframe with meadows mowing time series
- df_crops_rotation – Dataframe with crops rotation time series
- df_growth_model_params – Dataframe with parameters of growth model
- df_crops_init – Initial crops rotation time series dataframe.
-
cropTableAddRow
(table)[zdroj]¶ Add row with crops and terms of sowing and harvest to sowing procedure table for the area of interest.
Parametry: table – Table of crops rotation with sowing and harvest terms (QTableWidget).
-
earlyStage
(depo_path, precip_path, crops_path, df_crops_init)[zdroj]¶ Calculation of radioactive contamination in early stage of radioactive accident.
Parametry: - depo_path – Path to raster with deposition
- precip_path – Path to raster with precipitation (mm)
- crops_path – Path to crops vector layer
- df_crops_init – Initial crops dataframe
- depo_path – Path to raster with deposition
-
exportRadioCont2GeoPackage
()[zdroj]¶ Export dataframe with radioactive contamination to Geo Package (gpkg).
-
fillRadioTransferParams
()[zdroj]¶ Fill Radiotransfer parameters for particular crops to tw_radio_coefs table
-
fillSoilUnits
()[zdroj]¶ Fill soil parameters (Soil hydrological category and K-factor to table tw_HPJ_params
-
getLyrPath
(comboBox)[zdroj]¶ Get path to input file from combobox
Parametry: comboBox – combo box in UI. Retrun: path to input file
-
meadowTableAddRow
(table)[zdroj]¶ Add rows with meadows mowing and month of harvest to the table for the area of interest.
Parametry: table – Table of meadows mowing from UI (QTableWidget).
-
readCFactorTable
()[zdroj]¶ Read C factors values of USLE equation corresponding to particular crops according to Janeček et al. 2007. The first column of output is crop ID, the second is C factor of USLE equation.
-
readCropsRotation
()[zdroj]¶ Get data from UI for crops rotation and their preparation for next calculation
-
readIDField
()[zdroj]¶ Read IDs for particular fileds in the area of interest and set the data to select_ID combobox for generating plots with reults
-
readKFactorTable
()[zdroj]¶ Read R factors values of USLE equation corresponding to Main Soil Units (MSU) according to Janeček et al. 2007. The first column of output is MSU, the second is K factor of USLE equation.
-
readMeadowsCut
()[zdroj]¶ Get data from UI for meadows mowing and their preparation for next calculation
-
setKeyField
(comboBox_in, comboBox_out)[zdroj]¶ Set variables from the map_lyr.
Parametry: - comboBox_in – Combo box (QgsMapLayerComboBox) with vector layer.
- comboBox_out – Fields of vector layer.
-
setOrigCropsToTable
()[zdroj]¶ Set crops from crop field defined by user to table and select corresponding crops from list
-
showInfo
()[zdroj]¶ Create infobox with acknowledgement. The infobox is shown during the start of the plugin.
-
-
class
RadAgro.
Worker
(suLyrPath, su_field, getCropsPath, loadRasters, createCropsDf, readGrowthModel, readTransfCoefs, earlyStage, readCropsRot, readMeadows, createCropsRot, createCropsHarvest, createDryMass, readKFactor, calcFK, calcFLS, readCTable, readRTable, calcRadioactiveCont, exportRadCont, ls_m, ls_n)[zdroj]¶ Example worker for calculating the total area of all features in a layer
Module activity_decay¶
Module activity_decay contains a methods for calculation of radioactivity decay of a radionuclide. The activity decay is calculated in monthly step for particular radionuclide on basis of its lambda parameters (or half life of decay).
-
class
modules.activity_decay.
ActivityDecay
[zdroj]¶ Class of methods dedicated for a calculation of radioactivity decay of radionuclides
-
activityDecay
(A_0, month=1, radionuclide=0)[zdroj]¶ Activity decay (Bq/m2) on basis of relationship:
Parametry: - A_0 (Numpy array (float)) – Activity on the start of the time period
- month (int) – Month for which the calculation is done
- radionuclide (int) – Particular radionuclide. Default value is 0 for 137Cs. 1 is 90Sr.
Return A: Activity on the end of the time period
Rtype A: Numpy array (float)
- A_0 (Numpy array (float)) – Activity on the start of the time period
-
Module hydrIO¶
Module hydrIO contains methods for importing and exporting spatial geo-data. Some methods are created just for RadAgro SW.
-
modules.hydrIO.
arrayToRast
(arrays, names, prj, gtransf, EPSG, out_folder, out_file_name=None, driver_name='GTiff', multiband=False)[zdroj]¶ Export numpy 2D arrays to multiband or singleband raster files. Following common raster formats are accepted for export:
- ENVI .hdr labeled raster format
- Erdas Imagine (.img) raster format
- Idrisi raster format (.rst)
- TIFF / BigTIFF / GeoTIFF (.tif) raster format
- PCI Geomatics Database File (.pix) raster format
Parametry: - arrays (numpy.ndarray or list of numpy.ndarray) – Numpy array or list of arrays for export to raster.
- names (str or list of str) – Name or list of names of the exported bands (in case of multiband raster) or particular rasters (in case of singleband rasters).
- prj (str) – Projection information of the exported raster (dataset).
- gtransf (tuple) – The affine transformation coefficients.
- EPSG (int) – EPSG Geodetic Parameter Set code.
- out_folder (str) – Path to folder where the raster(s) will be created.
- driver_name (str) – GDAL driver. ‚GTiff‘ is default.
- out_file_name (str) – Name of exported multiband raster. Default is None.
- multiband (bool) – Option of multiband raster creation. Default is False.
Vrací: Raster singleband or multiband file(s)
Typ návratové hodnoty: raster
-
modules.hydrIO.
joinLyrWithDataFrame
(in_layer_path, df_data, out_layer_path)[zdroj]¶ Create GeoPackage layer from input vector data for crops and data of radioactive contamination stored in pandas dataframe.
Parametry: - in_layer_path (str) – Path to original input vector layer which is used as a template for a new layer.
- df_data (Pandas DataFrame) – Joining Pandas dataframe corresponding with vector_layer. FID values must be equal.
- out_layer_path (str) – Path to output vector file.
-
modules.hydrIO.
rasterToArray
(layer)[zdroj]¶ Conversion of raster layer to numpy array.
Parametry: layer (str) – Path to raster layer. Vrací: raster file converted to numpy array
-
modules.hydrIO.
readGeo
(rast)[zdroj]¶ Reading important geographical information from raster using GDAL.
Parametry: rast – Path to raster file in GDAL accepted format. Vrací: The tuple of important geographic information about a raster. The tuple contains: - The affine transformation coefficients (tuple)
- Projection information of the raster or dataset (str)
- Size of pixel at X scale (float)
- Size of pixel at Y scale (float)
- EPSG Geodetic Parameter Set code (int)
Module SARCA_lib¶
Module SARCA_lib is a module of RadAgro following from previous software solution SARCA (Spatial Assessment of Radioactive Contamination of Agricultural Crops) used for calculation of radionuclides distribution within soil and agricultural crops during early stage after radiation accident. Module SARCA_lib contains methods for calculation of crop growth analysis and for calculation of radioactive distribution in the crops.
-
class
modules.SARCA_lib.
SARCALib
[zdroj]¶ Library for calculation of crops growth parameters and radioactivity contamination of crops
-
calculateGrowthCoefs
(dw_max, dw_min=0.1)[zdroj]¶ Calculate default values of growth curve parameters - slope (m) and intercept (n).
Parametry: - dw_max – Maximal dry mass of particular crop
- dw_min – Minimal dry mass of particular crop
. Default value is 0.1
.
Vrací: Slope of growth curve
Vrací: Intercept of growth curve
- dw_max – Maximal dry mass of particular crop
-
contBiomass
(depo, IF)[zdroj]¶ Radiaoctive contamination of biomass
Parametry: - depo – Total radioactive deposition
- IF – Interception Factor (rel.)
Vrací: Radioactive contamination of biomass
- depo – Total radioactive deposition
-
contMass
(cont_biomass, fresh_biomass)[zdroj]¶ Calculation radioactive contamination of fresh vegetation mass
Parametry: - cont_biomass – Radioactive deposition on biomass
- fresh_biomass – Amount of fresh biomass of vegetation
Vrací: Fresh vegetation mass radioactive contamination
- cont_biomass – Radioactive deposition on biomass
-
contSoil
(depo, IF)[zdroj]¶ Radiaoctive contamination of soil
Parametry: - depo – Total radioactive deposition
- IF – Interception Factor (rel.)
Vrací: Radioactive contamination of soil
- depo – Total radioactive deposition
-
dryMass
(DW_max, t_accident, t0, t1, coef_m, coef_n)[zdroj]¶ Calculation of actual biomass of the particular crop.
Parametry: - DW_max – Maximal dry mass of the crops above ground biomass in the growing season
- t_accident – Date of radioactive accident as number of day in year
- t0 – Date of sowing crop as number of day in year
- t1 – Date of harvesting crop as number of day in year
- coef_m – Scaling parameter
- coef_n – Scaling parameter
Vrací: Dry mass of above ground biomass
- DW_max – Maximal dry mass of the crops above ground biomass in the growing season
-
interceptFactor
(LAI, precip, DW, k=1.0, S=0.2)[zdroj]¶ Interception factor for both dry and wet deposition of radionuclides.
Parametry: - LAI – Leaf Area Index (unitless)
- k – Constant of radionuclide: I = 0.5, Sr and Ba = 2.0, Cs and another radionuclides = 1.0
- precip – Precipitation amount (mm) for period of deposition (ca 24 hours after radiation accident).
- DW – Amount of fresh biomass
- S – Mean thickness of water film at plant leaves (mm). Default S = 0.2 mm
Vrací: Interception Factor (rel.)
-
leafAreaIndex
(dw_act, DW_max, LAI_max, R_min, t_accident, t0, t1)[zdroj]¶ Calculation of actual LAI of the particular crop.
Parametry: - dw_act – actual dry mass of the crops above ground biomass
- DW_max – Maximal dry mass of the crops above ground biomass in the growing season
- LAI_max – Maximal LAI of the crops in the growing season
- R_min – Minimal relative wight moisture of the biomass (%)
- t_accident – Date of radioactive accident as number of day in year
- t0 – Date of sowing crop as number of day in year
- t1 – Date of harvesting crop as number of day in year
Vrací: Actual LAI of the crop.
- dw_act – actual dry mass of the crops above ground biomass
-
referLevel
(depo, ref_level1=5000, ref_level2=3000000)[zdroj]¶ Mask of radioactive deposition for three reference levels (categories):
0: Low
1: Middle
2: High
Parametry: - depo – Total radioactive deposition
- ref_level1 – Lower reference level treshold
. Default value = 5000
- ref_level2 – Upper reference level treshold
. Default value = 3000000
Vrací: Mask of radioactive deposition for three reference levels
- depo – Total radioactive deposition
-
timeScale
(ts, coef_m, coef_n)[zdroj]¶ Calculates scaling value t_scale of crop growth time series.
Parametry: - ts – Relative position of the radioactive accident in the crop growth time series
- coef_m – Scaling parameter
- coef_n – Scaling parameter
Vrací: Scaling value of growing time series
-
timeSeriesConst
(t_accident, t0, t1)[zdroj]¶ Calculation of relative position of the radioactive accident in the crop growth time series [0, 1].
Parametry: - t_accident – Date of radioactive accident as number of day in year
- t0 – Date of sowing crop as number of day in year
- t1 – Date of harvesting crop as number of day in year
Vrací: Relative position of the radioactive accident in the crop growth time series
-
Module usle¶
Module usle contains methods used for calculation of Universal Soil Loss Equation for particular fields and patches in the area of interest. For more details see chapters in this docs.
-
class
modules.usle.
RadUSLE
[zdroj]¶ Calculation of USLE
-
static
fK
(soil_units_lyr_path, soil_units_field_name, k_data, crops_lyr_path, x_size=30, y_size=30)[zdroj]¶ K erosivity factor of USLE.
Parametry: - soil_units_lyr_path (str) – Path to vector layer with Main soil units codes (HPJ - hlavní půdní jednotky, after Janeček et al. 2007).
- soil_units_field_name (str) – Name of vector attribute field with Main soil units.
- k_data (Pandas DataFrame) – Numpy dataframe containing K values with corresponding Main soil units which are used as IDs.
- crops_lyr_path (str) – Path to vector layer which is used for calculation of zonal statistics. FID values are used in output.
- x_size (float) – Size of newly created raster resolution
- y_size (float) – Size of newly created raster resolution
Vrací: Pandas dataframe containing FIDs corresponding to vector layer used for zonal statistics calculation and K factor values for each field/polygon
Typ návratové hodnoty: Pandas DataFrame
-
fLS
(dmt_path, crops_lyr_path=None, m=0.4, n=1.4)[zdroj]¶ Combined factor of slope length and slope steepness factor of USLE.
Parametry: - dmt_path (str) – Path to DMT raster.
- crops_lyr_path (str) – Path to vector for calculation of zonal statistics.
- m (float) – Exponent representing the Rill-to-Interrill Ratio. Default m = 0.4
- n (float) – Constant. Default n = 1.4
Vrací: Combined factor of slope length and slope steepness factor of USLE. If the vector_path is none the method returns Numpy array matrix of LS factor corresponding to input DMT raster layer. If a vector layer is used the zonal statistic is calculated for each polygon of the vector layer. Output is pandas dataframe containing FIDs of original vector and LS medians.
Typ návratové hodnoty: Numpy array or Pandas DataFrame
-
static
fR
(r_const=40, month_perc=32.2)[zdroj]¶ R factor of USLE for monthly data.
Parametry: - r_const (float) – Constant year value of R factor for particular area (MJ/ha)
- month_perc (float) – Percentage of R for particular months.
Vrací: R value for particular month.
Typ návratové hodnoty: float
-
static
slope
(dmt, x_size=1, y_size=1)[zdroj]¶ Slope of terrain calculation (degrees)
Parametry: - dmt (Numpy array) – Digital elevation model.
- x_size (float) – Size of pixel in x axis (m)
- y_size (float) – Size of pixel in y axis (m)
Vrací: Slope of terrain (DMT) in degrees
Typ návratové hodnoty: Numpy array
-
static
Module waterflow¶
Methods included in module waterflow are dedicated for analysis of hydrological features of the area of interest. The methods are used for calculation of all the water flows in the landscape, i.e. evapotranspiration (both potential and actual) and surface and subsurface runoff. The hydrological model is based on CN method. Calculation step is one month. Furthermore, the methods for calculation of flow accumulation and flow accumulation probability are included. For more details see chapters in this docs.
-
class
modules.waterflow.
WaterBalance
[zdroj]¶ Module for calculation of the hydrological features of the area of interest.
-
airTemperToGrid
(tm_list, dmt, altitude, adiab=0.65)[zdroj]¶ Calculation of spatial temperature distribution on the altitude ( DEM). The function provides list (Numpy array) of air temperature arrays corresponding to list of measured temperature data.
Parametry: - tm_list (list) – List of air temperatures measured on a meteostation.
- dmt (Numpy array) – Digital elevation model.
- altitude (float) – Altitude of temperature measurement.
- adiab (float) – Adiabatic change of temeperature with altitude per 100 m. Default value is 0.65 °C/100 m.
Vrací: List of air temperature grids.
Typ návratové hodnoty: Numpy array
-
evapoActual
(ETp, precip)[zdroj]¶ Actual evapotranspiration calculated according to Ol’dekop (1911), cited after Brutsaert (1992) and Xiong and Guo (1999; doi.org/10.1016/S0022-1694(98)00297-2)
Parametry: - ETp (list) – Potential monthly evapotranspiration according to Thornthwaite (1984), mm. List of monthly values for the year.
- precip (list) – Mean monthly precipitation throughout the year (mm).
Vrací: Actual monthly evapotranspiration throughout the year (mm)
Typ návratové hodnoty: Numpy array
-
evapoPot
(tm_grids, lat=49.1797903)[zdroj]¶ Potential monthly ET According to Thornthwaite 1948. Script calculates ETpot for the whole year - for each month.
Parametry: - tm_grids (list) – List of monthly mean air temperatures during the year (degree of Celsius) - temperature normals
- lat (float) – Earth latitude (UTM) in decimal degrees
Vrací: Potential monthly evapotranspiration according to Thornthwaite (1984), mm. List of monthly values for the year.
Typ návratové hodnoty: Numpy array
-
flowAccProb
(dmt, xsize=1.0, ysize=1.0, rs=None)[zdroj]¶ Calculation of flow accumulation probability layer according to digital elevation model. Probability of flow direction within DEM is calculated on basis of shape of the surface (outflow changes linearly with changing angle between neighbour pixels) and surface resistance for surface runoff (rel.). The method calculation procedure was inspired by Multipath-Flow-Accumulation developed by Alex Stum: https://github.com/StumWhere/Multipath-Flow-Accumulation.git
Parametry: - dmt (numpy.ndarray) – Digital elevation model of the surface (m).
- xsize (float) – Size of pixel in x axis (m)
- ysize (float) – Size of pixel in y axis (m)
- rs (numpy.ndarray) – Surface resistance for surface runoff of water scaled to interval <0; 1>, where 0 is no resistance and 1 is 100% resistance (no flow). Scaled Mannings n should be used. Default is None (zero resistance is used).
Vrací: Flow accumulation grid.
Typ návratové hodnoty: numpy.ndarray
-
flowProbab
(win_dmt, xsize=1.0, ysize=1.0)[zdroj]¶ Calculation of probability of water flow direction in 3x3 matrix on basis of elevation data.
Parametry: - win_dmt (numpy array) – 3x3 matrix of elevation model.
- xsize (float) – Size of pixel in x axis (m)
- ysize (float) – Size of pixel in y axis (m)
Vrací: 3 x 3 matrix of probability of water runoff
Typ návratové hodnoty: Numpy array
-
interceptWater
(precip, LAI, a=0.1, b=0.2)[zdroj]¶ Interception of precipitation on the biomass and soil surface for monthly precipitation data (mm)
Parametry: - precip (Numpy array) – Grid of monthly mean precipitation amount (mm)
- LAI (Numpy array) – Grid of monthly mean leaf area index (unitless)
- a (float) – Constant
- b (float) – Constant
Vrací: Grid of amount of intercepted water during month (mm)
Typ návratové hodnoty: Numpy array
-
runoffSeparCN
(acc_precip, ET, ETp, I, CN=65, a=0.005, b=0.005, c=0.5)[zdroj]¶ The script separates precipitation amount (accumulated) into surface runoff, water retention and evapotranspiration for monthly precipitation data. The method is based on the modified CN curve method.
Parametry: - acc_precip (float) – Monthly mean of acc_precipitation (mm)
- ET (float) – Monthly mean evapotranspiration (mm)
- ETp (float) – Monthly mean potential evapotranspiration (mm)
- I (float) – Amount of intercepted water during month (mm)
- CN (int) – Curve number
- a (float) – Constant
- b (float) – Constant
- c (float) – Constant
Vrací: Amount of monthly surface runoff (mm) corrected on ET
Typ návratové hodnoty: float
Vrací: Amount of retention of water in the soil or subsurface runoff (mm) corrected on ET
Typ návratové hodnoty: float
Vrací: Monthly amount of actual evapotranspiration from the surface (mm)
Typ návratové hodnoty: float
-
waterFlows
(dmt, precip, CN, LAI, ETp, xsize=1.0, ysize=1.0, a=0.005, b=0.005, c=0.5, d=0.1, e=0.2)[zdroj]¶ Calculation of water flows (surface, subsurface and evapotranspiration) in the area of interest. Calculation is designed for monthly data. The area for calculation is defined by raster of digital elevation model. Calculation of water flows are based on CN curves approach and actual evapotranspiration is calculated on basis of Thornthwaith and Ol’decop.
Parametry: - dmt (Numpy array) – Digital elevation model of the surface (m).
- precip (Numpy array) – Grid (Numpy array) of precipitation amount for particular month (mm) corresponding to dmt
- CN (Numpy array) – Grid (Numpy array) of CN curves
- LAI (Numpy array) – Leaf area index
- ETp (Numpy array) – Potential evapotranspiration (mm/month)
- xsize (float) – Size of pixel in x axis (m)
- ysize (float) – Size of pixel in y axis (m)
- a (float) – Constant
- b (float) – Constant
- c (float) – Constant
- d (float) – Constant
- e (float) – Constant
Vrací: Surface outflow of water (mm/month)
Typ návratové hodnoty: Numpy array
Vrací: Subsurface outflow of water (mm/month)
Typ návratové hodnoty: Numpy array
Vrací: Actual evapotranspiration (mm/month)
Typ návratové hodnoty: Numpy array
-
Module mdaylight¶
Module mdaylight provides methods for calculation of day length and monthly means of day length on basis of latitude and day/month number.
-
class
modules.mdaylight.
MonthlyDaylight
[zdroj]¶ Calculates list of monthly mean daylight, timezone and length of dailight for particular day according to geographical position.
-
dayLength
(nday=1, lat=49.1797903)[zdroj]¶ Calculation of dalight according to geographic position and day number (1-365).
Parametry: - nday (int) – Number of day throughout the year (0-365)
- lat (float) – Earth latitude (UTM) in decimal degrees
Vrací: List of mean monthly daylight (hours, decimal)
Typ návratové hodnoty: list
-
Module sowing_proc¶
Module sowing_proc provides methods for crops rotation time series creation for particular crops planted in the area of interest.
-
class
modules.sowing_proc.
SowingProcTimeSeries
[zdroj]¶ Class SowingProsTimeSeries is a module for calculation of sowing procedure (crop rotation) time series in monthly step. Calculation is based on order of crops in the sowing procedure and their agronomy terms (sowing and harvest)
-
calcSowingProc
(crops_table, ID_col_number=0, sowing_col_number=1, harvest_col_number=2)[zdroj]¶ Calculation of sowing procedure time series for crops or for mowed meadows. Calculates are tables for crops identifiers, and table with difference of days between sowing and harvest. The time series starts in January of the first year and ending in the December of the last year of the sowing procedure. The gaps between crops are highlighted as bare soil with ID = 999.
Parametry: - crops_table – Pandas dataframe containing information about crops - ID of crop, term of sowing and term of harvest in order of the sowing procedure. Terms of sowing and harvest are numbered according to months: 1 - January, 2 - February etc.
- ID_col_number – crops_table column with IDs index
- sowing_col_number – crops_table column with sowing date index
- harvest_col_number – crops_table column with harvest date index
Vrací: List containing IDs of crops in sowing procedure. The time series starts in January of the first year and ending in the December of the last year of the sowing procedure.
Vrací: List containing sowing days of crops (approximate values taken from number of months).
Vrací: List containing harvesting days of crops (approximate values taken from number of months).
-
predictCropsRotation
(crops_table, ID_col_number=0, sowing_col_number=1, harvest_col_number=2, predict_months=12, start_month=1, early_stage_mng=True)[zdroj]¶ Prediction of sowing procedure including agricultural crops or mowed meadows. List of crops signatures in TS. -999 is bare soil.
Parametry: - crops_table – Pandas dataframe containing information about crops - ID of crop, term of sowing and term of harvest in order of the sowing procedure. Terms of sowing and harvest are numbered according to months: 1 - January, 2 - February etc.
- ID_col_number – crops_table column with IDs index
- sowing_col_number – crops_table column with sowing date index
- harvest_col_number – crops_table column with harvest date index
- predict_months – Number of months for prediction
- start_month – Month of prediction start - month of radiation accident. [1-12]
- early_stage_mng – The removing of biomass in early stage of radioactive contamination has been done or not. I the first case, the first year of the prediction is taken as bare soil.
Vrací: Basic dataframe (Pandas) for all crops and meadows for the whole TS of the prediction. Data are ordered according to sowing procedure following the particular crops in the crops rotation.
-
predictDryMass
(crops_table, params_table, ID_col_number=0, sowing_col_number=1, harvest_col_number=2, predict_months=12, start_month=1, early_stage_mng=True)[zdroj]¶ Prediction of dry mass of agricultural crops or mowed meadows.
Parametry: - crops_table – Pandas dataframe containing information about crops - ID of crop, term of sowing and term of harvest in order of the sowing procedure. Terms of sowing and harvest are numbered according to months: 1 - January, 2 - February etc.
- params_table – Pandas dataframe with parameters for calculation of dry mass of crops and meadows.
- ID_col_number – crops_table column with IDs index
- sowing_col_number – crops_table column with sowing date index
- harvest_col_number – crops_table column with harvest date index
- predict_months – Number of months for prediction
- start_month – Month of prediction start = month of radiation accident. [1-12]
- early_stage_mng – The removing of biomass in early stage of radioactive contamination has been done or not. I the first case, the first year of the prediction is taken as bare soil.
Vrací: Dataframe of all crops and meadows dry mass for the whole TS of the prediction. Data are ordered according to sowing procedure following the particular crops in the crops rotation.
-
predictHarvest
(crops_table, ID_col_number=0, sowing_col_number=1, harvest_col_number=2, predict_months=12, start_month=1, early_stage_mng=True)[zdroj]¶ Prediction of harvest time for agricultural crops or mowed meadows.
Parametry: - crops_table – Pandas dataframe containing information about crops - ID of crop, term of sowing and term of harvest in order of the sowing procedure. Terms of sowing and harvest are numbered according to months: 1 - January, 2 - February etc.
- ID_col_number – crops_table column with IDs index
- sowing_col_number – crops_table column with sowing date index
- harvest_col_number – crops_table column with harvest date index
- predict_months – Number of months for prediction
- start_month – Month of prediction start - month of radiation accident. [1-12]
- early_stage_mng – The removing of biomass in early stage of radioactive contamination has been done or not. I the first case, the first year of the prediction is taken as bare soil.
Vrací: Basic dataframe (Pandas) for all crops and meadows for the whole TS of the prediction. Data are ordered according to sowing procedure following the particular crops in the crops rotation.
-
Module overlap_clip¶
Module overlay_clip provides methods for unifying and reprojecting different coordinate systems of rasters and furthermore method for clipping of overlapping area of the rasters including their resampling.
-
modules.overlap_clip.
clipOverlappingArea
(rasters_in, output_folder=None, suffix='_clipped', epsg=None, tmp_out=False)[zdroj]¶ Function for clipping rasters by their overlapping area.
Parametry: - rasters_in (list) – List of input rasters paths.
- output_folder (str) – Path to output folder defined by user
- suffix (str) – Suffix of the output rasters names. The name of new raster is constructed from original name of raster and suffix
- epsg (int) – EPSG definition for output rasters. If epsg=None the most frequent EPSG in the layers group will be set.
- tmp_out (bool) – If True the output layers will be created as temporal scratch layers.
Vrací: Paths of rasters clipped by overlapping area of all the rasters
Typ návratové hodnoty: list
-
modules.overlap_clip.
fixSRS
(rasters_in, tmp_out=True)[zdroj]¶ Checking and fixing the SRSs of input rasters. Function looks for possible definition of SRS in group of rasters –> local SRS is possibly replaced by global SRS if it is available in the set of rasters. The empty SRS is replaced by most frequent SRS in the set of rasters.
Parametry: - rasters_in (list) – List of input rasters paths.
- tmp_out (bool) – Selection if the output layers will be created as temporal scratch layers or the original raster layers will be replaced by newly defined rasters.
Vrací: List of output layers paths
Typ návratové hodnoty: list
-
modules.overlap_clip.
readGeo
(rast)[zdroj]¶ Reading geographical information from raster using GDAL.
Parametry: rast (str) – Path to raster file in GDAL accepted format. Vrací: List of geotransformation parameters and features of an input raster: - 0: The affine transformation coefficients; tuple
- 1: Projection information of the raster (dataset); str
- 2: Pixel width (m) on X axis; float
- 3: Pixel height (m) on Y axis; float
- 4: EPSG Geodetic Parameter Set code; str
- 5: Coordinate system; str
- 6: Number of columns in the raster; int
- 7: Number of rows in the raster; int
- 8: SRS - OSR spatial reference; object
Typ návratové hodnoty: list
-
modules.overlap_clip.
uniformSRS
(rasters_in, epsg=None, tmp_out=True)[zdroj]¶ The function unifies SRSs of a group of input raster layers. If output EPSG is not defined, the most frequent EPSG is defined as default. If SRSs are not included in the raster datasets either set EPSG or WGS 84 (EPSG:4326; i.e. if epsg=None) is used for transformation of SRS.
Parametry: - rasters_in (list) – List of input rasters paths.
- epsg (int) – EPSG definition for output rasters. If epsg=None the most frequent EPSG in the layers group will be set.
- tmp_out (bool) – Selection if the output layers will be created as temporal scratch layers or the original raster layers will be replaced by newly defined rasters.
Vrací: List of output layers paths
Typ návratové hodnoty: list
Parameter of crops and soil settings¶
Parameters of crop growth model, soil features and radiation transfer constants are stored in the param folder. The content of the files in the directory can be changed in the following way:
crops_params_cs.csv or crops_params_en.csv - the data in the rows and columns can be changed. The columns and their names can’t be changed. The rows and their order can’t be changed. New rows can be added. The files contains following fields/columns:
- crop: Crop name
- sowing: Date of sowing of the crop
- harvest: Date of harvesting the crop
- dw_max: Maximal dry mass of the aboveground biomass
- LAI_max: Maximal Leaf Area Index of the crop
- r_max: Maximal content of water in biomass (% of mass)
- r_min: Minimal content of water in biomass (% of mass)
- C_factor: Crop factor of USLE constants for particular crops
- CN_x_x: CN numbers for a particular crops and hydrological main soil groups (A - D) and for actual hydrological state of the soils (ISP: G - good, B - bad)
- R_transf_Cs: Constants of radioactive transfer from soil to crops for Caesium
- R_transf_Sr: Constants of radioactive transfer from soil to crops for Stroncium
Soil_hydr_cat.csv - the csv file contains information about various soils:
- HPJ: Main Soil Unit (from 1 to 78)
- HPS: Main hydrological group of soil
- K_factor: K factor constants of USLE for particular soils
All the data described above can be changed in RadAgro UI before the calculation.