Skip to content

API reference#

Temperature Response Functions classes#

Site(uid, attributes, params=None) #

Bases: object

Site class

Object containing attributes and functions related to the nursery site.

Attributes:

Name Type Description
uid integer

The unique identifier for the site.

attributes object

The default attributes for each location in IWIN dataset.

params dictionary

The parameters to use during calculations.

pheno_dates array

The phenology dates of the trial.

weather array

Table with daily weather data for each location.

raw_ndvi array

NDVI values during growing period.

inputWPN object

A dataframe with phenology, NDVI and weather data for each site.

errors dictionary

Dictionary with different errors presented during the model processing.

Methods:

Name Description
getAttr

Get the attibutes of the site

getTDay(m=None, tminFactor=None) #

Calculate day time temperature for the selected site.

Parameters:

Name Type Description Default
m object

Model with information to estimate grain yield

None
tminFactor float

Minimum Temperature factor

None

Returns:

Type Description
array

A number or array of Day Temperature

getPRFT(m=None, TDay=None, TOpt=None) #

Estimate Photosynthesis reduction factor (PRFT) for each site.

Parameters:

Name Type Description Default
m object

A tfunct model

None
TDay float

Number or array of Day Temperatures

None
TOpt float

Optimum Temperature. Default value 18

None

Returns:

Type Description
float

A number or array of PRFT

getSFvpd(m=None, VPDMAX=None, Lvpd=None, Uvpd=None, SFvpd_Lthres=None, SFvpd_Uthres=None) #

Calculation of Vapor pressure deficit (VPD) stress factor for each site

Parameters:

Name Type Description Default
m object

A tfunct model

None
VPDMAX array

Array of daily temperature values

None
Lvpd float

A number for threshold of lower VPD. Default is 1

None
Uvpd array

A number for threshold of upper VPD. Default is 4

None
SFvpd_Lthres array

A number for threshold of stress factor of lower VPD. Default is 0.2

None
SFvpd_Uthres array

A number for threshold of stress factor of upper VPD. Default is 1

None

Returns:

Type Description
array

A number or array of stressed factors of VPD

getGPP(m=None, SolRad=None, PRFT=None, iPAR=None, RUE=3.0, stressFactor=1.0, SFvpd=None, is_VPDStress=False) #

Estimate the Gross primary production (GPP) for each site

Parameters:

Name Type Description Default
m object

A tfunct model

None
SolRad float

Solar Radiation

None
PRFT float

Photosynthesis reduction factor

None
iPAR float

the photosynthetically active radiation (PAR) intercepted by a plant or crop

None
RUE float

Radiation-use efficiency. Default value is 3.0

3.0
stressFactor float

Stress Factor

1.0
SFvpd float

Stress Factor for VPD

None
is_VPDStress bool

Vapor pressure deficit stress. Default is False.

False

Returns:

Type Description
float

the gross primary production (GPP)

fit(m=None, ft='PRFT', is_VPDStress=False, verbose=False) #

Run a model to fit yield for a selected site using a specific temperature function

Deprecated.

This function was depreciated on Dec, 2022.

Parameters:

Name Type Description Default
m object

Model to run

None
ft str

Name of the temperature response function: Default is 'PRFT'

'PRFT'
is_VPDStress bool

Vapor pressure deficit stress. Default is False

False
verbose bool

Display comments during processing

False

Returns:

Type Description
array

An array of Sites with intermediate results

__main__ #

PathType #

Bases: Path

A Click path argument that returns a pathlib Path, not a string

data #

load_dataset() #

Load example (Phenology, NDVI, and Weather) datasets from International Wheat Improvement Network (IWIN) sites and the other locations across the globe to estimate yield under non-stressed and Vapor pressure Deficit (VPD) stressed conditions as a function of temperature.

Return

A data dictionary with all raw data and information needed to carry out the demo.

