New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't initialize a column model with multiple longitude points #86
Comments
I've added a As far as I can tell, there are some challenges to getting 3D states working with climlab, mainly that RRTMG does not work reliably in the presence of latitude, longitude, and altitude at once. I've attempted some changes to RRTMG to fix the problems but it produces non-physical results. I've detailed some of the investigation below in case it is helpful down the line. Most of the dicussion closely relates to #50 . One of the major obstacles to implementing 3D states is that Other techical challenges come in similarly subtle forms. In the o3vmr = _climlab_to_rrtm(RRTMGobject.absorber_vmr['O3'] * np.ones_like(RRTMGobject.Tatm)) which seem on the surface to be fine but do not work correctly in the presence of all three axes. A potential fix for this (which is not very elegant) is: def _safe_avmr_mult(a, b):
if np.isscalar(a) or np.isscalar(b):
return a * b
if len(a.shape) == len(b.shape):
return a * b
'''Multiplies lat,lev by lat,lon,lev'''
return np.repeat((a * np.ones_like(b[:,0,:]))[:,np.newaxis,:], b.shape[1], axis=1)
# ...
o3vmr = _climlab_to_rrtm(_safe_avmr_mult(RRTMGobject.absorber_vmr['O3'], np.ones_like(RRTMGobject.Tatm))) A lot of the subtle issues with array index handling could be solved by overriding the Overall, I think that the approach of migrating more heavily to using |
@HenryDane I have some work in progress (though honestly not really progressing much) that completely refactors the climlab internals to use xarray objects for all model fields and get rid of the You're absolutely correct that climlab in its current form is inconsistent in its usage of the By switching the internals to Xarray data array objects, we will lose some performance due to overhead, but outsource a whole lot of array dimension logic and drastically simplify the climlab code. I think it's long overdue but I haven't found the time to pursue it as far as it needs. |
There is currently no
num_lon
option for theclimlab.column_state()
convenience function for setting up grids for atmospheric models.E.g. this should work but it doesn't:
The text was updated successfully, but these errors were encountered: