Skip to content

Commit b354341

Browse files
authored
Merge pull request #910 from jvgeiger/fix/sonarqube-lisf-557ww-7.4
Address SonarQube findings for upcoming LISF 557WW 7.4.5 release
2 parents 5cc6765 + ec6d6ed commit b354341

File tree

6 files changed

+5
-16
lines changed

6 files changed

+5
-16
lines changed

ldt/utils/usaf/bcsd_preproc/lib_bcsd_metrics/All_functions.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ def Sel_var (SEL_CIM_DATA, VAR_NAME, MODEL):
1717
else:
1818
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.SoilMoist_tavg.sum(dim='SoilMoist_profiles') ## Summing soil moisture from all layers
1919
if VAR_NAME == 'Surface-SM':
20-
if (MODEL=='CLSM'):
21-
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.SoilMoist_tavg.isel(SoilMoist_profiles=0) # for clsm the total soil moisture is in the third layer
22-
else:
23-
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.SoilMoist_tavg.isel(SoilMoist_profiles=0) ## Summing soil moisture from all layers
20+
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.SoilMoist_tavg.isel(SoilMoist_profiles=0)
2421

2522
elif VAR_NAME == 'Total-Runoff':
2623
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.Qs_tavg+SEL_CIM_DATA.Qsb_tavg ## Adding total surface runoff with sub-surface runoff

ldt/utils/usaf/bcsd_preproc/lib_bcsd_metrics/BCSD_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def CALC_BCSD(OBS_CLIM_ALL, FCST_CLIM_ALL, LEAD_FINAL, TARGET_FCST_VAL_ARR, TARG
5454
#BIAS_CORRECTED_VALUE = lookup(TARGET_FCST_QUANT, OBS_QUANT_TS.values, OBS_CLIM_TS.values, len(OBS_CLIM_TS.values), BC_VAR, 'DATA', obs_mean, obs_sd, obs_skew, TINY);
5555

5656
if (BC_VAR=='PRCP') and (BIAS_CORRECTED_VALUE<0): ## This is just a hack to check we are not getting negative value of precipitation
57-
print (TARGET_FCST_VAL, TARGET_FCST_QUANT, fcst_yr, LEAD_NUM, ens_num, lat_num, lon_num)
57+
print (TARGET_FCST_VAL, TARGET_FCST_QUANT, fcst_yr, LEAD_NUM, ens_num)
5858

5959
## Now storing the bias corrected anomaly
6060
CORRECT_FCST_COARSE[fcst_yr, LEAD_NUM, ens_num] = BIAS_CORRECTED_VALUE

ldt/utils/usaf/bcsd_preproc/lib_bcsd_metrics/BCSD_stats_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def get_F_from_data_EVI(mean, sd, x, TINY):
217217

218218
if(F>=1.0) or (F<=0.0):
219219
print ("Error in get_F_from_data_EVI")
220-
print ("Bad quantile: data={:0.2f} mean={0.2f} sd={0.2f} quant={0.2f}".format(x,mean,sd,F));
220+
print ("Bad quantile: data={:0.2f} mean={:0.2f} sd={:0.2f} quant={:0.2f}".format(x,mean,sd,F));
221221
sys.exit(1);
222222
else:
223223
return F;
@@ -226,7 +226,7 @@ def get_data_from_F_EVI(mean, sd, F, TINY):
226226
#Gumbel (EV Type I distribution) for maxima
227227
if(F>=1.0) or (F<=0.0):
228228
print ("Error in get_data_from_F_EVI")
229-
print ("Bad quantile: mean={0.2f} sd={0.2f} quant={0.2f}".format(mean,sd,F))
229+
print ("Bad quantile: mean={:0.2f} sd={:0.2f} quant={:0.2f}".format(mean,sd,F))
230230
sys.exit(0);
231231
b = 3.14159/(sd*sqrt(6))
232232
a = mean-0.5772/b

ldt/utils/usaf/bcsd_preproc/lib_bcsd_metrics/Shrad_modules.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def plotmap(var, lats, lons, lat_min, lat_max, lat_int, lon_min, lon_max, lon_in
7979
if plottype == 'mesh':
8080
cs=m.pcolormesh(xi, yi, var, vmax=cbmax, vmin=cbmin, cmap=cmap)
8181
elif plottype == 'contour':
82-
cmap = cmap
8382
cmap.set_under(col_under)
8483
cmap.set_over(col_higher)
8584
norm = mpl.pyplot.cm.colors.Normalize(vmax=cbmax, vmin=cbmin, clip=False)

lvt/utils/usaf/s2smetric/lib_bcsd_metrics/All_functions.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ def Sel_var (SEL_CIM_DATA, VAR_NAME, MODEL):
1919
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.SoilMoist_tavg.isel(soil_layer=0)*0.05+SEL_CIM_DATA.SoilMoist_tavg.isel(soil_layer=1)*0.15+SEL_CIM_DATA.SoilMoist_tavg.isel(soil_layer=2)*0.3+SEL_CIM_DATA.SoilMoist_tavg.isel(soil_layer=3)*0.5
2020

2121
if VAR_NAME == 'Surface-SM':
22-
if (MODEL=='CLSM'):
23-
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.SoilMoist_tavg.isel(soil_layer=0) # for clsm the total soil moisture is in the third layer
24-
else:
25-
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.SoilMoist_tavg.isel(soil_layer=0) ## Summing soil moisture from all layers
22+
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.SoilMoist_tavg.isel(soil_layer=0)
2623

2724
elif VAR_NAME == 'Total-Runoff':
2825
VAR_SEL_CLIM_DATA = SEL_CIM_DATA.Qs_tavg+SEL_CIM_DATA.Qsb_tavg ## Adding total surface runoff with sub-surface runoff
@@ -43,15 +40,12 @@ def GET_BOUNDARY(REGION_NAME):
4340
BOUNDARY_EA = (22, 55, -12, 23); BOUNDARY_WA = (-19, 26, -5, 25)
4441
##BOUNDARY_SA = (8, 52, -37, 0); BOUNDARY_FAME = (-20, 60, -40, 40)
4542
BOUNDARY_SA = (8, 52, -37, 6); BOUNDARY_FAME = (-20, 55, -40, 40)
46-
#BOUNDARY_SA1 = (24, 33, -31, -24)
4743
if (REGION_NAME == 'EA'):
4844
Boundary = BOUNDARY_EA
4945
elif (REGION_NAME == 'WA'):
5046
Boundary = BOUNDARY_WA
5147
elif (REGION_NAME == 'SA'):
5248
Boundary = BOUNDARY_SA
53-
elif (REGION_NAME == 'SA1'):
54-
Boundary = BOUNDARY_SA1
5549
else:
5650
Boundary = BOUNDARY_FAME
5751
return Boundary

lvt/utils/usaf/s2smetric/lib_bcsd_metrics/Shrad_modules.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def plotmap(var, lats, lons, lat_min, lat_max, lat_int, lon_min, lon_max, lon_in
7878
if plottype == 'mesh':
7979
cs=m.pcolormesh(xi, yi, var, vmax=cbmax, vmin=cbmin, cmap=cmap)
8080
elif plottype == 'contour':
81-
cmap = cmap
8281
cmap.set_under(col_under)
8382
cmap.set_over(col_higher)
8483
norm = mpl.pyplot.cm.colors.Normalize(vmax=cbmax, vmin=cbmin, clip=False)

0 commit comments

Comments
 (0)