-
Notifications
You must be signed in to change notification settings - Fork 66
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
Towards model agnosticism + pint functionality in Meridional Overturning Circulation example #324
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
View / edit / reply to this conversation on ReviewNB navidcy commented on 2024-02-26T15:02:17Z Line #30. for ii in range(nmin, nmax):
if we can replace this for loop with xarray operations it'd be nice! |
Hi, I just made a few minor enhancements to the example. Towards the end of the notebook, it is mentioned that sub mesoscale contributions are not considered. I thought that ty_trans_rho_GM includes the sub mesoscale contribution? |
View / edit / reply to this conversation on ReviewNB anton-seaice commented on 2024-07-03T01:42:56Z Line #7. "chunks": {}, Can we just remove these chunks objects ? |
View / edit / reply to this conversation on ReviewNB anton-seaice commented on 2024-07-03T01:42:57Z Line #19. psiGM = psiGM.sel(time=slice(start_time, end_time)) We probably don't need to specify start_time / end_time twice (its already in the getvar) dhruvbhagtani commented on 2024-07-03T02:11:38Z Good point -- I need to check it again, but my understanding is that using start and end times within getvar only selects the time roughly. To exactly be within the start and end time bounds, we need to write this line.
|
We could but then we get a bunch of warnings every time we load a variable. Perhaps we can comment the use of this line? |
Good point -- I need to check it again, but my understanding is that using start and end times within getvar only selects the time roughly. To exactly be within the start and end time bounds, we need to write this line.
View entire conversation on ReviewNB |
View / edit / reply to this conversation on ReviewNB anton-seaice commented on 2024-07-03T02:24:32Z Line #1. %config InlineBackend.figure_format='retina' I think we can remove this line too. |
Yes. I'm happy to open an issue pointing this out. I think there might be one already? #321? |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:31Z Delete this |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:32Z Can we add some documentation on what the |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:33Z Now let's |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:33Z Line #3. experiment = psi_args[model]["expt"] We are using here |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:34Z Line #28. z1 = rho2_zonal_mean[remap_dens[model]["depth"]].values I think
Although z1 is never used. Why is it here? |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:35Z rho1 = rho2_zonal_mean.cf.isel(latitude=ii) rho1v = rho1.copy() z = rho1.cf['vertical'] rho1 = rho1.rename({rho1.cf['vertical'].name: 'rho_ref'}) rho1['rho_ref'] = np.array(rho1v) rho1.name = rho2_zonal_mean.cf['vertical'].name rho1.values = np.array(z) I feel all this would be simpler by:
xr.DataArray(data = rho2_zonal_mean.cf['vertical'].values, dims = ['rho_ref'], coords = {'rho_ref': rho2_zonal_mean.cf.isel(latitude=ii).values}) And similar in other places in this function. Seems to me some of the steps are redundant (like the naming and renaming of |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:35Z Line #61. del psi_avg2 Not needed |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:36Z I am getting this error here: RuntimeError: NetCDF: Not a valid ID And then my ARE session collapses. I am using xxlarge (28cpus), so not sure what the problem is, but I think there is something amiss in the remapping function. I've tried running outside the function to identify what's the problematic line, but the iteration through latitudes is very slow. Maybe adele-morrison commented on 2024-08-21T10:40:15Z I got the same error Julia, but was able to fix it using |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:37Z Line #1. stretching_factor = 6 # A powvalues set the stretching what's a powvalues? |
View / edit / reply to this conversation on ReviewNB julia-neme commented on 2024-08-05T03:54:37Z Does this mean the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main issue is that I can't run this notebook. I get a runtime error when trying to do the remapping and sometimes my ARE session crashes. I am using 24.04 conda-environment, and an xxlarge ARE session (28 cpus). I've heard that this notebook sometimes run, sometimes not, in a bit of a stochastic manner.
My second questions is whether potrho
coordinate in mom5
is potrho2
and not potrho0
? This would matter for the re-mapping. The metadata does not say and I personally don't know.
I think there are a number of simplifications/edits to do (see my comments), but I might not have understood stuff so apologies if the suggestions are not appropriate. I think we also need a bit of an explanation as to when/why do we need a GM transport.
A minor personal opinion is to do mom5 and mom6 one after the other and plot them together to compare.
Confirming that the |
I know I opened this PR but I'm out of steam. I'm tempted to close it because I don't have capacity to deal with it. But if somebody else feels that this is useful and want to take over please do. |
Regarding this:
There is a separate submesoscale parameterisation, based on Fox-Kemper et al. 2008 and Fox-Kemper et al. 2011, that is different to GM and is still switched on even in 1/10deg and higher res configs. To include the advection from this parameterisation, you would need to save the diagnostic Perhaps we could add a comment to the notebook with the name of the required diagnostic if someone did want to include it and a reference to Fox-Kemper et al. 2011? |
I have a curious questions about this notebook - unrelated to the reviews coming from personal interest. Most of the mom5 experiments include a transport in depth coordinates ( |
@julia-neme if you do the time average in depth space first, then you only get the mean overturning component, not the residual (i.e. total = mean + eddy). So you have to do the time average in density space (i.e. use the |
@navidcy I will have a go at getting it running and incorporating @julia-neme's review comments. |
I got the same error Julia, but was able to fix it using View entire conversation on ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I included nearly all of @julia-neme's review comments, and it runs again! There is definitely still a bunch more cleaning up that could be done (e.g. I didn't make these changes @julia-neme suggested), but I reckon we should merge for now, and can restart further cleanup in a new PR if someone has energy.
@navidcy or @julia-neme are you able to sort the conflicts? I have no idea how to do that. |
Ohh thanks Adele! It ran quite fast for me now... seems like the I have no idea how to resolve conflicts so might leave that to Navid. |
I did the merge from main , if you can sanity check its not broken before merging this PR that would be great (there were no conflicts, I don't understand why it need the commandline !) |
Thanks!!! |
I think mostly it runs faster, because I reduced it to using only 1 year of output. I got sick of waiting for it! |
This PR makes this example truly model-agnostic.
Previously there were a lot of
if model=='mom5' do this, elseif model=='mom6' do the other
in theremap_depth()
method. This is not "model agnostic" programming, but rather two set of codes packaged in one notebook. The PR uses cf-xarray functionality to replace theif model='this' do that...
with one code that works for all.In particular:
before this PR
after this PR
Also this PR adds
pint
functionality to deal with units and conversions from, e.g., kg/s to Sv in a systematic manner.