Skip to content

Commit

Permalink
use explicit meteo variables instead of weatherdata query parameters …
Browse files Browse the repository at this point in the history
…in ipm_SEIR
  • Loading branch information
christian34 committed Sep 15, 2023
1 parent 8d5a14d commit 5ea7a55
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/epymix/wralea/adaptor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random

from openalea.core import *

import numpy as np
from epymix.rain_WD import rain as _rain ## f_rain
from epymix.inoculum import inoculum as _inoculum ## inoculum
from epymix.configuration import configuration as _configuration
Expand Down Expand Up @@ -148,7 +148,10 @@ def SEIR(
)


def ipm_SEIR(delta_t=10,

def ipm_SEIR(air_temperature=[10]*24*60,
rainfall=[1]*24*30+[5]*24*30,
delta_t=10,
rainfall_threshold=3,
scenario_ino='initial_inoculum',
Lx=1,
Expand Down Expand Up @@ -194,8 +197,14 @@ def ipm_SEIR(delta_t=10,
sigma_asco=9000000,
inf_begin=0
) :

ddrain = rain(delta_t=delta_t, rainfall_threshold=rainfall_threshold)[0]
air_temperature = np.array(air_temperature)
rainfall = np.array(rainfall)
daily_max = np.max(air_temperature[:(len(air_temperature) // 24) * 24].reshape(-1, 24), axis=1)
daily_min = np.min(air_temperature[:(len(air_temperature) // 24) * 24].reshape(-1, 24), axis=1)
frain = np.where(rainfall > rainfall_threshold, rainfall, 0)
daily_rain = np.sum(frain[:(len(frain) // 24) * 24].reshape(-1, 24), axis=1)
dd = np.cumsum((daily_min + daily_max) / 2)
ddrain = np.ceil(dd[np.argwhere(daily_rain > 0)] / delta_t)
inoc_init, ng_ext0 = inoculum(scenario_ino=scenario_ino,
Lx=Lx,
Ly=Ly,
Expand Down

0 comments on commit 5ea7a55

Please sign in to comment.