def test_EASE2_global_36km():
test_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'test_data')
test_lat = os.path.join(test_path, 'EASE2_M36km.lats.964x406x1.double')
test_lon = os.path.join(test_path, 'EASE2_M36km.lons.964x406x1.double')
egrid = EASE2_grid(36000)
assert egrid.shape == (406, 964)
nptest.assert_almost_equal(egrid.x_pixel, egrid.map_scale)
nptest.assert_almost_equal(egrid.y_pixel, egrid.map_scale)
nptest.assert_almost_equal(egrid.map_scale, 36032.220840583752)
lat_should = np.fromfile(test_lat, dtype=np.float64)
lon_should = np.fromfile(test_lon, dtype=np.float64)
nptest.assert_almost_equal(egrid.londim,
lon_should.reshape((406, 964))[0, :])
nptest.assert_almost_equal(egrid.latdim,
lat_should.reshape((406, 964))[:, 0])
评论列表
文章目录