-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from GeoStat-Framework/gstools_latlon_fix
GSTools: support latlon models for geographic coordinates
- Loading branch information
Showing
6 changed files
with
79 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# coding: utf-8 | ||
# pylint: disable= invalid-name, unused-import | ||
"""For GSTools compatibility.""" | ||
|
||
# gstools | ||
try: | ||
import gstools as gs | ||
|
||
GSTOOLS_INSTALLED = True | ||
GSTOOLS_VERSION = list(map(int, gs.__version__.split(".")[:2])) | ||
except ImportError: | ||
gs = None | ||
GSTOOLS_INSTALLED = False | ||
GSTOOLS_VERSION = None | ||
|
||
|
||
class GSToolsException(Exception): | ||
"""Exception for GSTools.""" | ||
|
||
|
||
def validate_gstools(model): | ||
"""Validate presence of GSTools.""" | ||
if not GSTOOLS_INSTALLED: | ||
raise GSToolsException( | ||
"GSTools needs to be installed in order to use their CovModel class." | ||
) | ||
if not isinstance(model, gs.CovModel): | ||
raise GSToolsException( | ||
"GSTools: given variogram model is not a CovModel instance." | ||
) | ||
if GSTOOLS_VERSION < [1, 3]: | ||
raise GSToolsException("GSTools: need at least GSTools v1.3.") | ||
if model.latlon and GSTOOLS_VERSION < [1, 4]: | ||
raise GSToolsException( | ||
"GSTools: latlon models in PyKrige are only supported from GSTools v1.4." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters