thouska / spotpy

A Statistical Parameter Optimization Tool
https://spotpy.readthedocs.io/en/latest/
MIT License
247 stars 149 forks source link

Specify number of decimal in the creation of parameters #321

Open SQPaul opened 4 months ago

SQPaul commented 4 months ago

Hi everyone, I'm calibrating the surface energy and mass balance model COSIPY using SCEUA algorithm. I would like to know how to specify the number of decimals in the creation of the parameters. In my case I have int and float parameters, and the float parameters have different significant digits.

Example of my code:

    self.params = [spotpy.parameter.Uniform(name='lapse_RRR',            low=0.0005,   high=0.001), #significant digits = 4
                   spotpy.parameter.Uniform(name='albedo_fresh_snow',    low=0.81,     high=0.95),  #significant digits = 2
                   spotpy.parameter.Uniform(name='albedo_mod_snow_aging',low=1,        high=28)]    #integer
philippkraft commented 3 months ago

This functionality does not exist in spotpy. Does your model have problems with continuous parameters? If not, use the parameters as sampled (with all digits). If yes, perhaps you can round the parameters to the number of digits in your code. But this might lead to problems for algorithms with convergence criterea, beacuse you get the same output for different values (eg. albedo_mod_snow_aging=3.10578 or 3.43267). But it can work as well, this is hard to forsee.

SQPaul commented 3 months ago

Thank you for the answer Philipp.

I can use continuos values for my model, but I have some doubts. Before the calibration process I did a sensitivity analysis using FAST algorithm. I don't know if the results are really my most sensitive parameters or they are associated with the decimals and range that I give to each of them. For example the most sentivity parameter is 'albedo_mod_snow_aging' whose range is [1,28] vs the less sensitive is 'albedo_fresh_snow' range=[0.81-0.95]. So I have the doubt if I define the step (number of decimal) for each parameter the result would be the same.

I appreciate any recommendation or appreciation regarding my question.

Cheers

philippkraft commented 3 months ago

You can try with the simulation above (round in your model). But I do not see why this should change anything. I see this rather a wide range (1-28, two magnitudes) vs. low range (0.1 magnitudes change) problem. I would broaden the fresh snow albedo to see it makes a difference. Or you can accept the result as: The fresh snow albedo is well known and bound to a small range by physics and is hence not a big contributor of parameter uncertainty in your model (that is a sensitive parameter). The aging factor is rather unknown and therefore highly sensitive for this model. Or you change the snow aging factor to a smaller range, getting old in a day does not sound reasonably.

If your experiments with internally rounded results show that the number of significant digits have indeed an important impact on the FAST algorithm, please provide us with a minimal example (eg. with a simplified mock model) to reproduce the issue. Otherwise we would close it.