Examples:

    >>> from tfunct.data import load_dataset
    >>> # Load example dataset (Phenology, NDVI and Weather data for each site)
    >>> data = load_dataset()
    >>> print(data.keys()) # dict_keys(['Pheno', 'NDVI', 'Weather'])
    >>> # Display Pheno data
    >>> data['Pheno']
    >>> # Display NDVI data
    >>> data['NDVI']
    >>> # Display Weather data
    >>> data['Weather']

model #

Model(config, params=None) #

Bases: object

load_raw_datasets() #

Load raw phenology and AgERA5 datasets

Return

A existing dataset including WeatherFile, PhenoFile, NDVIFile. The raw data can be seen in config object. eg. config['PhenoFile']

preprocess_raw_datasets(data) #

Preprocess raw datasets

Parameters:

Name Type Description Default
data dictionary

The phenology, ndvi and weather data for each location in example dataset.

required
Return

A dataset in a specific format for the tfunct package

getTDay(m=None, w=None, tminFactor=None) #

Calculate day time temperature

Parameters:

Name Type Description Default
m object

A tfunct model with sites and the necessary information

None
w array

Table of weather data with minimum and maximum temperature records

None
tminFactor float

Minimum Temperature factor. Default is usually 0.25. It can be reviewed in configuration parameters such as TMIN_PERC_FACTOR.

None

Returns:

Type Description
array

A number or array of Day Temperature

getIPAR(m=None, ndvi=None) #

Total light interception - iPAR

Reference

iPAR = NDVI * 1.25 - 0.19 # between heading and maturity (Campos et al. 2018)

iPAR = NDVI * 1.25 - 0.21 Daughtry et al. (1992)

  • Asrar, G., Fuchs, M., Kanemasu, E.T., Hatfield, J.L., 1984. Estimating absorbed photosynthetic radiation and leaf area index from spectral reflectance in wheat. Agron. J. 76, 30-306.

  • Campos 2018 Remote sensing-based crop biomass with water or light-driven crop growth models in wheat commercial fields.

Parameters:

Name Type Description Default
m object

A tfunct model

None
ndvi array

Array of float values

None

Returns:

Type Description
array

An array of Total light interception values

getYield(tfun='PRFT', sites=None, is_VPDStress=False, expCSV=True) #

Get yield using a defined temperature function and default parameters

Parameters:

Name Type Description Default
tfun str

Name of the temperature function

'PRFT'
sites dictionary

List of sites with the basic information to estimate yield.

None
is_VPDStress bool

Vapor Pressure Deficit stress. Default is False.

False
expCSV bool

Export grain yield results in an individual file. Default is True.

True

Returns:

Type Description
array

A dataframe with simulated grain yield values

runCombinations_PRFT(data=None, sites=None, comb=None, is_VPDStress=False, expCSV=True, individualCSV=False, target=None) #

Run several combinations using different parameters for PRFT model

Deprecated

Stop using this function.

Parameters:

Name Type Description Default
data object

Array of base data.

None
sites object

Array of sites

None
comb object

Array of combinations

None
is_VPDStress bool

Vapor Pressure Deficit stress. Default is False

False
expCSV bool

Save results in CSV format. Default is True

True
individualCSV bool

Default is False

False
target str

Name of the target device. Available values are cpu, parallel and cuda. Default is cpu

None

Returns:

Type Description
object

A dataframe with estimated grain yield of all combinations.

fit(data=None, sites=None, comb=None, ft='PRFT', is_VPDStress=False, expCSV=True, individualCSV=False, n_jobs=4, verbose=False) #

Run a model to fit yield

Deprecated on Dec, 2022.

Stop using this function.

Parameters:

Name Type Description Default
data object

Array of base data.

None
sites object

Array of sites

None
comb object

Array of combinations

None
ft str

Name of the temperature response function. Default is 'PRFT'.

'PRFT'
is_VPDStress bool

Vapor Pressure Deficit stress. Default is False

False
expCSV bool

Save results in CSV format. Default is True

