Skip to content

Commit

Permalink
Use salems pyproj.transform wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoRoth committed Jun 17, 2019
1 parent 617ca88 commit 31f1f5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion oggm/core/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from distutils.version import LooseVersion
# External libs
import salem
from salem.gis import transform_proj
import pyproj
import numpy as np
import shapely.ops
Expand Down Expand Up @@ -271,7 +272,7 @@ def define_glacier_region(gdir, entity=None):
"+x_0={x_0} +y_0={y_0} +datum={datum}".format(**proj_params)
proj_in = pyproj.Proj("+init=EPSG:4326", preserve_units=True)
proj_out = pyproj.Proj(proj4_str, preserve_units=True)
project = partial(pyproj.transform, proj_in, proj_out)
project = partial(transform_proj, proj_in, proj_out)
# transform geometry to map
geometry = shapely.ops.transform(project, entity['geometry'])
geometry = multi_to_poly(geometry, gdir=gdir)
Expand Down
3 changes: 2 additions & 1 deletion oggm/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from unittest import mock

import salem
from salem.gis import transform_proj
import numpy as np
import pandas as pd
import geopandas as gpd
Expand Down Expand Up @@ -2084,5 +2085,5 @@ def test_projplot(self):
proj_out = pyproj.Proj("+init=EPSG:4326", preserve_units=True)
proj_in = pyproj.Proj(srs, preserve_units=True)

lon, lat = pyproj.transform(proj_in, proj_out, -2235000, -2235000)
lon, lat = transform_proj(proj_in, proj_out, -2235000, -2235000)
np.testing.assert_allclose(lon, 70.75731, atol=1e-5)

0 comments on commit 31f1f5a

Please sign in to comment.