Skip to content

Commit

Permalink
Add cf test for omerc grid mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Jan 9, 2020
1 parent 9674efb commit 02986d1
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions satpy/tests/writer_tests/test_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,44 @@ def test_area2gridmapping(self):
self.assertEqual(res.attrs['grid_mapping'], 'geostationary')
self.assertEqual(grid_mapping, geos_expected)

# e) oblique Mercator
area = pyresample.geometry.AreaDefinition(
area_id='omerc_otf',
description='On-the-fly omerc area',
proj_id='omerc',
projection={'alpha': '9.02638777018478', 'ellps': 'WGS84', 'gamma': '0', 'k': '1',
'lat_0': '-0.256794486098476', 'lonc': '13.7888658224205',
'proj': 'omerc', 'units': 'm'},
width=2837,
height=5940,
area_extent=[-1460463.0893, 3455291.3877, 1538407.1158, 9615788.8787]
)

omerc_expected = xr.DataArray(data=0,
attrs={})

omerc_dict = {'name': 'omerc',
'azimuth_of_central_line': 9.02638777018478,
'false_easting': 0.,
'false_northing': 0.,
'gamma': 0,
'geographic_crs_name': "unknown",
'grid_mapping_name': "oblique_mercator",
'horizontal_datum_name': "unknown",
'latitude_of_projection_origin': -0.256794486098476,
'long_name': "omerc",
'longitude_of_projection_origin': 13.7888658224205,
'prime_meridian_name': "Greenwich",
'reference_ellipsoid_name': "WGS84"}
omerc_expected = xr.DataArray(data=0, attrs=omerc_dict)

ds = ds_base.copy()
ds.attrs['area'] = area
res, grid_mapping = area2gridmapping(ds)

self.assertEqual(res.attrs['grid_mapping'], 'oblique_mercator')
assert(set(omerc_expected.attrs.items()) <= set(grid_mapping.attrs.items()))

def test_area2lonlat(self):
"""Test the conversion from areas to lon/lat."""
import pyresample.geometry
Expand Down

0 comments on commit 02986d1

Please sign in to comment.