GeoStat-Framework / PyKrige

Kriging Toolkit for Python
https://pykrige.readthedocs.io
BSD 3-Clause "New" or "Revised" License
765 stars 189 forks source link

Strange number in a variogram function #119

Open juifa-tsai opened 5 years ago

juifa-tsai commented 5 years ago

Dear authors,

I was looking for the python open source of Kriging to solve my works. Feel lucky to find this convenience and clean package. However, I found a small strange number (parameter) with 3. in the exponential function of the line 58.

    return psill * (1. - np.exp(-d/(range_/3.))) + nugget

Actually it doesn't affect the fitting performance, but the scale of the range may cause misunderstanding. Not sure if it is because of the unit from feet to meter or miss-assignment. I know this is A small issue, I am just curiosity about it.

Many thanks, Jui-Fa

rth commented 5 years ago

Looks like there are several variants for the exponential variogram model. In particular,

The parameter a has different values in different references, due to the ambiguity in the definition of the range. E.g. a=1/3 is the value used in (Chiles&Delfiner 1999)

so it should be fine.

juifa-tsai commented 5 years ago

Thanks for the answer. I agree the number won't affect the fitting performance. But I'd suggest to remove a in any function, since we expect to the fitted "range", i.e. distance, provides the information about spatial correlation. However, it's true that it should be fine in some case. :-)

MuellerSeb commented 4 years ago

I was thinking about bringing the models of PyKrige in line with the ones from GSTools. There the length scale in the exponential model coincides with its integral scale.

MuellerSeb commented 4 years ago

We could also introduce a scaling factor, that is fixed (not estimated during the variogram fitting). This could also help in the future to automatically determine a search radius (See #143). For example:

serach_radius = 2 * len_scale

Since the len_scale in the model doesn't need to coincide with other scales (like integral scale or a precentile scale), the scaling factor could help, to rescale the len_scale to a meaningful range.

In the mentioned case above, the scaling factor would be 3.

MuellerSeb commented 3 years ago

This is solved in GSTools with the introduction of the rescale argument, that will be used by PyKrige in the future: