Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for geographical coordinates #113

Merged
merged 44 commits into from
Jan 13, 2021
Merged

Add support for geographical coordinates #113

merged 44 commits into from
Jan 13, 2021

Conversation

MuellerSeb
Copy link
Member

@MuellerSeb MuellerSeb commented Nov 24, 2020

lat-lon support

This PR introduces the long-awaited support for geographic coordinates given by latitude an longitude.

CovModel

  • added boolean init parameter latlon to indicate a geographic model. When given, spatial dimension is fixed to dim=3, anis and angles will be ignored, since anisotropy is not well-defined on a sphere.
  • add property field_dim to indicate the dimension of the resulting field. Will be 2 if latlon=True
  • added yadrenko variogram, covariance and correlation method, since the geographic models are derived from standard models in 3D by plugging in the chordal distance of two points on a sphere derived from there great-circle distance zeta:
    • vario_yadrenko: given by variogram(2 * np.sin(zeta / 2))
    • cov_yadrenko: given by covariance(2 * np.sin(zeta / 2))
    • cor_yadrenko: given by correlation(2 * np.sin(zeta / 2))
  • added plotting routines for yadrenko methods described above
  • the isometrize and anisometrize methods will convert latlon tuples (given in degree) to points on the unit-sphere in 3D and vice versa
  • representation of geographical models don't display the dim, anis and angles parameters, but latlon=True
  • fit_variogram will expect an estimated variogram with great-circle distances given in radians

Variogram estimation

  • latlon switch implemented in estimate_vario routine
  • will return a variogram estimated by the great-circle distance (haversine formula) given in radians

Field

  • added plotting routines for latlon fields
  • no vector fields possible on latlon fields
  • corretly handle pos tuple for latlon fields
  • now only the "unstructured" keyword is recognized, everything else is interpreted as "structured" (e.g. "rectilinear")

Misc

  • added EARTH_RADIUS as constant providing earths radius in km (can be used to rescale models)
  • add routines latlon2pos and pos2latlon to convert lat-lon coordinates to points on unit-sphere and vice versa

Examples

  • added tutorial for geographic coordinates

TODO

  • kriging tutorial
  • testing

@MuellerSeb MuellerSeb mentioned this pull request Nov 24, 2020
10 tasks
@MuellerSeb MuellerSeb requested a review from LSchueler November 25, 2020 20:10
@MuellerSeb MuellerSeb self-assigned this Nov 25, 2020
@MuellerSeb MuellerSeb added Documentation enhancement New feature or request Refactoring Code-Refactoring needed here labels Nov 25, 2020
@MuellerSeb MuellerSeb added this to the 1.3 milestone Nov 25, 2020
@MuellerSeb
Copy link
Member Author

@LSchueler this should be ready for a first review! 🥳

@MuellerSeb
Copy link
Member Author

Strangely all the with self.assertRaises(ValueError) blocks in the tests don't show up on coveralls... That's why the coverage decreased.

README.md Show resolved Hide resolved
Copy link
Member

@LSchueler LSchueler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that is quite some addition, great!

I think that we are almost good to go. Just some minor changes I hinted at in the code comments. I also think that the unittests are enough.
I'm going to push some typo fixes directly on this branch again as always ;-) So don't forget to pull before working on this again.

examples/08_geo_coordinates/00_field_generation.py Outdated Show resolved Hide resolved
examples/08_geo_coordinates/01_dwd_krige.py Outdated Show resolved Hide resolved
examples/08_geo_coordinates/01_dwd_krige.py Show resolved Hide resolved
gstools/covmodel/base.py Outdated Show resolved Hide resolved
gstools/tools/geometric.py Show resolved Hide resolved
tests/test_incomprrandmeth.py Show resolved Hide resolved
tests/test_latlon.py Outdated Show resolved Hide resolved
tests/test_randmeth.py Outdated Show resolved Hide resolved
tests/test_randmeth.py Outdated Show resolved Hide resolved
tests/test_randmeth.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation enhancement New feature or request Refactoring Code-Refactoring needed here
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants