-
Notifications
You must be signed in to change notification settings - Fork 49
/
data.py
44 lines (34 loc) · 1.07 KB
/
data.py
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
39
40
41
42
43
44
"""
Standard test data for regridding benchmark.
"""
import numpy as np
def wave_smooth(lon, lat):
'''
Spherical harmonic with low frequency.
Parameters
----------
lon, lat : 2D numpy array or xarray DataArray
Longitute/Latitude of cell centers
Returns
-------
f : 2D numpy array or xarray DataArray depending on input
2D wave field
Notes
-------
Equation from [1]_ [2]_:
.. math:: Y_2^2 = 2 + \cos^2(\\theta) \cos(2 \phi)
References
----------
.. [1] Jones, P. W. (1999). First-and second-order conservative remapping
schemes for grids in spherical coordinates. Monthly Weather Review,
127(9), 2204-2210.
.. [2] Ullrich, P. A., Lauritzen, P. H., & Jablonowski, C. (2009).
Geometrically exact conservative remapping (GECoRe): regular
latitude–longitude and cubed-sphere grids. Monthly Weather Review,
137(6), 1721-1741.
'''
# degree to radius, make a copy
lat = lat/180.0*np.pi
lon = lon/180.0*np.pi
f = 2 + np.cos(lat)**2 * np.cos(2*lon)
return f