Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ConfSoilMoisture.py and some edits in Variable.py and ilamblib.py #44

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed rel scoring
ypwong22 committed Feb 1, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 02d66d900cf2aa82e66726d3556062ddf383000e
58 changes: 29 additions & 29 deletions src/ILAMB/ConfSoilMoisture.py
Original file line number Diff line number Diff line change
@@ -1340,35 +1340,35 @@ def _composeSubset(a_dep, a_ind):
m.color,
os.path.join(self.output_path,"%s_%s_rel_func_%s.png" % (m.name,region,ind_name)))

# Score the distribution
score_list = []
for ref_dist, com_dist in zip(ref_dist_list, com_dist_list):
score = _scoreDistribution(ref_dist,com_dist)
score_list.append(score)
score = np.sum(np.array(score_list)*(self.depths[:,1] - self.depths[:,0])) / \
(self.depths[-1,1] - self.depths[0,0])
sname = "%s Hellinger Distance %s" % (longname,region)
if sname in scalars.variables:
scalars.variables[sname][0] = score
else:
Variable(name = sname,
unit = "1",
data = score).toNetCDF4(results,group="Relationships")

# Score the functional response
score_list = []
for ref_mean, com_mean in zip(ref_mean_list, com_mean_list):
score = _scoreFunction(ref_mean,com_mean)
score_list.append(score)
score = np.sum(np.array(score_list)*(self.depths[:,1] - self.depths[:,0])) / \
(self.depths[-1,1] - self.depths[0,0])
sname = "%s RMSE Score %s" % (longname,region)
if sname in scalars.variables:
scalars.variables[sname][0] = score
else:
Variable(name = sname,
unit = "1",
data = score).toNetCDF4(results,group="Relationships")
# Score the distribution
score_list = []
for ref_dist, com_dist in zip(ref_dist_list, com_dist_list):
score = _scoreDistribution(ref_dist,com_dist)
score_list.append(score)
score = np.sum(np.array(score_list)*(self.depths[:,1] - self.depths[:,0])) / \
(self.depths[-1,1] - self.depths[0,0])
sname = "%s Hellinger Distance %s" % (longname,region)
if sname in scalars.variables:
scalars.variables[sname][0] = score
else:
Variable(name = sname,
unit = "1",
data = score).toNetCDF4(results,group="Relationships")

# Score the functional response
score_list = []
for ref_mean, com_mean in zip(ref_mean_list, com_mean_list):
score = _scoreFunction(ref_mean,com_mean)
score_list.append(score)
score = np.sum(np.array(score_list)*(self.depths[:,1] - self.depths[:,0])) / \
(self.depths[-1,1] - self.depths[0,0])
sname = "%s RMSE Score %s" % (longname,region)
if sname in scalars.variables:
scalars.variables[sname][0] = score
else:
Variable(name = sname,
unit = "1",
data = score).toNetCDF4(results,group="Relationships")


def _sensitivity(self, m):
1 change: 1 addition & 0 deletions src/ILAMB/ModelResult.py
Original file line number Diff line number Diff line change
@@ -418,6 +418,7 @@ def derivedVariable(self,variable_name,expression,lats=None,lons=None,initial_ti

np.seterr(divide='ignore',invalid='ignore')
result,unit = il.SympifyWithArgsUnits(expression,args,units)
result = result.astype(var.data.data.dtype)
np.seterr(divide='raise',invalid='raise')
mask += np.isnan(result)
result = np.ma.masked_array(np.nan_to_num(result),mask=mask)