Conversation
A python script to estimate N^2 using T and S
edoddridge
left a comment
There was a problem hiding this comment.
Looks good @hajsong - I've commented on the commit with some suggestions/questions.
so_box_biogeo/diags/estNsq.py
Outdated
| @@ -0,0 +1,75 @@ | |||
| import numpy as np | |||
| from MITgcmutils import rdmds, densjmd95 | |||
| from hspython import loadgrid | |||
There was a problem hiding this comment.
Would it be better to include the function loadgrid locally, rather than require users to go out and obtain the code for it separately?
There was a problem hiding this comment.
Yes, that makes sense. But it is likely that I will use this function quite a lot in the future.
I will put a file with "loadgrid" in this directory for now.
so_box_biogeo/diags/estNsq.py
Outdated
| Nsq = - dRHOdr*g/rhoconst*grd.mskC | ||
| # | ||
| # Now, estimate Nsq using T and S. | ||
| # When computing "drhodr" at the layer interface, density at upper and lower cell |
There was a problem hiding this comment.
Rather than "layer interface" it may be clearer to say the interface between tracer cells.
so_box_biogeo/diags/estNsq.py
Outdated
| showx = 5 | ||
| scale = 1e5 | ||
|
|
||
| X, Y = np.meshgrid(grd.YC[:, 0], grd.RC[:showz]) |
There was a problem hiding this comment.
Why are these called X and Y rather than Y and Z?
There was a problem hiding this comment.
No special reason.. Y and Z make more sense and I will change that.
|
|
||
| im = ax[2].contourf(X, Y, Nsq_ra[:showz,:,showx]*scale, np.arange(0,15.1,1), cmap='Reds') | ||
| cb = plt.clabel(im,colors='black',fmt='%3.1f') | ||
| ax[2].set_title('N$^2$, from RHOAnoma [x 10$^5$ s$^{-1}$]', color='black', fontsize=15) |
There was a problem hiding this comment.
Some axes labels would make these plots clearer.
so_box_biogeo/diags/estNsq.py
Outdated
| """ | ||
| Estimating Brunt-Vaisala frequency using T and S | ||
| In case when N$^2$ is needed but do not have 'DRHODR' saved, | ||
| one can still estimate it using T and S |
There was a problem hiding this comment.
Is it worth adding "and the appropriate equation of state" to the end of this docstring?
“estNsq.py” is updated and a file “mitgcmgrid.py” is added.
|
The code looks good to me. @jahn, @jm-c, @christophernhill - any of you want to chime in? A couple of comments on using git for the future:
|
|
Ed's comments make sense to me. |
A python script to estimate N^2 using T and S