Skip to content

Commit

Permalink
fix: type error in minimisation, config files
Browse files Browse the repository at this point in the history
  • Loading branch information
gampnico committed Oct 29, 2024
1 parent 47258e6 commit ec759a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions constants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ max_layers = 200 # Max. number of layers, just fo
z = 2.0 # Measurement height [m]

[PARAMETERIZATIONS]
stability_correction = 'MO' # possibilities: 'Ri','MO'
stability_correction = 'Ri' # possibilities: 'Ri','MO'
albedo_method = 'Oerlemans98' # possibilities: 'Oerlemans98','Bougamont05'
densification_method = 'Boone' # possibilities: 'Boone','empirical','constant' TODO: solve error Vionnet
penetrating_method = 'Bintanja95' # possibilities: 'Bintanja95'
roughness_method = 'Moelg12' # possibilities: 'Moelg12'
saturation_water_vapour_method = 'Sonntag90' # possibilities: 'Sonntag90'
thermal_conductivity_method = 'bulk' # possibilities: 'bulk', 'empirical'
sfc_temperature_method = 'Secant' # please use 'Newton' (Secant, fastest);
sfc_temperature_method = 'Secant' # please use 'Secant' (faster, identical to Newton)
# the other options 'L-BFGS-B' and 'SLSQP'(faster) lead to different results
# since the update in February 2024 and to a very long runtime;
# TODO: problem with L-BFGS-B and SLSQP should be solved.
Expand All @@ -20,7 +20,7 @@ sfc_temperature_method = 'Secant' # please use 'Newton' (Secant, f
initial_snowheight_constant = 0.2 # Initial snowheight
initial_snow_layer_heights = 0.10 # Initial thickness of snow layers
initial_glacier_height = 40.0 # Initial glacier height without snowlayers
initial_glacier_layer_heights = 1.0 # Initial thickness of glacier ice layers
initial_glacier_layer_heights = 0.5 # Initial thickness of glacier ice layers

initial_top_density_snowpack = 300.0 # Top density for initial snowpack
initial_bottom_density_snowpack = 600.0 # Bottom density for initial snowpack
Expand All @@ -46,8 +46,8 @@ first_layer_height = 0.01 # The first layer will always ha
layer_stretching = 1.20 # Stretching factor used by the log_profile method (e.g. 1.1 mean the subsequent layer is 10% greater than the previous

merge_max = 1 # How many mergings are allowed per time step
density_threshold_merging = 10 # If merging is true threshold for layer densities difference two layer try: 5-10 (kg m^-3)
temperature_threshold_merging = 0.1 # If merging is true threshold for layer temperatures to merge try: 0.05-0.1 (K)
density_threshold_merging = 5 # If merging is true threshold for layer densities difference two layer try: 5-10 (kg m^-3)
temperature_threshold_merging = 0.01 # If merging is true threshold for layer temperatures to merge try: 0.05-0.1 (K)


[CONSTANTS]
Expand Down
2 changes: 1 addition & 1 deletion cosipy/cpkernel/cosipy_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def cosipy_core(DATA, indY, indX, GRID_RESTART=None, stake_names=None, stake_dat

#--------------------------------------------
# TIME LOOP
#--------------------------------------------
#--------------------------------------------
for t in np.arange(nt):

# Check grid
Expand Down
6 changes: 3 additions & 3 deletions cosipy/modules/surfaceTemperature.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from numba import njit
from scipy.optimize import minimize, newton
from scipy.optimize import minimize, newton, OptimizeResult

from cosipy.config import Config
from cosipy.constants import Constants
Expand Down Expand Up @@ -111,10 +111,10 @@ def update_surface_temperature(GRID, dt, z, z0, T2, rH2, p, SWnet, u2, RAIN, SLO

# Set surface temperature
if isinstance(res, np.ndarray):
surface_temperature = min(zero_temperature, res)
surface_temperature = min(np.array([zero_temperature]), res)
minimisation_function = None
else:
surface_temperature = min(zero_temperature, res.x)
surface_temperature = min(np.array([zero_temperature]), res.x)
minimisation_function = res.fun
GRID.set_node_temperature(0, surface_temperature)

Expand Down
4 changes: 2 additions & 2 deletions cosipy/utilities/setup_cosipy/constants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ penetrating_method = 'Bintanja95' # possibilities: 'Bintanja95'
roughness_method = 'Moelg12' # possibilities: 'Moelg12'
saturation_water_vapour_method = 'Sonntag90' # possibilities: 'Sonntag90'
thermal_conductivity_method = 'bulk' # possibilities: 'bulk', 'empirical'
sfc_temperature_method = 'Newton' # please use 'Newton' (Secant, fastest);
sfc_temperature_method = 'Secant' # please use 'Secant' (faster, identical to Newton)
# the other options 'L-BFGS-B' and 'SLSQP'(faster) lead to different results
# since the update in February 2024 and to a very long runtime;
# TODO: problem with L-BFGS-B and SLSQP should be solved.
Expand Down Expand Up @@ -47,7 +47,7 @@ layer_stretching = 1.20 # Stretching factor used by the

merge_max = 1 # How many mergings are allowed per time step
density_threshold_merging = 5 # If merging is true threshold for layer densities difference two layer try: 5-10 (kg m^-3)
temperature_threshold_merging = 0.01 # If mering is true threshold for layer temperatures to merge try: 0.05-0.1 (K)
temperature_threshold_merging = 0.01 # If merging is true threshold for layer temperatures to merge try: 0.05-0.1 (K)


[CONSTANTS]
Expand Down

0 comments on commit ec759a8

Please sign in to comment.