True
individualCSV bool

Default is False

False
n_jobs int

Number of CPU cores to use in paralell processing. Default is 4.

4
verbose bool

Display comments during processing. Default is False

False

Returns:

Type Description
array

An array of sites with intermediate results

setup_dataInput_forCombinations(sites) #

Set up data for each sites to estimate grain yield from different combinations

Parameters:

Name Type Description Default
sites dictionary
required
Return

Array of arrays with weather, iPAR and GPP data

getCombinations(functype='PRFT', cols=None, RUE=None, Tmin=None, Toptmin=None, Topt=None, Toptmax=None, Tmax=None, TminFactor=None, Lvpd=None, Uvpd=None, SFvpd_Lthres=None, SFvpd_Uthres=None, isVPDStress=False) #

Generate combinations to establish the optimum temperature response for grain-filling period and estimate grain yield.

Parameters:

Name Type Description Default
functype str

Type of temperature response function (eg. PRFT, WETF, TPF)

'PRFT'
cols int

Number of daily records in growing period

None
RUE array

Array of RUE values

None
Tmin array

Array of minimum temperature values

None
Toptmin array

Array of Optimun minimum temperature values

None
Topt array

Array of Optimun temperature values

None
Toptmax array

Array of Optimun maximum temperature values

None
Tmax array

Array of maximum temperature values

None
TminFactor array

Array of minimum temperature factor

None
Lvpd array

Array of lower VPD values

None
Uvpd array

Array of lower VPD values

None
SFvpd_Lthres array

Array of lower VPD stress factor values

None
SFvpd_Uthres array

Array of lower VPD stress factor values

None
isVPDStress bool

True/False value for using VPD stress condition

False
Return

Array of combinations and an array to save results

getGYield_forCombinations(functype, df_GYield, data_input, array_params_to_run, isVPDStress, array_results, saveFile=True, returnDF=True, fmt='parquet') #

Estimate grain yield using parameters for each combinations

Parameters:

Name Type Description Default
df_GYield array

Dataframe with observed grain yield

required
data_input array

Array of inputs containing weather, iPAR, PRFT and GPP data for each site.

required
array_params_to_run array

Array of combinations (RUE, TOpt and TminFactor) to simulate

required
isVPDStress bool

True/False value for using VPD stress condition

required
array_results array

Array used to save results

required
saveFile bool

True if save file in results folder

True
returnDF bool

True if return a pandas dataframe. Use False when the combinations are too large.

True
fmt str

Format to save file. Comma separate value (csv) or Apache parquet (parquet). Default is parquet

'parquet'
Return

A dataframe or table with results

getCombinations_Metrics(functype, isVPDStress, df_GYield, array_params_to_run, array_results, saveFile=True, fmt='parquet') #

Get evaluation metrics for each simulation

Parameters:

Name Type Description Default
functype str

Type of temperature response function (eg. PRFT, WETF, TPF)

required
isVPDStress bool

True/False value for using VPD stress condition

required
df_GYield array

Dataframe with observed grain yield

required
array_params_to_run array

Array of combinations (RUE, TOpt and TminFactor) to simulate

required
array_results array

Array used to save results

required
saveFile bool

True if save file in results folder

True
fmt str

Format to save file. Comma separate value (csv) or Apache parquet (parquet). Default is parquet

'parquet'
Return

A dataframe with several metrics

Returns:

Name Type Description
MAE float

Mean Absolute Error

MSE float

Mean Squared Error

RMSE float

Root Mean Squared Error

RMSRE float

Root Mean Squared Relative Error

MAPE float

Mean Absolute Percentage Error

pvalue float

p-value

R2 float

R Squared metric

EF float

Nash-Sutcliffe metric

intercept float

Intercept of the regression model

slope float

Slope of the regression model

Cb float

A bias correction factor

CCC float

Concordance correlation coefficient

Accuracy float

Accuracy in percentage

gpp #

