Closed andersy005 closed 5 years ago
thanks @andersy005!
Anytime @jhamman
When you get time, can you verify the correctness of my weighted means?
@andersy005 - do you know if, included in the main LENS archive, there was a 2d field of grid cell areas? If so, we should probably include this (+topography) in the s3 collection of data.
do you know if, included in the main LENS archive, there was a 2d field of grid cell areas?
Not that I know of. Ccing @matt-long who may know where these 2d field of grid cell areas might be located at in the LENS archive
If so, we should probably include this (+topography) in the s3 collection of data.
I concur
To compute the area on the atmospheric grid, you can do the following.
import numpy as np
import xarray as xr
def compute_CAM_fv_grid_area(ds_cam):
"""Compute area on CAM finite volume grid."""
Re = 6.37122e6 # m, radius of Earth
# use gaussian weights; make 2D: gw.dims == ('lat',)
area = ds_cam.gw + 0.0 * ds_cam.lon
area = (4.0 * np.pi * Re**2 / area.sum(dim=('lat', 'lon'))) * area # m^2
area.attrs['units'] = 'm^2'
return area
Thank you, @matt-long!
I know this is possible, but I don't think it is necessary. CESM is typically run along side a domain file. This file typically includes things like grid cell area, grid cell elevation (or depth), etc. I imagine this is available for the LENS model configuration and we can/should provide it for all the model components (land/atm/ocean).
@jhamman,
If you know where these domain files are located at, let me know and I will add them to the S3 bucket.
I don't know where they are but I wouldn't be surprised if @matt-long or @strandwg know where to find them.
Towards #4
Rendered Notebook: https://nbviewer.jupyter.org/gist/andersy005/00c2798f9200c3a2a14f8ea845ba15a0?flush_cache=true