|
5 | 5 | from collections import OrderedDict |
6 | 6 |
|
7 | 7 | import numpy as np |
| 8 | +import pyproj |
8 | 9 | import pytest |
9 | 10 | import xarray as xr |
10 | 11 |
|
@@ -63,11 +64,19 @@ def test_var_multidim_no_xy(test_var_multidim_full): |
63 | 64 | def test_projection(test_var, ccrs): |
64 | 65 | """Test getting the proper projection out of the variable.""" |
65 | 66 | crs = test_var.metpy.crs |
66 | | - assert crs['grid_mapping_name'] == 'lambert_conformal_conic' |
67 | 67 |
|
| 68 | + assert crs['grid_mapping_name'] == 'lambert_conformal_conic' |
68 | 69 | assert isinstance(test_var.metpy.cartopy_crs, ccrs.LambertConformal) |
69 | 70 |
|
70 | 71 |
|
| 72 | +def test_pyproj_projection(test_var): |
| 73 | + """Test getting the proper pyproj projection out of the variable.""" |
| 74 | + proj = test_var.metpy.pyproj_crs |
| 75 | + |
| 76 | + assert isinstance(proj, pyproj.CRS) |
| 77 | + assert proj.coordinate_operation.method_name == 'Lambert Conic Conformal (1SP)' |
| 78 | + |
| 79 | + |
71 | 80 | def test_no_projection(test_ds): |
72 | 81 | """Test getting the crs attribute when not available produces a sensible error.""" |
73 | 82 | var = test_ds.lat |
@@ -1309,9 +1318,8 @@ def test_grid_deltas_from_dataarray_xy(test_da_xy): |
1309 | 1318 | def test_grid_deltas_from_dataarray_actual_xy(test_da_xy, ccrs): |
1310 | 1319 | """Test grid_deltas_from_dataarray with a xy grid and kind='actual'.""" |
1311 | 1320 | # Construct lon/lat coordinates |
1312 | | - from pyproj import Proj |
1313 | 1321 | y, x = xr.broadcast(*test_da_xy.metpy.coordinates('y', 'x')) |
1314 | | - lon, lat = Proj(test_da_xy.metpy.pyproj_crs)( |
| 1322 | + lon, lat = pyproj.Proj(test_da_xy.metpy.pyproj_crs)( |
1315 | 1323 | x.values, |
1316 | 1324 | y.values, |
1317 | 1325 | inverse=True, |
|
0 commit comments