calcGPP(SolRad, TF, iPAR, RUE=3.0, stressFactor=1.0) #

Estimate the Gross primary production

Parameters:

Name Type Description Default
SolRad float

Solar Radiation

required
TF float

Temperature function result (PRFT, WETF, TPF)

required
iPAR float

the photosynthetically active radiation (PAR) intercepted by a plant or crop estimated from NDVI

required
RUE float

Radiation-use efficiency. Default value is 3.0 gMJ^−1

3.0
stressFactor float

Stress Factor (eg. VPD stress factor)

1.0
Deprecated.

This function only use one value for each paramters. it is not optimized for run models in parallel.

Returns:

Type Description
float

the gross primary production (GPP)

apply_GPP_v0(SolRad, PRFT, iPAR, RUE=3.0, stressFactor=1.0) #

calculateGPP(SolRad, PRFT, iPAR, RUE=3.0, stressFactor=1.0) #

Estimate the Gross primary production. The accumulated dry matter from heading to maturity

# GPP = Solar Radiation × TemFun × VPD_StressFactor × iPAR_fromNDVI × RUE 
GPP = SolRad * 0.5 * RUE * PRFT * iPAR * stressFactor

Parameters:

Name Type Description Default
SolRad float

Solar Radiation

required
PRFT float

Photosynthesis reduction factor

required
iPAR float

the photosynthetically active radiation (PAR) intercepted by a plant or crop

required
RUE float

Radiation-use efficiency. Default value is 3.0 gMJ^-1

3.0
stressFactor float

Stress Factor

1.0

Returns:

Type Description
float

a number or array of values with the gross primary production (GPP)

applyGPP_VPDStress(SolRad, PRFT, iPAR, SFvpd, RUE=3.0) #

calculateGPP_VPDStress(SolRad, PRFT, iPAR, SFvpd, RUE=3.0) #

Estimate the Gross primary production with stressed VPD

GPP = SolRad * 0.5 * RUE * PRFT * iPAR * SFvpd

Parameters:

Name Type Description Default
SolRad float

Solar Radiation

required
PRFT float

Photosynthesis reduction factor

required
iPAR float

the photosynthetically active radiation (PAR) intercepted by a plant or crop

required
RUE float

Radiation-use efficiency. Default value is 3.0

3.0
SFvpd float

Vapor Pressure Deficit (VPD) stress factor

required

Returns:

Type Description
float

a number or array of values with the gross primary production (GPP)

estimate(data, params, is_VPDStress, tf, results) #

An optimized function for estimating GPP for all observations using one of the three Temperature Function (TF) such as PRFT, WETF and TPF.

Parameters:

Name Type Description Default
data object

Array of arrays containing tn, tx, ndvi, solrad, VPDx, ipar, GPP datasets

required
params object

An array with RUE, tminFactor, Topt, Lvpd, Uvpd, SFvpd_Lthres, SFvpd_Uthres values

required
is_VPDStress array

Array of one value with T/F if Vapor Pressure Deficit stress affecting grain yield. Default is [False].

required
tf array

Array of one value representing the type of function. [1]: PRFT; [2]: WETF; [3]: TPF.

required
results array

Empty array for outputs.

required

Returns:

Name Type Description
results array

An array with estimated yield for each site.

gyield #

estimate(data, params, is_VPDStress, tf, results) #

An optimized function for estimating grain yield in one step for all observations using one of the three Temperature Function (TF) such as PRFT, WETF and TPF.

Parameters:

Name Type Description Default
data object

Array of arrays containing tn, tx, ndvi, solrad, VPDx, ipar, GPP datasets

required
params object

An array with RUE, tminFactor, Topt, Lvpd, Uvpd, SFvpd_Lthres, SFvpd_Uthres values

required
is_VPDStress array

Array of one value with T/F if Vapor Pressure Deficit stress affecting grain yield. Default is [False].

required
tf array

Array of one value representing the type of function. [1]: PRFT; [2]: WETF; [3]: TPF.

