<p style="font-family:Arial;">
<span style="font-family:Georgia;font-size:16px;">Dear All,</span>
</p>
<p style="font-family:Arial;">
<br>
</p>
<p style="font-family:Arial;">
<span style="font-family:Georgia;font-size:16px;">I want to calculate the salinity </span><span style="color:#222222;font-family:Harding, Palatino, serif;font-size:18px;white-space:normal;background-color:#FFFFFF;"><span style="font-family:Georgia;font-size:16px;">on isopycnal surfaces</span><span style="color:#222222;font-family:Georgia;font-size:16px;white-space:normal;background-color:#FFFFFF;">, 26 ≤ </span><i style="box-sizing:inherit;color:#222222;font-family:Harding, Palatino, serif;font-size:18px;white-space:normal;background-color:#FFFFFF;"><span style="font-family:Georgia;font-size:16px;">σ</span></i><span style="box-sizing:inherit;vertical-align:baseline;font-size:16px;line-height:0;position:relative;bottom:-0.25em;color:#222222;font-family:Georgia;white-space:normal;background-color:#FFFFFF;"><i style="box-sizing:inherit;">θ</i></span><span style="color:#222222;font-family:Georgia;font-size:16px;white-space:normal;background-color:#FFFFFF;"> ≤ 27.75 (</span><i style="box-sizing:inherit;color:#222222;font-family:Harding, Palatino, serif;font-size:18px;white-space:normal;background-color:#FFFFFF;"><span style="font-family:Georgia;font-size:16px;">σ</span></i><span style="box-sizing:inherit;vertical-align:baseline;font-size:16px;line-height:0;position:relative;bottom:-0.25em;color:#222222;font-family:Georgia;white-space:normal;background-color:#FFFFFF;"><i style="box-sizing:inherit;">θ</i></span><span style="color:#222222;font-family:Harding, Palatino, serif;font-size:18px;white-space:normal;background-color:#FFFFFF;"><span style="font-family:Georgia;font-size:16px;"> is the potential density). So I calculated it as follows. Could you please tell me what I do here right or wrong. Script works. I just want to know whether the calculation</span><span style="font-family:Georgia;font-size:16px;"> makes sense or not. Thank you so so much. Looking forward to hearing from you.</span></span></span>
</p>
<p style="font-family:Arial;">
<span style="color:#222222;font-family:Harding, Palatino, serif;font-size:18px;white-space:normal;background-color:#FFFFFF;"><br>
</span>
</p>
<p style="font-family:Arial;">
<span style="color:#222222;font-family:Georgia;font-size:16px;white-space:normal;background-color:#FFFFFF;">The script;</span>
</p>
<p style="font-family:Arial;">
<span style="color:#222222;font-family:Harding, Palatino, serif;font-size:18px;white-space:normal;background-color:#FFFFFF;"><span style="font-family:Georgia;font-size:16px;">P0 = 1000</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Arial;"><span style="font-family:Georgia;font-size:16px;">diri="/....</span><span style="font-family:Georgia;font-size:16px;">/"</span></span><br>
<span style="font-family:Georgia;font-size:16px;">sfile = "ER-hist.nc" </span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Georgia;font-size:16px;">f = addfile(diri+sfile,"r")</span><br>
<span style="font-family:Georgia;font-size:16px;">vname=getfilevarnames(f)</span><br>
<span style="font-family:Georgia;font-size:16px;">print(vname)</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Georgia;font-size:16px;"> hist = f->rhopoto(:,:,{-25:-70},:)</span><br>
<span style="font-family:Georgia;font-size:16px;"> P_D = hist - P0</span><br>
<span style="font-family:Georgia;font-size:16px;"> copy_VarCoords(hist, P_D)</span><br>
<span style="font-family:Georgia;font-size:16px;"> copy_VarMeta(hist, P_D)</span><br>
<span style="font-family:Georgia;font-size:16px;"> printVarSummary(P_D)</span><br>
<span style="font-family:Georgia;font-size:16px;"> printMinMax(P_D, False)</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Georgia;font-size:16px;">;************************************************</span><br>
<span style="font-family:Georgia;font-size:16px;">; Interpolate to specific [constant] TEMP levels</span><br>
<span style="font-family:Georgia;font-size:16px;">; The default returned vertical coordinate is Z_T but change to 'tlev'</span><br>
<span style="font-family:Georgia;font-size:16px;">;************************************************</span><br>
<span style="font-family:Georgia;font-size:16px;"> tlev = (/ 26.00 , 26.25,26.50,26.75,27.00,27.25,27.50,27.75/) ; same units [here, C] as TEMP</span><br>
<span style="font-family:Georgia;font-size:16px;"> tlev@units = P_D@units</span><br>
<span style="font-family:Georgia;font-size:16px;"> tlev!0 = "tlev"</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Georgia;font-size:16px;">delete([/diri,sfile,f,vname,hist/])</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Arial;"><span style="font-family:Georgia;font-size:16px;">diri="/...</span><span style="font-family:Georgia;font-size:16px;">/hist/"</span></span><br>
<span style="font-family:Georgia;font-size:16px;">sfile = "ER-hist.nc" </span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Georgia;font-size:16px;">f = addfile(diri+sfile,"r")</span><br>
<span style="font-family:Georgia;font-size:16px;">vname=getfilevarnames(f)</span><br>
<span style="font-family:Georgia;font-size:16px;">print(vname)</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Georgia;font-size:16px;"> salt = f->so(:,:,{-25:-70},:)</span><br>
<span style="font-family:Georgia;font-size:16px;"> printVarSummary(salt)</span><br>
<span style="font-family:Georgia;font-size:16px;"> printMinMax(salt, False)</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Georgia;font-size:16px;">;********************************************************** </span><br>
<span style="font-family:Georgia;font-size:16px;">; use int2p_n to interpolate: </span><br>
<span style="font-family:Georgia;font-size:16px;">;*********************************************************</span><br>
<span style="font-family:Georgia;font-size:16px;"> ityp = 0</span><br>
<span style="font-family:Georgia;font-size:16px;"> pdim = 1</span><br>
<span style="font-family:Georgia;font-size:16px;"> </span><br>
<span style="font-family:Georgia;font-size:16px;">xlvl = int2p_n_Wrap (P_D, salt, tlev, ityp, pdim) </span><br>
<span style="font-family:Georgia;font-size:16px;">printVarSummary(xlvl)</span><br>
<span style="font-family:Georgia;font-size:16px;">printMinMax(xlvl, True)</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Arial;"><br>
</span><br>
<span style="font-family:Georgia;font-size:16px;"> ER2 = dim_avg_n_Wrap(xlvl, 3)</span><br>
<span style="font-family:Georgia;font-size:16px;"> ER = dim_avg_n_Wrap(ER2, 0)</span><br>
<span style="font-family:Georgia;font-size:16px;"> printVarSummary(ER)</span><br>
<span style="font-family:Georgia;font-size:16px;"> printMinMax(ER, True)</span><br>
<span style="font-family:Georgia;font-size:16px;"></span><span style="font-family:Georgia;font-size:16px;"></span></span>
</p>
<br>
<p>
<span style="font-family:Georgia;font-size:16px;">Best Regards,</span>
</p>
<p>
<span style="font-family:Georgia;font-size:16px;">Chathu</span>
</p>
<span style="font-family:Arial;" class="spnEditorSign">
<hr class="signature-separator" align="left" style="margin:0.5em 0;width:10em;height:1px;background-color:#999;border:none;">
<blockquote style="margin:0px 0px 0px 40px;padding:0px;font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:small;font-variant-ligatures:normal;orphans:2;widows:2;border:none;">
<span style="font-style:italic;font-size:medium;"><br>
</span>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;padding:0px;font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:small;font-variant-ligatures:normal;orphans:2;widows:2;border:none;">
<span style="font-style:italic;font-size:medium;"><br>
</span>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;padding:0px;font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-variant-ligatures:normal;orphans:2;widows:2;border:none;">
<span style="font-style:italic;"><span style="font-size:x-small;">Wickramage Chathurika Hemamali</span></span>
<div>
<span style="font-style:italic;"><span style="font-size:x-small;">Msc in Physical Oceanography</span></span>
</div>
<div>
<div id="ydpc6aa4ef1yui_3_16_0_ym19_1_1496286059659_2251">
<span style="font-style:italic;"><span style="font-size:x-small;">State Key Laboratory of Tropical Oceanography</span></span>
</div>
</div>
<div>
<div id="ydpc6aa4ef1yui_3_16_0_ym19_1_1496286059659_2252">
<span style="font-style:italic;"><span style="font-size:x-small;">South China Sea Institute of Oceanology</span></span>
</div>
<div id="ydpc6aa4ef1yui_3_16_0_ym19_1_1496286059659_2252">
<span style="font-style:italic;"><span style="font-size:x-small;">University of Chinese Academy of Science</span></span>
</div>
</div>
<div>
<div id="ydpc6aa4ef1yui_3_16_0_ym19_1_1496286059659_2264">
<span style="font-style:italic;"><span style="font-size:x-small;">China</span></span>
</div>
</div>
<div id="ydpc6aa4ef1yui_3_16_0_ym19_1_1496286059659_2264" style="font-size:small;">
<br>
</div>
</blockquote>
</span>