Skip to content

Commit

Permalink
Prefix unused arguments with _
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsource-autofix[bot] authored and JordiBolibar committed Mar 27, 2020
1 parent a7ed460 commit a2ae4bd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion code/adamont_forcings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def find_nearest_altitude(array,value):
idx = (np.abs(array-value)).argmin()
return idx

def find_glacier_idx(glacier_massif, massif_number, altitudes, glacier_altitude, aspects, glacier_aspect):
def find_glacier_idx(glacier_massif, massif_number, altitudes, glacier_altitude, _aspects, _glacier_aspect):
#### Aspects not used for ADAMONT
massif_altitudes_idx = np.where(massif_number == float(glacier_massif))[0]
if(len(massif_altitudes_idx) > 0):
Expand Down
14 changes: 7 additions & 7 deletions code/glacier_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ def array2raster(newRasterfn, rasterOrigin, pixelWidth, pixelHeight, array):
outband.FlushCache()

# Compute the scaling factor fs for the delta h function
def generate_fs(year_smb, year_start, DEM_sorted_current_glacier_u, DEM_sorted_CG_n_u, delta_h_DEM_current_glacier,
masked_DEM_current_glacier_u, delta_h_dh_current_glacier, masked_ID_current_glacier_u, pixel_area, glacierArea):
def generate_fs(year_smb, _year_start, DEM_sorted_current_glacier_u, DEM_sorted_CG_n_u, delta_h_DEM_current_glacier,
masked_DEM_current_glacier_u, delta_h_dh_current_glacier, _masked_ID_current_glacier_u, pixel_area, glacierArea):
# We compute the fs factor in order to scale the normalized delta h parameters
vol_distrib = 0

Expand Down Expand Up @@ -493,7 +493,7 @@ def get_aspect_deg(aspect):


# We crop the initial rasters to the extent of the GLIMS 2003 or 2015 database
def crop_inital_rasters_to_GLIMS(path_glacier_ID_rasters, path_glacier_DEM_rasters, path_glacier_outline, glacier_shapefile, glacierID, midfolder, year_start):
def crop_inital_rasters_to_GLIMS(path_glacier_ID_rasters, path_glacier_DEM_rasters, path_glacier_outline, _glacier_shapefile, glacierID, _midfolder, year_start):
if(year_start == 2004):
print("glacierID: " + str(glacierID))

Expand Down Expand Up @@ -587,7 +587,7 @@ def get_flowline_20_length(flowline_feature, flowline_coords, alt_20_flowline_id
return flowline_20_length, fixed_length

# Computes the slope of the lowermost 20% of a glacier
def get_slope20(masked_DEM_current_glacier_u, DEM_sorted_current_glacier_u, glacierName, flowline, path_raster_current_DEM, yearly_glacier_slope20):
def get_slope20(_masked_DEM_current_glacier_u, DEM_sorted_current_glacier_u, glacierName, flowline, path_raster_current_DEM, yearly_glacier_slope20):

raster_current_DEM = gdal.Open(path_raster_current_DEM)

Expand Down Expand Up @@ -1310,13 +1310,13 @@ def store_rasters(masked_DEM_current_glacier_u, masked_ID_current_glacier_u, mid

def glacier_evolution(masked_DEM_current_glacier, masked_ID_current_glacier,
delta_h_dh_current_glacier, delta_h_DEM_current_glacier,
DEM_sorted_current_glacier,
_DEM_sorted_current_glacier,
daily_meteo_data, meteo_anomalies,
flowline, raster_current_DEM, current_glacier_DEM, store_plots,
flowline, _raster_current_DEM, current_glacier_DEM, store_plots,
glacierName, glacierID, glimsID, massif, lat, lon, aspect,
midfolder, pixel_area, glaciers_with_errors, glims_rabatel,
lasso_scaler, lasso_model, ensemble_SMB_models,
year_range, ref_start, ref_end, SAFRAN_idx, overwrite):
year_range, ref_start, _ref_end, SAFRAN_idx, overwrite):

print("Applying glacier evolution...")

Expand Down
2 changes: 1 addition & 1 deletion code/safran_forcings.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def compute_local_anomalies(idx, glacier_CPDDs, glacier_winter_snow, glacier_sum
# Computes monthly meteo anomalies at glacier scale
def compute_monthly_anomalies(idx, glacier_mon_temp, glacier_mon_snow,
local_mon_temp_anomalies, local_mon_snow_anomalies,
raw_local_mon_temp_anomalies, raw_local_mon_snow_anomalies):
_raw_local_mon_temp_anomalies, _raw_local_mon_snow_anomalies):

# The monthly meteo anomalies, as well as the seasonal ones, are always computed with respect to the 1984-2014 period
mon_range = range(0, 12)
Expand Down
4 changes: 2 additions & 2 deletions code/smb_model_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def plot_ic_criterion(model, name, color):
plt.xlabel('alpha')
plt.ylabel('criterion')

def lasso_CV_model_selection(X, y, fig_idx, year_groups, plot):
def lasso_CV_model_selection(X, y, fig_idx, _year_groups, plot):

# #############################################################################
# LassoLarsIC: least angle regression with BIC/AIC criterion
Expand Down Expand Up @@ -342,7 +342,7 @@ def lasso_CV_model_selection(X, y, fig_idx, year_groups, plot):
return model_CV


def generate_SMB_models(SMB_raw, season_raw_meteo_anomalies_SMB, mon_temp_anomalies, mon_snow_anomalies, spatiotemporal_flag, first_year, glims_rabatel, glims_2015, glims_2003, glims_1985, glims_1967, fig_idx):
def generate_SMB_models(SMB_raw, season_raw_meteo_anomalies_SMB, mon_temp_anomalies, mon_snow_anomalies, spatiotemporal_flag, first_year, glims_rabatel, _glims_2015, glims_2003, glims_1985, glims_1967, fig_idx):


# We create the full matrix for the spatiotemporal multiple linear regression
Expand Down
2 changes: 1 addition & 1 deletion code/smb_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def interpolate_glims_variable(variable_name, glims_glacier, glims_2003, glims_1

return interp_1984_2014

def interpolate_extended_glims_variable(variable_name, glims_glacier, glims_2015, glims_1985, glims_1967):
def interpolate_extended_glims_variable(variable_name, glims_glacier, glims_2015, glims_1985, _glims_1967):
# In case there are multiple results, we choose the one with the most similar area

# 2015 glacier inventory
Expand Down

0 comments on commit a2ae4bd

Please sign in to comment.