required
results array

Empty array for outputs.

required

Returns:

Name Type Description
results array

An array with estimated yield for each site.

ipar #

calcIPAR(ndvi) #

Total light interception - iPAR

Reference

iPAR = NDVI * 1.25 - 0.19 # between heading and maturity (Campos et al. 2018)

iPAR = NDVI * 1.25 - 0.21 Daughtry et al. (1992)

  • Asrar, G., Fuchs, M., Kanemasu, E.T., Hatfield, J.L., 1984. Estimating absorbed photosynthetic radiation and leaf area index from spectral reflectance in wheat. Agron. J. 76, 30-306.

  • Campos 2018 Remote sensing-based crop biomass with water or light-driven crop growth models in wheat commercial fields.

Deprecated.

Stop using this function. This function estimate iPAR using only one value for each parameters.

Parameters:

Name Type Description Default
ndvi array

Array of float values

required

Returns:

Type Description
array

An array of Total light interception values

estimate_IPAR(ndvi=None) #

Total light interception - iPAR.

It is assumed that NDVI at maturity is 0.25.

Reference

iPAR = NDVI * 1.25 - 0.19 # between heading and maturity (Campos et al. 2018)

iPAR = NDVI * 1.25 - 0.21 Daughtry et al. (1992)

  • Asrar, G., Fuchs, M., Kanemasu, E.T., Hatfield, J.L., 1984. Estimating absorbed photosynthetic radiation and leaf area index from spectral reflectance in wheat. Agron. J. 76, 30-306.

  • Campos 2018 Remote sensing-based crop biomass with water or light-driven crop growth models in wheat commercial fields.

Parameters:

Name Type Description Default
ndvi array

Array of float values

None

Returns:

Type Description
array

An array of Total light interception values

prft #

calcPRFT(TDay, TOpt=18) #

Estimate Photosynthesis reduction factor (PRFT)

PRFT = 1 - 0.0025 * (TDay - TOpt)^2

Deprecated.

Stop using this function. This function estimate PRFT using only one value for each parameters.

Parameters:

Name Type Description Default
TDay float

Number or array of Day Temperatures

required
TOpt float

Optimum Temperature. Default value 18

18

Returns:

Type Description
float

A number or array of PRFT

calculatePRFT(Tday, Topt=18) #

Estimate Photosynthesis reduction factor (PRFT) in parallel.

PRFT = 1 - 0.0025 * (TDay - TOpt)^2

Parameters:

Name Type Description Default
Tday float

Number or array of Day Temperatures

required
Topt float

Optimum Temperature. Default value 18

18

Returns:

Type Description
float

A number or array of PRFT

sfvpd #

calcSFvpd(VPDx, Lvpd, Uvpd, SFvpd_Lthres, SFvpd_Uthres) #

getSFvpd(VPDx, Lvpd, Uvpd, SFvpd_Lthres, SFvpd_Uthres) #

apply_SFvpd(VPDMAX, Lvpd=1, Uvpd=4, SFvpd_Lthres=0.2, SFvpd_Uthres=1) #

calculateSFvpd(VPDMAX, Lvpd=1, Uvpd=4, SFvpd_Lthres=0.2, SFvpd_Uthres=1) #

Calculation of Vapor pressure deficit (VPD) stress factor

Parameters:

Name Type Description Default
VPDMAX array

Array of daily temperature values

required
Lvpd float

A number for threshold of lower VPD. Default is 1

1
Uvpd array

A number for threshold of upper VPD. Default is 4

4
SFvpd_Lthres array

A number for threshold of stress factor of lower VPD. Default is 0.2

0.2
SFvpd_Uthres array

A number for threshold of stress factor of upper VPD. Default is 1

1

Returns:

Type Description
array

A number or array of stressed factors of VPD

tday #

calcTDay(Tmin, Tmax, tminFactor=0.25) #

