<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hi Samar,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thank you for your clarification. Also, thanks to Hong for answering the question. Just want to add more to Hong’s answer.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Calling cumsum after call_transpports is necessary for the Matlab code to calculate the steam function. T from calc_transport is the transport for each vertical level. Cumsum gives the transport between a
reference level (e.g., the ocean surface) and a specific vertical level, which is the stream function we normally talk about.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Also, if UVELMASS and VVELMASS are used as input arguments, ‘hfac’ should not be specified when calling
</span><span style="font-size:11.0pt">calc_transports. This is because UVELMASS and VVELMMASS already contain the hFac effect. Specifying ‘hfac’ again when calling calc_transports is double counting.
<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Best,<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Ou Wang</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">ecco-support <ecco-support-bounces@mit.edu> on behalf of Samar Khatiwala <samkat6@gmail.com><br>
<b>Date: </b>Tuesday, June 11, 2024 at 1:09</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"> </span><span style="font-size:12.0pt;color:black">PM<br>
<b>To: </b>ECCO support list, wider membership <ecco-support@mit.edu><br>
<b>Subject: </b>Re: [ecco-support] [EXTERNAL] Calculating transports with gcmfaces in Matlab<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Hi Ou,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Thanks for replying.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Sorry, my notation wasn't good. My uTrans and vTrans are in fact UVELMASS and VVELMASS.<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt">If I use your code I get the same T as I did (since you pre mask it by omitting 'hfac') but T itself looks nothing like what is shown in the tutorial. So my question was more to do with doing a cumsum on T.
It is done within the python calc_section_stf but not in the Matlab calc_transport (apart from the cumsum they seem to be doing the same calculation) and I'm confused by the difference in behavior. If I do a cumsum on T after calling calc_transport I get something
more like in the tutorial but that could just be accidental and not for the right reason. What then is the correct way to reproduce the tutorial results using Matlab?<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Thanks,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Samar<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">On Mon, Jun 10, 2024 at 5:09</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif"> </span><span style="font-size:12.0pt">PM Wang, Ou (US 329B) <</span><a href="mailto:ou.wang@jpl.nasa.gov"><span style="font-size:12.0pt">ou.wang@jpl.nasa.gov</span></a><span style="font-size:12.0pt">>
wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Samar,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">What are the two variables uTrans and vTrans in T=calc_transports(uTrans,vTrans,mygrid.LINES_MASKS,{'dh','dz','hfac'});?
</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">The names suggest they are transport, but they should be UVELMASS.*mygrid.mskW and VVELMASS.*mygrid.mskS.
</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">You may want to replace T=calc_transports(uTrans,vTrans,mygrid.LINES_MASKS,{'dh','dz','hfac'}) with the following:</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">uTrans = UVELMASS.*mygrid.mskW;</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">vTrans = VVELMASS.*mygrid.mskS;</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">T=calc_transports(uTrans,vTrans,mygrid.LINES_MASKS,{'dh','dz'});</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Best regards,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Ou Wang</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<div id="m_6348540906736887735mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">ecco-support <</span><a href="mailto:ecco-support-bounces@mit.edu" target="_blank"><span style="font-size:12.0pt">ecco-support-bounces@mit.edu</span></a><span style="font-size:12.0pt;color:black">> on behalf
of Samar Khatiwala <</span><a href="mailto:samkat6@gmail.com" target="_blank"><span style="font-size:12.0pt">samkat6@gmail.com</span></a><span style="font-size:12.0pt;color:black">><br>
<b>Date: </b>Monday, June 10, 2024 at 2:59</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"> </span><span style="font-size:12.0pt;color:black">AM<br>
<b>To: </b>ECCO support list, wider membership <</span><a href="mailto:ecco-support@mit.edu" target="_blank"><span style="font-size:12.0pt">ecco-support@mit.edu</span></a><span style="font-size:12.0pt;color:black">><br>
<b>Subject: </b>[EXTERNAL] [ecco-support] Calculating transports with gcmfaces in Matlab</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt">Hello,<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt">I'm trying to reproduce the calculations for the overturning streamfunction described on </span><a href="https://urldefense.us/v3/__https:/ecco-v4-python-tutorial.readthedocs.io/ECCO_v4_Example_OSNAP.html__;!!PvBDto6Hs4WbVuu7!NGtdgDhELdz3kVixjJCZ0q9D_VYms1T7Hzzy8y1T4DYa0C8LDN7tENkuljBhQzluMQEaUo_MK2G514L6FD8$" target="_blank"><span style="font-size:12.0pt">https://ecco-v4-python-tutorial.readthedocs.io/ECCO_v4_Example_OSNAP.html</span></a><span style="font-size:12.0pt">
with the Matlab version of gcmfaces. The OSNAP example described in the tutorial uses the python function calc_section_stf which returns 'psi_moc'. I can't quite figure out what the equivalent Matlab function is. The documentation refers to calc_overturn.m
and calc_transports.m, but the former returns transports for all (179) quasi-zonal lines, while the output of calc_transports is nowhere close to what is plotted in the tutorial. After looking through the python code the closest I've gotten is with: <o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt">lonPairs=[-44 -5;-56 -45];<br>
latPairs=[60 56;51 60];<br>
names={'OSNAP East','OSNAP West'};<br>
gcmfaces_lines_transp(lonPairs,latPairs,names);<br>
T=calc_transports(uTrans,vTrans,mygrid.LINES_MASKS,{'dh','dz','hfac'});<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt">psi_moc=cumsum(T')/1e6;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt">But I'm not confident this is correct. Can someone please tell me if this is right and if not what the correct way is?<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt">Thanks,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt">Samar<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt"> <o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt">_______________________________________________<br>
ecco-support mailing list<br>
</span><a href="mailto:ecco-support@mit.edu" target="_blank"><span style="font-size:12.0pt">ecco-support@mit.edu</span></a><span style="font-size:12.0pt"><br>
</span><a href="https://urldefense.us/v3/__https:/mailman.mit.edu/mailman/listinfo/ecco-support__;!!PvBDto6Hs4WbVuu7!K9p7yEcuqlAxwLHVJokOErYxhIo9343y7SoVSOZCDu9C8T6NZMxz5hZS_d1udw3xsHrFU-xybqeKNq5njtw$" target="_blank"><span style="font-size:12.0pt">https://mailman.mit.edu/mailman/listinfo/ecco-support</span></a><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>