Skip to content

Commit 752c41d

Browse files
authored
Use radians^2 for cell areas (#41)
1 parent dd38b80 commit 752c41d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mesh_generation/generate_mesh.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
from scripts_common import get_provenance_metadata, md5sum
4343

44+
EARTH_R = 6.37122e6
45+
4446

4547
class BaseGrid:
4648

@@ -153,8 +155,9 @@ def create_mesh(self, wrap_lons=False, global_attrs=None):
153155

154156
if self.area is not None:
155157
ds["elementArea"] = xr.DataArray(
156-
self.area.astype(np.float64),
158+
(self.area / (EARTH_R * EARTH_R)).astype(np.float64),
157159
dims=("elementCount"),
160+
attrs={"units": "radians^2", "long_name": "area weights"},
158161
)
159162

160163
# force no _FillValue (for now)

0 commit comments

Comments
 (0)