Calculate day time temperature. TDay is a function of weighted Tmin and weighted Tmax.

 TDay = 0.75 * Tmax + 0.25 * TMin
Deprecated.

Stop using this function. This function estimate day time temperature (TDay) using only one value for each parameters.

Parameters:

Name Type Description Default
Tmin float

Number or array of Minimum Temperatures

required
Tmax float

Number or array of Maximum Temperatures

required
tminFactor float

Minimum Temperature factor

0.25

Returns:

Type Description
float

A number of Day Temperatures

getTDay(Tmin, Tmax, tminFactor=0.25) #

apply_TDay(Tmin, Tmax, tminFactor) #

estimate_TDay(Tmin=None, Tmax=None, tminFactor=0.25) #

An optimized function to calculate day time temperature in parallel.

 TDay = 0.75 * Tmax + 0.25 * TMin

Parameters:

Name Type Description Default
Tmin float

Number or array of Minimum Temperatures

None
Tmax float

Number or array of Maximum Temperatures

None
tminFactor float

Minimum Temperature factor

0.25

Returns:

Type Description
float

A number of Day Temperatures

util #

find_nearest_value(array, value) #

Find nearest value to a user define value from array

Parameters:

Name Type Description Default
array array

Array of values

required
value int

value to find into the array

required

Returns:

Type Description
int

a number with the nearest value found

find_nearest_index(array, values) #

Find nearest index to a user define value from array

Parameters:

Name Type Description Default
array array

Array of values

required
values int

value to find into the array

required

Returns:

Type Description
int

a number with the nearest index found

find_nearest(array, value) #

Find nearest index and value to a user define value from array

Parameters:

Name Type Description Default
array array

Array of values

required
value int

value to find into the array

required

Returns:

Type Description
int

a number with the nearest value found

CCC(y_true, y_pred) #

Lin's Concordance correlation coefficient

Computes Lin's (1989, 2000) concordance correlation coefficient for agreement on a continuous measure obtained by two methods. The concordance correlation coefficient combines measures of both precision and accuracy to determine how far the observed data deviate from the line of perfect concordance (that is, the line at 45 degrees on a square scatter plot).

Parameters:

Name Type Description Default
y_true array

Array of observed values

required
y_pred array

Array of predicted values

required

Returns:

Type Description
float

Concordance correlation coefficient

Cb(x, y) #

A bias correction factor that measures how far the best-fit line deviates from a line at 45 degrees (a measure of accuracy).

No deviation from the 45 degree line occurs when Cb = 1. See Lin (1989 page 258).

Parameters:

Name Type Description Default
x array

Array of observed values

required
y array

Array of predicted values

required

Returns:

Type Description
float

Bias correction factor

getScores(df, fld1=None, fld2=None) #

Get stats for model results

Parameters:

Name Type Description Default
df array

A pandas dataframe with Observed and Simulated values

required
fld1 str

Name of the columns or field with observed values

None
fld2 str

Name of the columns or field with predicted values

None

Returns:

Name Type Description
r2score float

R squared metric

mape float

Mean absolute percentage error

rmse float

Root mean squared error

n_rmse float

Normalized RMSE

d_index float

d-index metric

ef float

Nash-Sutcliffe metric

ccc float

Concordance correlation coefficient

cb float

A bias correction factor

accuracy float

Accuracy in percentage

filterTopCombinations(df_m, df_cmb, fnct='PRFT', VPDstress=False, top=3, Cb=1.0, ccc=0.86, rmsre=100) #

Filter combinations for selecting Top 3 of the best simulations

Deprecated

Stop using this function, instead use filterSimulations.

Parameters:

Name Type Description Default
df_m array

A dataframe with metrics from each simulations

required
df_cmb array

A dataframe with combinations results

required
fnct str

Temperature response function. default 'PRFT'

'PRFT'
VPDstress bool

Stressed VPD. default False

False
top int

Number of selected records. default 3

3
Cb float

A threshold for Cb metric. default 1.0

1.0
ccc float

