From 7c721fa60ad601455f90e5e42d6b159884571f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20G=C3=B3mez-Dans?= Date: Wed, 27 Feb 2019 15:26:28 +0000 Subject: [PATCH 1/2] Allow the user to select what outputs to gather Change allows the user to select what outputs from WOFOST should be gathered. --- enwofost/enwofost.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/enwofost/enwofost.py b/enwofost/enwofost.py index 4f9065e..cb0673b 100644 --- a/enwofost/enwofost.py +++ b/enwofost/enwofost.py @@ -223,7 +223,9 @@ def define_prior_distributions(chunk=data_dir+"par_prior.csv"): def ensemble_wofost(lon = 115.55, lat=38., start = dt.date(2008,10,12), end = None, en_size = 3, prior_file = data_dir+"par_prior.csv", - weather_type = "NASA", weather_path = None, out_en_file = data_dir+"WOFOST_par_ensemble.npy", data_dir=None): + weather_type = "NASA", weather_path = None, + out_en_file = data_dir+"WOFOST_par_ensemble.npy", + data_dir=None, varnames = ["day", "TAGP", "LAI", "TWSO","DVS"]): """ This is a function to generate a emsemble of WOFOST paramters and corresponding output. you need to specify Longitude (lon), Latitude (lat), @@ -269,7 +271,7 @@ def ensemble_wofost(lon = 115.55, lat=38., start = dt.date(2008,10,12), #home = os.path.dirname(os.path.realpath("__file__")) #data_dir = home+"/data/" - varnames = ["day", "TAGP", "LAI", "TWSO","DVS"] + #varnames = ["day", "TAGP", "LAI", "TWSO","DVS"] tmp={} cropfile = os.path.join(data_dir, 'WWH108.CAB') @@ -375,6 +377,7 @@ def ensemble_wofost(lon = 115.55, lat=38., start = dt.date(2008,10,12), msg = "Reached maturity at {DOM} with max LAI of {LAIMAX} "\ "and a yield of {TWSO} kg/ha." print(msg.format(**summary_output[0])) + import ipdb;ipdb.set_trace() for var in varnames: tmp[var] = [t[var] for t in output] theta_dict["LAI"]=tmp["LAI"][-181:] From b4c19ce4a5bcb2e08c57fc0220bfb4afb35e53fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20G=C3=B3mez-Dans?= Date: Wed, 27 Feb 2019 15:36:00 +0000 Subject: [PATCH 2/2] removed tracer --- enwofost/enwofost.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/enwofost/enwofost.py b/enwofost/enwofost.py index cb0673b..18a320f 100644 --- a/enwofost/enwofost.py +++ b/enwofost/enwofost.py @@ -377,13 +377,14 @@ def ensemble_wofost(lon = 115.55, lat=38., start = dt.date(2008,10,12), msg = "Reached maturity at {DOM} with max LAI of {LAIMAX} "\ "and a yield of {TWSO} kg/ha." print(msg.format(**summary_output[0])) - import ipdb;ipdb.set_trace() + for var in varnames: tmp[var] = [t[var] for t in output] theta_dict["LAI"]=tmp["LAI"][-181:] theta_dict["day"]=tmp["day"][-181:] theta_dict["Yield"]=tmp["TWSO"][-1] outdata.append(theta_dict) + np.save(out_en_file, outdata) if __name__ == "__main__":