RDCEP / psims

GNU Affero General Public License v3.0
30 stars 24 forks source link

Management events in the experiment template #3

Closed schmidtfederico closed 9 years ago

schmidtfederico commented 9 years ago

Hello,

I've noticed that the experiment template supplied in the repo has two fertilizer management events specified and that if I remove one of them pSIMS fails to create a DSSAT experiment file.

"management": {
  "events": [
  {  ...
    "event": "planting"
  } ,  {
    ...
    "event": "fertilizer"
  },  {
    ...
    "event": "fertilizer"
  },  {
    ...
    "event": "irrigation"
  },  {
    ...
    "event": "harvest"
  }
]

Is there a reason why there should always be two of them? Also, looking through camp2json.py script I found that the script is looking for the events in the specific order found in that template (at hard-coded indexes):

man = get_obj(e, 'management', {})
    if man != {}:
        pdate = man['events'][0]['date']
        dict_replace(e, 'date', str(ref_year) + pdate[4 :], occ = 1) # planting date
        idate = man['events'][3]['date']
        dict_replace(e, 'date', str(ref_year) + idate[4 :], occ = 4) # irrigation date
        hdate = man['events'][4]['date']
        dict_replace(e, 'date', str(ref_year + 1) + '1231', occ = 5) # harvest date

This also brings me another question: is there a way I can specify two irrigation events in the management section?

Thank you very much for your help, Federico.

joshuaelliott commented 9 years ago

that's a good question. because we use a template and search and replace approach to generate the experiment files, it was expedient at the beginning to just set a number of management events. in the case where we only want one fertilizer applciation we just set the fertilizer amount as N for event1 and 0 for event2.

i don't know the answer regarding irrigation. we have not made any attempt to support manual irrigation thus far (only automatic irrigation) so i can't really say whether or not this would work. the problem with this obviously is that you'd have to add many new events to the template and right now i don't think the translators are smart enough to support that. we hope that in the next version psims will be able to support arbitrary events and manual irrigation and etc.