A threshold for CCC metric. default 0.86

0.86
rmsre float

A threshold for RMSRE metric. default 100

100

Returns:

Type Description
object

A dataframe with all filtered combinations

filterSimulations(functype='PRFT', VPDstress=False, cmb=None, met=None, cmb_filters=None, met_filters=None, pdFormat=False, dispFig=True, saveFig=False, figname='Fig_topComb_avgYield', figfmt='jpg', saveResults=True, outputPath='./', fmt='parquet') #

Filter a table with several combinations results from the three temperature functions. This function is similar to util.filterTopCombinations function but optimized to work only with Apache parquet files.

Parameters:

Name Type Description Default
functype str

Name of the temperature response function. Default 'PRFT'

'PRFT'
VPDstress bool

Stressed VPD. default False

False
cmb str

Full path of the combinations result file

None
met str

Full path of the metrics result file

None
cmb_filters dict

Dictionary with the parameters to use as a constraints in combonation filters. it must match with the respective temperature function parameters. Default filters: dict( RUE = ('RUE', '=', 3.0 ), TminFactor = ('TminFactor', '=', 0.25 ) )

None
met_filters dict

Dictionary with the parameters to use as a constraints in metrics filters. Default values: metfilters = dict( Cb = ('>=', 0.9), CCC = ('>=', 0.8) )

None
pdFormat bool

Export filtered dataset in pandas format. Default False

False
dispFig bool

Display figure of grain yield correlation. Default is True

True
saveFig bool

Save figure. Default is False

False
figname str

Name of the figure file to be saved

'Fig_topComb_avgYield'
figfmt str

Format of the figure file. JPEG or PDF formats are the available options. Default is pdf.

'jpg'
saveResults bool

Save filtered data. Default True

True
outputPath str

Output folder to save the data

'./'
fmt str

File format to save in csv or parquet. Default is parquet

'parquet'

Returns:

Type Description
object

A dataframe or parquet file with the filtered dataset

figures #

chart_compareResults(df_result=None, fld1=None, fld2=None, alpha=0.75, s=15, xy_lim=2, hue=None, loc_leg=2, ncol=2, ha='left', va='top', title='Observed vs Simulated grain yield', xlabel='Observed Yield (tha$^{-1}$)', ylabel='Simulated Yield (tha$^{-1}$)', dirname='Figures_tFunt', fname='Fig_model_', dispScore=True, dispLegend=True, saveFig=False, showFig=True, fmt='pdf') #

Display a scatter plot to compare two variables in the results

Parameters:

Name Type Description Default
df_result array

A pandas DataFrame with the results and variables to compare

None
fld1 str

Variable or column name to compare

None
fld2 str

Variable or column name to compare

None
alpha float

Transparency of the points in chart

0.75
s float

Size of the points in chart

15
xy_lim int

Used to extend the x-axis limit. Default 2 units

2
hue str

Variable to classify or discriminate the results in colors

None
title str

Title of the figure

'Observed vs Simulated grain yield'
xlabel str

Label of the x-axis

'Observed Yield (tha$^{-1}$)'
ylabel str

Label of the y-axis

'Simulated Yield (tha$^{-1}$)'
dirname str

Folder name to save results

'Figures_tFunt'
fname str

File name to save the figure

'Fig_model_'
dispScore bool

Display the accurracy and others stats of the model

True
dispLegend bool

Display the legend of the chart

True
saveFig bool

Save file in JPG or PDF format

False
fmt str

Format of the output

'pdf'

Returns:

Type Description
object

A figure in JPG or PDF format with the filename specified into the folder name

plot_TempFunct(fld1='ObsYield', fld2='SimYield', hue='location', ncol=6, s=80, alpha=0.45, xy_lim=1, fonts_axes=12, fonts_titles=14, dispScore=False, errorbar=False, saveFig=True, showFig=True, path_to_save_results='./', dirname='Figures', fname='Fig_1', fmt='pdf') #