def func(pars): cropdai=DaisyModel('./hhj.v2-wclover.dai') cropdai.Input['defcrop']['Prod']['RtDR'][1].setvalue(pars[0]) #cropdai.Input['defcrop']['Prod']['RtDR'][3].setvalue(pars[1]) #cropdai.Input['defcrop']['Prod']['RtDR'][4].setvalue(pars[2]) #cropdai.Input['defAOM']['C_per_N'].setvalue(pars[1]) cropdai.save() # cropdai=DaisyModel('./hhj.v2-wclover.dai') # cropdai.Input['defcrop']['LeafPhot']['Fm'].setvalue(pars[1]) #cropdai.Input['defAOM']['C_per_N'].setvalue(pars[3]) # cropdai.save() run_sub_folders(r'.','setup.dai') print('Simulations done') r=opti('Wclover','cloverDM') r+=opti('Ryegrass','grassDM') r+=0.035*opti('Ryegrass','grassN','N') r+=0.035*opti('Wclover','cloverN','N') f = open("myfile3.txt", "a") f.write(str(pars) + " " + str(r) +"\n") f.close() return r
def func(pars): cropdai = DaisyModel('..\common\SB-ryegrass.dai') cropdai.Input['defcrop']['LeafPhot']['Fm'].setvalue(pars[0]) cropdai.save() run_sub_folders(r'.', 'setup.dai') r = opti('Wclover', 'cloverDM') r += opti('Ryegrass', 'grassDM') r += 0.01 * opti('Ryegrass', 'grassN', 'N') r += 0.01 * opti('Wclover', 'cloverN', 'N') return r
def func(pars): # Optimering for RSR parameteren i ryegrass cropdai=DaisyModel('./hhj-ryegrass.dai') cropdai.Input['defAOM']['C_per_N'].setvalue(pars[0]) cropdai.Input['defcrop']['LeafPhot']['Fm'].setvalue(pars[1]) cropdai.save() cropdai=DaisyModel('./hhj.v2-wclover.dai') cropdai.Input['defcrop']['CrpN']['fixate_factor'].setvalue(pars[2]) cropdai.Input['defAOM']['C_per_N'].setvalue(pars[3]) cropdai.Input['defcrop']['LeafPhot']['Fm'].setvalue(pars[4]) cropdai.save() run_sub_folders(r'.','setup.dai') print('Simulations done') r=opti('Wclover','cloverDM') r+=opti('Ryegrass','grassDM') r+=0.035*opti('Ryegrass','grassN','N') r+=0.035*opti('Wclover','cloverN','N') f = open("myfile16.txt", "a") f.write(str(pars) + " " + str(r) +"\n") f.close() return r
def func(pars): cropdai = DaisyModel('..\common\SB-ryegrass.dai') cropdai.Input['defcrop']['LeafPhot']['Fm'].setvalue(pars[0]) cropdai.Input['defAOM']['C_per_N'].setvalue(pars[0]) cropdai.save() cropdai = DaisyModel('..\common\SB-wclover.dai') cropdai.Input['defcrop']['LeafPhot']['Fm'].setvalue(pars[0]) cropdai.Input['defAOM']['C_per_N'].setvalue(pars[0]) cropdai.save() run_sub_folders(r'.', 'setup.dai') print('Simulations done') r = opti('Wclover', 'cloverDM') r += opti('Ryegrass', 'grassDM') r += 0.035 * opti('Ryegrass', 'grassN', 'N') r += 0.035 * opti('Wclover', 'cloverN', 'N') return r
# -*- coding: utf-8 -*- """ Created on Wed Aug 8 14:14:10 2018 @author: sdf945 """ from Daisy import DaisyDlf, DaisyModel import matplotlib.pyplot as plt import numpy as np import datetime as datetime dm= DaisyModel (r'I:\SCIENCE-PLEN-PESTCAST\1_Validation track\DFF\Silstrup\1\Water_Field_Weekly.dlf') sys.path.append(r'h:\Documents\PyDaisy') from pydaisy.Daisy import * dlf = DaisyDlf(r'h:\Documents\PyDaisy\Projects\STYR-N\IND_2_4\DailyP-harvest.dlf') folder = r'I:\SCIENCE-PLEN-PESTCAST\1_Validation track\DFF\Silstrup\6' #Diflufenican leaching result_df_week = DaisyDlf(folder+'\Water_Field_Weekly.dlf') result_dif = DaisyDlf(folder+'\weekly_soil_diflufenican.dlf') matrixflow = result_df_week.Data.values[:,6] bioporeflow = result_df_week.Data.values[:,7] drainflow = matrixflow + bioporeflow matrixleaching = result_dif.Data.values[:,7]