File: test_spilhaus.py

package info (click to toggle)
python-cartopy 0.25.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,152 kB
  • sloc: python: 16,526; makefile: 159; javascript: 66
file content (38 lines) | stat: -rw-r--r-- 1,099 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Copyright Crown and Cartopy Contributors
#
# This file is part of Cartopy and is released under the BSD 3-clause license.
# See LICENSE in the root of the repository for full licensing details.
"""
Tests for the Spilhaus projection.
"""
from packaging.version import parse as parse_version
import pyproj
import pytest

import cartopy.crs as ccrs
from .helpers import check_proj_params


proj_version = parse_version(pyproj.proj_version_str)
common_arg = {
    'ellps=WGS84',
    'no_defs',
}
@pytest.mark.skipif(
    (proj_version < parse_version("9.6.0")),
    reason="Requires PROJ >= 9.6.0"
)
def test_defaults():
    crs = ccrs.Spilhaus()
    expected = {'rot=45','x_0=0.0','y_0=0.0'} | common_arg
    check_proj_params('spilhaus', crs, expected)

@pytest.mark.skipif(
    (proj_version < parse_version("9.6.0")),
    reason="Requires PROJ >= 9.6.0"
)
@pytest.mark.parametrize("rotation",[45,135,225])
def test_rotation(rotation):
    crs = ccrs.Spilhaus(rotation = rotation)
    expected = {f'rot={rotation}','x_0=0.0','y_0=0.0'} | common_arg
    check_proj_params('spilhaus', crs, expected)