ecohydro / maize-Toff

Repo for modeling analysis of of maize yield variability and tradeoffs between yield and crop failure.
4 stars 2 forks source link

Assign reasonable defaults to classes? #11

Closed noah-de closed 5 years ago

noah-de commented 5 years ago

@Ntkrell and @noah-de were thinking of taking the kwargs dictionary from runmodel.py and coding them in as default kwargs in the respective models (Crop, Climate & Soil). Do you have any opinion on this @kcaylor?

In a collaborative coding session, we saw that this enables rapid setup of running multiple simulations.

noah-de commented 5 years ago

Here is a pseudo code demo:


kc_collection = {}

for day in range(reasonable_range):
  climate = Climate(t_seas=day)
  soil = Soil()
  crop = Crop(soil=soil)
  soil.set_nZr(crop)
  model  = CropModel(crop,climate, soil)
  model.run()
  kc_key = str(day)+"kc"
  kc_collection["kc__key"] = model.kc
kcaylor commented 5 years ago

Seems helpful and makes the model easier to implement. I like the “change this to what you want or get a reasonable default” model.

Ntkrell commented 5 years ago

Great! Thanks @kcaylor. We'll work on this and then plan to meet next week.